8 #include <argos3/core/simulator/simulator.h>
9 #include <argos3/core/simulator/space/space.h>
10 #include <argos3/plugins/simulator/media/led_medium.h>
36 const std::string& str_id) :
62 for(itLED = itLED.begin(&t_tree);
72 std::string strAnchorId;
84 m_tLEDs.push_back(
new SActuator(*pcLED, cOffset, cBody.GetAnchor(strAnchorId)));
112 for(
size_t i = 0; i <
m_tLEDs.size(); ++i) {
124 for(
size_t i = 0; i <
m_tLEDs.size(); ++i) {
157 for(
UInt32 i = 0; i < un_num_leds; ++i) {
158 cAngle = c_start_angle + i * cLEDSpacing;
160 cOffset.
Set(f_radius, 0.0f, 0.0f);
163 AddLED(cOffset, s_anchor, c_color);
172 "CLEDEquippedEntity::GetLED(), id=\"" <<
174 "\": index out of bounds: un_index = " <<
176 ", m_tLEDs.size() = " <<
187 "CLEDEquippedEntity::SetLEDPosition(), id=\"" <<
189 "\": index out of bounds: un_index = " <<
191 ", m_tLEDs.size() = " <<
193 m_tLEDs[un_index]->Offset = c_offset;
202 "CLEDEquippedEntity::SetLEDColor(), id=\"" <<
204 "\": index out of bounds: un_index = " <<
206 ", m_tLEDs.size() = " <<
208 m_tLEDs[un_index]->LED.SetColor(c_color);
216 m_tLEDs[i]->LED.SetColor(c_color);
224 if(vec_colors.size() ==
m_tLEDs.size()) {
225 for(
UInt32 i = 0; i < vec_colors.size(); ++i) {
226 m_tLEDs[i]->LED.SetColor(vec_colors[i]);
231 "CLEDEquippedEntity::SetAllLEDsColors(), id=\"" <<
233 "\": number of LEDs (" <<
235 ") is lower than the passed color vector size (" <<
248 if(
m_tLEDs[i]->LED.IsEnabled()) {
249 cLEDPosition =
m_tLEDs[i]->Offset;
251 cLEDPosition +=
m_tLEDs[i]->Anchor.Position;
252 m_tLEDs[i]->LED.SetPosition(cLEDPosition);
262 m_tLEDs[i]->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.
float Real
Collects all ARGoS code.
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.
std::string ToString(const T &t_value)
Converts the given parameter to a std::string.
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.
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.
static const CRadians TWO_PI
Set to PI * 2.
CRadians & SignedNormalize()
Normalizes the value in the range [-PI:PI].
CVector3 & Rotate(const CQuaternion &c_quaternion)
Rotates this vector by the given quaternion.
void Set(const Real f_x, const Real f_y, const Real f_z)
Sets the vector contents from Cartesian coordinates.
CVector3 & RotateZ(const CRadians &c_angle)
Rotates this vector wrt the z axis.
A container of CLEDEntity.
void SetAllLEDsColors(const CColor &c_color)
Sets the color of all the LEDs to the same value.
void AddLEDRing(const CVector3 &c_center, Real f_radius, const CRadians &c_start_angle, UInt32 un_num_leds, SAnchor &s_anchor, const CColor &c_color=CColor::BLACK)
Adds a ring of LEDs to this entity.
CLEDEntity & GetLED(UInt32 un_index)
Returns an LED by numeric index.
void SetLEDColor(UInt32 un_index, const CColor &c_color)
Sets the color of an LED.
void SetLEDOffset(UInt32 un_index, const CVector3 &c_offset)
Sets the position of an LED.
void SetMedium(CLEDMedium &c_medium)
Sets the medium associated to this entity.
void AddLED(const CVector3 &c_offset, SAnchor &s_anchor, const CColor &c_color=CColor::BLACK)
Adds an LED to this entity.
CLEDEquippedEntity(CComposableEntity *pc_parent)
Class constructor.
virtual void UpdateComponents()
Calls the Update() method on all the components.
~CLEDEquippedEntity()
Class destructor.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
SActuator::TList m_tLEDs
List of the LEDs managed by this entity.
SActuator(CLEDEntity &c_led, const CVector3 &c_offset, SAnchor &s_anchor)