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;
77 cBody.GetAnchor(strAnchorId),
125 s_instance.Anchor.Enable();
137 s_instance.Anchor.Disable();
146 "CLEDEquippedEntity::GetLED(), id=\"" <<
148 "\": index out of bounds: un_index = " <<
150 ", m_vecInstances.size() = " <<
160 "CLEDEquippedEntity::GetLED(), id=\"" <<
162 "\": index out of bounds: un_index = " <<
164 ", m_vecInstances.size() = " <<
175 "CLEDEquippedEntity::SetLEDColor(), id=\"" <<
177 "\": index out of bounds: un_index = " <<
179 ", m_vecInstances.size() = " <<
189 s_instance.LED.SetColor(c_color);
198 for(
UInt32 i = 0; i < vec_colors.size(); ++i) {
204 "CDirectionalLEDEquippedEntity::SetLEDColors(), id=\"" <<
206 "\": number of LEDs (" <<
208 ") does not equal the passed color vector size (" <<
222 if(s_instance.LED.IsEnabled()) {
223 cLEDPosition = s_instance.PositionOffset;
224 cLEDPosition.
Rotate(s_instance.Anchor.Orientation);
225 cLEDPosition += s_instance.Anchor.Position;
226 cLEDOrientation = s_instance.Anchor.Orientation *
227 s_instance.OrientationOffset;
228 s_instance.LED.MoveTo(cLEDPosition, cLEDOrientation);
238 s_instance.LED.SetMedium(c_medium);
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
unsigned int UInt32
32-bit unsigned integer.
The namespace containing all the ARGoS related code.
ticpp::Iterator< ticpp::Element > TConfigurationNodeIterator
The iterator for the ARGoS configuration XML node.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_COMPOSABLE(CComposableEntity)
void GetNodeAttribute(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer)
Returns the value of a node's attribute.
Basic class for an entity that contains other entities.
CEntity & GetComponent(const std::string &str_component)
Returns the component with the passed string label.
void AddComponent(CEntity &c_component)
Adds a component to this composable entity.
This entity is a link to a body in the physics engine.
void Disable()
Disables the entity.
const std::string & GetId() const
Returns the id of this entity.
std::string GetContext() const
Returns the context of this entity.
void Enable()
Enables the entity.
CComposableEntity & GetParent()
Returns this entity's parent.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
An anchor related to the body of an entity.
The exception that wraps all errors in ARGoS.
It defines the basic type CRadians, used to store an angle value in radians.
CVector3 & Rotate(const CQuaternion &c_quaternion)
Rotates this vector by the given quaternion.
A container of CDirectionalLEDEntity.
virtual void UpdateComponents()
Calls the Update() method on all the components.
void AddLED(const std::string &str_id, const CVector3 &c_position, const CQuaternion &c_orientation, SAnchor &s_anchor, const CRadians &c_observable_angle, const CColor &c_color)
Programmatically creates a new directional LED.
void SetLEDColor(UInt32 un_index, const CColor &c_color)
Sets the color of an LED.
void SetLEDColors(const CColor &c_color)
Sets the color of all the LEDs to the same value.
CDirectionalLEDEquippedEntity(CComposableEntity *pc_parent)
Class constructor.
SInstance::TVector m_vecInstances
List of the LEDs managed by this entity.
void SetMedium(CDirectionalLEDMedium &c_medium)
Sets the medium associated to this 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.
SInstance(CDirectionalLEDEntity &c_led, SAnchor &s_anchor, const CVector3 &c_position_offset, const CQuaternion &c_orientation_offset)