ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
A container of CLEDEntity. More...
#include <led_equipped_entity.h>
Public Types | |
typedef std::map< std::string, CLEDEquippedEntity * > | TMap |
A map of entities. | |
Public Member Functions | |
ENABLE_VTABLE () | |
CLEDEquippedEntity (CComposableEntity *pc_parent, CPositionalEntity *pc_reference) | |
Class constructor. | |
CLEDEquippedEntity (CComposableEntity *pc_parent, const std::string &str_id, CPositionalEntity *pc_reference) | |
Class constructor. | |
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 called. | |
virtual void | Update () |
Updates the status of this entity. | |
void | AddLED (const CVector3 &c_position, const CColor &c_color=CColor::BLACK) |
Adds an LED to this entity. | |
void | AddLEDRing (const CVector3 &c_center, Real f_radius, const CRadians &c_start_angle, UInt32 un_num_leds, 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. | |
CLEDEntity::TList & | GetAllLEDs () |
Returns all the LEDs. | |
const CVector3 & | GetLEDOffsetPosition (size_t un_idx) const |
Returns the offset position of the given LED. | |
void | SetLEDPosition (UInt32 un_index, const CVector3 &c_position) |
Sets the position of an LED. | |
void | SetLEDColor (UInt32 un_index, const CColor &c_color) |
Sets the color of an LED. | |
void | SetAllLEDsColors (const CColor &c_color) |
Sets the color of all the LEDs to the same value. | |
void | SetAllLEDsColors (const std::vector< CColor > &vec_colors) |
Sets the color of all the LEDs to the given setting. | |
bool | HasReferenceEntity () const |
Returns true if this entity has a reference. | |
CPositionalEntity & | GetReferenceEntity () |
Returns the reference of this entity. | |
void | AddToMedium (CLEDMedium &c_medium) |
Adds the LEDs to the wanted LED medium. | |
void | RemoveFromMedium (CLEDMedium &c_medium) |
Removes the LEDs from the wanted LED medium. | |
virtual std::string | GetTypeDescription () const |
Returns a string label for this class. | |
Protected Member Functions | |
virtual void | UpdateComponents () |
Calls the Update() method on all the components. | |
Protected Attributes | |
CLEDEntity::TList | m_tLEDs |
A list of the LEDs contained in this entity. | |
std::vector< CVector3 > | m_vecLEDOffsetPositions |
The offsets of the LEDs. | |
CPositionalEntity * | m_pcReferenceEntity |
The positional reference of this entity. |
A container of CLEDEntity.
This is a convenience class that acts a container of CLEDEntity objects. It is mostly useful when a robot is equipped with a number of LEDs, and you want to manage them comfortably.
You can define a positional entity as the reference of this entity. In this way, if the reference entity moves, this entity will follow automatically. The contained LEDs will also move accordingly. If you don't define a reference entity, the LEDs won't move.
Definition at line 36 of file led_equipped_entity.h.
typedef std::map<std::string, CLEDEquippedEntity*> argos::CLEDEquippedEntity::TMap |
A map of entities.
Reimplemented from argos::CEntity.
Definition at line 42 of file led_equipped_entity.h.
argos::CLEDEquippedEntity::CLEDEquippedEntity | ( | CComposableEntity * | pc_parent, |
CPositionalEntity * | pc_reference | ||
) |
Class constructor.
pc_parent | The parent entity. |
pc_reference | The positional entity to which this entity refers for its position. |
Definition at line 17 of file led_equipped_entity.cpp.
argos::CLEDEquippedEntity::CLEDEquippedEntity | ( | CComposableEntity * | pc_parent, |
const std::string & | str_id, | ||
CPositionalEntity * | pc_reference | ||
) |
Class constructor.
pc_parent | The parent entity. |
str_id | The id of this entity. |
pc_reference | The positional entity to which this entity refers for its position. |
Definition at line 26 of file led_equipped_entity.cpp.
void argos::CLEDEquippedEntity::AddLED | ( | const CVector3 & | c_position, |
const CColor & | c_color = CColor::BLACK |
||
) |
Adds an LED to this entity.
c_position | The position of the LED wrt the reference entity. |
c_color | The color of the LED. |
Definition at line 76 of file led_equipped_entity.cpp.
void argos::CLEDEquippedEntity::AddLEDRing | ( | const CVector3 & | c_center, |
Real | f_radius, | ||
const CRadians & | c_start_angle, | ||
UInt32 | un_num_leds, | ||
const CColor & | c_color = CColor::BLACK |
||
) |
Adds a ring of LEDs to this entity.
c_center | The position of LED ring center wrt the reference entity. |
f_radius | The radius of the LED ring. |
c_start_angle | The angle at which the first LED must be placed. Expressed wrt the local entity x-axis. |
un_num_leds | The number of LEDs to place along the ring. |
c_color | The color of the LEDs. |
Definition at line 91 of file led_equipped_entity.cpp.
void argos::CLEDEquippedEntity::AddToMedium | ( | CLEDMedium & | c_medium | ) |
Adds the LEDs to the wanted LED medium.
c_medium | The LED medium. |
Definition at line 202 of file led_equipped_entity.cpp.
Reimplemented from argos::CComposableEntity.
CLEDEntity::TList& argos::CLEDEquippedEntity::GetAllLEDs | ( | ) | [inline] |
Returns all the LEDs.
Definition at line 107 of file led_equipped_entity.h.
CLEDEntity & argos::CLEDEquippedEntity::GetLED | ( | UInt32 | un_index | ) |
Returns an LED by numeric index.
un_index | The index of the wanted LED. |
Definition at line 112 of file led_equipped_entity.cpp.
const CVector3& argos::CLEDEquippedEntity::GetLEDOffsetPosition | ( | size_t | un_idx | ) | const [inline] |
Returns the offset position of the given LED.
The actual position of an LED is calculated as the sum of the offset position and the position of the reference.
Definition at line 117 of file led_equipped_entity.h.
Returns the reference of this entity.
Make sure this entity has a reference using HasReferenceEntity(), or segfault may occur.
Definition at line 172 of file led_equipped_entity.h.
virtual std::string argos::CLEDEquippedEntity::GetTypeDescription | ( | ) | const [inline, virtual] |
Returns a string label for this class.
Reimplemented from argos::CComposableEntity.
Definition at line 190 of file led_equipped_entity.h.
bool argos::CLEDEquippedEntity::HasReferenceEntity | ( | ) | const [inline] |
Returns true
if this entity has a reference.
true
if this entity has a reference. Definition at line 162 of file led_equipped_entity.h.
void argos::CLEDEquippedEntity::Init | ( | TConfigurationNode & | t_tree | ) | [virtual] |
Initializes the state of the entity from the XML configuration tree.
If the id of the entity has not been set yet, this method sets an id for the entity. If the entity has no parent, this method parses the passed XML tree and looks for the id
attribute, setting its value as id. If, instead, this entity has a parent, the id is set as GetParent().GetId() + "." + GetTypeDescription()
.
CARGoSException | if a parse error occurred |
Reimplemented from argos::CEntity.
Definition at line 36 of file led_equipped_entity.cpp.
void argos::CLEDEquippedEntity::RemoveFromMedium | ( | CLEDMedium & | c_medium | ) |
Removes the LEDs from the wanted LED medium.
c_medium | The LED medium. |
Definition at line 211 of file led_equipped_entity.cpp.
void argos::CLEDEquippedEntity::Reset | ( | ) | [virtual] |
Resets the state of the entity to whatever it was after Init() or the standalone constructor was called.
Internally calls Reset() for all the component entities.
Reimplemented from argos::CComposableEntity.
Definition at line 65 of file led_equipped_entity.cpp.
void argos::CLEDEquippedEntity::SetAllLEDsColors | ( | const CColor & | c_color | ) |
Sets the color of all the LEDs to the same value.
c_color | The color of the LEDs. |
Definition at line 156 of file led_equipped_entity.cpp.
void argos::CLEDEquippedEntity::SetAllLEDsColors | ( | const std::vector< CColor > & | vec_colors | ) |
Sets the color of all the LEDs to the given setting.
vec_colors | A vector containing the colors of the LEDs. |
CARGoSException | if the size of the passed vector is different from the number of LEDs. |
Definition at line 165 of file led_equipped_entity.cpp.
void argos::CLEDEquippedEntity::SetLEDColor | ( | UInt32 | un_index, |
const CColor & | c_color | ||
) |
Sets the color of an LED.
un_index | The index of the wanted LED. |
c_color | The color of the LED. |
Definition at line 141 of file led_equipped_entity.cpp.
void argos::CLEDEquippedEntity::SetLEDPosition | ( | UInt32 | un_index, |
const CVector3 & | c_position | ||
) |
Sets the position of an LED.
un_index | The index of the wanted LED. |
c_position | The position of the LED wrt the reference entity. |
Definition at line 126 of file led_equipped_entity.cpp.
virtual void argos::CLEDEquippedEntity::Update | ( | ) | [inline, virtual] |
Updates the status of this entity.
Internally calls UpdateComponents(). If you plan to overload this method, don't forget to call CComposableEntity::Update() or UpdateComponents() in your code.
Reimplemented from argos::CComposableEntity.
Definition at line 68 of file led_equipped_entity.h.
void argos::CLEDEquippedEntity::UpdateComponents | ( | ) | [protected, virtual] |
Calls the Update() method on all the components.
Reimplemented from argos::CComposableEntity.
Definition at line 186 of file led_equipped_entity.cpp.
The positional reference of this entity.
Definition at line 207 of file led_equipped_entity.h.
CLEDEntity::TList argos::CLEDEquippedEntity::m_tLEDs [protected] |
A list of the LEDs contained in this entity.
Definition at line 201 of file led_equipped_entity.h.
std::vector<CVector3> argos::CLEDEquippedEntity::m_vecLEDOffsetPositions [protected] |
The offsets of the LEDs.
Definition at line 204 of file led_equipped_entity.h.