8 #include <argos3/core/simulator/simulator.h>
9 #include <argos3/core/simulator/space/space.h>
10 #include <argos3/plugins/simulator/media/directional_led_medium.h>
23 PositionOffset(c_position_offset),
24 OrientationOffset(c_orientation_offset) {}
38 const std::string& str_id) :
52 for(itLED = itLED.begin(&t_tree);
63 std::string strAnchorId;
98 s_instance.Anchor.Enable();
110 s_instance.Anchor.Disable();
119 "CLEDEquippedEntity::GetLED(), id=\"" <<
121 "\": index out of bounds: un_index = " <<
123 ", m_vecInstances.size() = " <<
134 "CLEDEquippedEntity::SetLEDColor(), id=\"" <<
136 "\": index out of bounds: un_index = " <<
138 ", m_vecInstances.size() = " <<
148 s_instance.LED.SetColor(c_color);
157 for(
UInt32 i = 0; i < vec_colors.size(); ++i) {
163 "CDirectionalLEDEquippedEntity::SetLEDColors(), id=\"" <<
165 "\": number of LEDs (" <<
167 ") does not equal the passed color vector size (" <<
181 if(s_instance.LED.IsEnabled()) {
182 cLEDPosition = s_instance.PositionOffset;
183 cLEDPosition.
Rotate(s_instance.Anchor.Orientation);
184 cLEDPosition += s_instance.Anchor.Position;
185 cLEDOrientation = s_instance.Anchor.Orientation *
186 s_instance.OrientationOffset;
187 s_instance.LED.MoveTo(cLEDPosition, cLEDOrientation);
197 s_instance.LED.SetMedium(c_medium);
virtual void UpdateComponents()
Calls the Update() method on all the components.
void Enable()
Enables the entity.
SInstance::TVector m_vecInstances
List of the LEDs managed by this entity.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
CVector3 & Rotate(const CQuaternion &c_quaternion)
Rotates this vector by the given quaternion.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
This entity is a link to a body in the physics engine.
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception...
void SetLEDColor(UInt32 un_index, const CColor &c_color)
Sets the color of an LED.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
unsigned int UInt32
32-bit unsigned integer.
Basic class for an entity that contains other entities.
void SetLEDColors(const CColor &c_color)
Sets the color of all the LEDs to the same value.
An anchor related to the body of an entity.
void AddComponent(CEntity &c_component)
Adds a component to this composable entity.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
CDirectionalLEDEntity & GetLED(UInt32 un_index)
Returns an LED by numeric index.
ticpp::Iterator< ticpp::Element > TConfigurationNodeIterator
The iterator for the ARGoS configuration XML node.
void GetNodeAttribute(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer)
Returns the value of a node's attribute.
The exception that wraps all errors in ARGoS.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
void Disable()
Disables the entity.
CDirectionalLEDEquippedEntity(CComposableEntity *pc_parent)
Class constructor.
const SAnchor & GetAnchor(const std::string &str_id) const
Returns the wanted anchor as a const reference.
const std::string & GetId() const
Returns the id of this entity.
A container of CDirectionalLEDEntity.
CComposableEntity & GetParent()
Returns this entity's parent.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_COMPOSABLE(CComposableEntity)
The namespace containing all the ARGoS related code.
std::string GetContext() const
Returns the context of this entity.
void SetMedium(CDirectionalLEDMedium &c_medium)
Sets the medium associated to this entity.
SInstance(CDirectionalLEDEntity &c_led, SAnchor &s_anchor, const CVector3 &c_position_offset, const CQuaternion &c_orientation_offset)
CEntity & GetComponent(const std::string &str_component)
Returns the component with the passed string label.