ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
Go to the documentation of this file.
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;
98 for(SActuator::TList::iterator it =
m_tLEDs.begin();
110 for(
size_t i = 0; i <
m_tLEDs.size(); ++i) {
120 for(
size_t i = 0; i <
m_tLEDs.size(); ++i) {
153 for(
UInt32 i = 0; i < un_num_leds; ++i) {
154 cAngle = c_start_angle + i * cLEDSpacing;
156 cOffset.
Set(f_radius, 0.0f, 0.0f);
159 AddLED(cOffset, s_anchor, c_color);
168 "CLEDEquippedEntity::GetLED(), id=\"" <<
170 "\": index out of bounds: un_index = " <<
172 ", m_tLEDs.size() = " <<
183 "CLEDEquippedEntity::SetLEDPosition(), id=\"" <<
185 "\": index out of bounds: un_index = " <<
187 ", m_tLEDs.size() = " <<
189 m_tLEDs[un_index]->Offset = c_offset;
198 "CLEDEquippedEntity::SetLEDColor(), id=\"" <<
200 "\": index out of bounds: un_index = " <<
202 ", m_tLEDs.size() = " <<
204 m_tLEDs[un_index]->LED.SetColor(c_color);
212 m_tLEDs[i]->LED.SetColor(c_color);
220 if(vec_colors.size() ==
m_tLEDs.size()) {
221 for(
UInt32 i = 0; i < vec_colors.size(); ++i) {
222 m_tLEDs[i]->LED.SetColor(vec_colors[i]);
227 "CLEDEquippedEntity::SetAllLEDsColors(), id=\"" <<
229 "\": number of LEDs (" <<
231 ") is lower than the passed color vector size (" <<
244 if(
m_tLEDs[i]->LED.IsEnabled()) {
245 cLEDPosition =
m_tLEDs[i]->Offset;
247 cLEDPosition +=
m_tLEDs[i]->Anchor.Position;
248 m_tLEDs[i]->LED.SetPosition(cLEDPosition);
258 m_tLEDs[i]->LED.AddToMedium(c_medium);
268 m_tLEDs[i]->LED.RemoveFromMedium();
void Set(const Real f_x, const Real f_y, const Real f_z)
Sets the vector contents from Cartesian coordinates.
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.
const std::string & GetId() const
Returns the id of this entity.
CLEDEntity & GetLED(UInt32 un_index)
Returns an LED by numeric index.
CLEDEquippedEntity(CComposableEntity *pc_parent)
Class constructor.
The namespace containing all the ARGoS related code.
SActuator::TList m_tLEDs
List of the LEDs managed by this entity.
const SAnchor & GetAnchor(const std::string &str_id) const
Returns the wanted anchor as a const reference.
void SetAllLEDsColors(const CColor &c_color)
Sets the color of all the LEDs to the same value.
It defines the basic type CRadians, used to store an angle value in radians.
Basic class for an entity that contains other entities.
The exception that wraps all errors in ARGoS.
CEntity & GetComponent(const std::string &str_component)
Returns the component with the passed string label.
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
void Enable()
Enables the entity.
CRadians & SignedNormalize()
Normalizes the value in the range [-PI:PI].
CVector3 & RotateZ(const CRadians &c_angle)
Rotates this vector wrt the z axis.
This entity is a link to a body in the physics engine.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
void AddComponent(CEntity &c_component)
Adds a component to this composable entity.
A container of CLEDEntity.
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_COMPOSABLE(CComposableEntity)
ticpp::Iterator< ticpp::Element > TConfigurationNodeIterator
The iterator for the ARGoS configuration XML node.
#define THROW_ARGOSEXCEPTION(message)
This macro throws an ARGoS exception with the passed message.
SActuator(CLEDEntity &c_led, const CVector3 &c_offset, SAnchor &s_anchor)
An anchor related to the body of an entity.
~CLEDEquippedEntity()
Class destructor.
void AddToMedium(CLEDMedium &c_medium)
Adds the LEDs to the wanted LED medium.
void SetLEDColor(UInt32 un_index, const CColor &c_color)
Sets the color of an LED.
virtual void UpdateComponents()
Calls the Update() method on all the components.
std::string ToString(const T &t_value)
Converts the given parameter to a std::string.
CComposableEntity & GetParent()
Returns this entity's parent.
#define ARGOS_ASSERT(condition, message)
When code is compiled in debug, this macro throws an ARGoS exception with the passed message if the s...
void SetLEDOffset(UInt32 un_index, const CVector3 &c_offset)
Sets the position of an LED.
unsigned int UInt32
32-bit unsigned integer.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
void Disable()
Disables the entity.
void GetNodeAttribute(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer)
Returns the value of a node's attribute.
CVector3 & Rotate(const CQuaternion &c_quaternion)
Rotates this vector by the given quaternion.
static const CRadians TWO_PI
Set to PI * 2.
float Real
Collects all ARGoS code.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
void AddLED(const CVector3 &c_offset, SAnchor &s_anchor, const CColor &c_color=CColor::BLACK)
Adds an LED to this entity.
void RemoveFromMedium()
Removes the LEDs from the associated LED medium.