A container of CLEDEntity. More...

#include <led_equipped_entity.h>

Inheritance diagram for argos::CLEDEquippedEntity:
Collaboration diagram for argos::CLEDEquippedEntity:

Classes

struct  SActuator
 

Public Types

typedef std::map< std::string, CLEDEquippedEntity * > TMap
 
- Public Types inherited from argos::CEntity
typedef std::vector< CEntity * > TVector
 A vector of entities. More...
 
typedef unordered_map< std::string, CEntity * > TMap
 A map of entities. More...
 
typedef std::multimap< std::string, CEntity * > TMultiMap
 A multi-map of entities. More...
 

Public Member Functions

 ENABLE_VTABLE ()
 
 CLEDEquippedEntity (CComposableEntity *pc_parent)
 Class constructor. More...
 
 CLEDEquippedEntity (CComposableEntity *pc_parent, const std::string &str_id)
 Class constructor. More...
 
 ~CLEDEquippedEntity ()
 Class destructor. More...
 
virtual void Init (TConfigurationNode &t_tree)
 Initializes the state of the entity from the XML configuration tree. More...
 
virtual void Reset ()
 Resets the state of the entity to whatever it was after Init() or the standalone constructor was called. More...
 
virtual void Enable ()
 
virtual void Disable ()
 
void AddLED (const CVector3 &c_offset, SAnchor &s_anchor, const CColor &c_color=CColor::BLACK)
 Adds an LED to this entity. More...
 
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. More...
 
CLEDEntityGetLED (UInt32 un_index)
 Returns an LED by numeric index. More...
 
SActuator::TListGetLEDs ()
 Returns all the LEDs. More...
 
const CVector3GetLEDOffset (size_t un_idx) const
 Returns the offset position of the given LED. More...
 
void SetLEDOffset (UInt32 un_index, const CVector3 &c_offset)
 Sets the position of an LED. More...
 
void SetLEDColor (UInt32 un_index, const CColor &c_color)
 Sets the color of an LED. More...
 
void SetAllLEDsColors (const CColor &c_color)
 Sets the color of all the LEDs to the same value. More...
 
void SetAllLEDsColors (const std::vector< CColor > &vec_colors)
 Sets the color of all the LEDs to the given setting. More...
 
void SetMedium (CLEDMedium &c_medium)
 Sets the medium associated to this entity. More...
 
virtual std::string GetTypeDescription () const
 Returns a string label for this class. More...
 
- Public Member Functions inherited from argos::CComposableEntity
 ENABLE_VTABLE ()
 
 CComposableEntity (CComposableEntity *pc_parent)
 Class constructor. More...
 
 CComposableEntity (CComposableEntity *pc_parent, const std::string &str_id)
 Class constructor. More...
 
virtual ~CComposableEntity ()
 Class destructor. More...
 
virtual void Update ()
 Updates the status of this entity. More...
 
virtual void SetEnabled (bool b_enabled)
 Enables or disables an entity. More...
 
void AddComponent (CEntity &c_component)
 Adds a component to this composable entity. More...
 
CEntityRemoveComponent (const std::string &str_component)
 Removes a component from this composable entity. More...
 
CEntityGetComponent (const std::string &str_component)
 Returns the component with the passed string label. More...
 
template<class E >
E & GetComponent (const std::string &str_component)
 Returns the component with the passed string label. More...
 
bool HasComponent (const std::string &str_component)
 Returns true if this composable entity has a component with the given string label. More...
 
CEntity::TMultiMap::iterator FindComponent (const std::string &str_component)
 Searches for a component with the given string label. More...
 
CEntity::TMultiMapGetComponentMap ()
 Returns the map of all the components. More...
 
CEntity::TVectorGetComponentVector ()
 Returns the vector of all the components. More...
 
- Public Member Functions inherited from argos::CEntity
 ENABLE_VTABLE ()
 
 CEntity (CComposableEntity *pc_parent)
 Class constructor. More...
 
 CEntity (CComposableEntity *pc_parent, const std::string &str_id)
 Class constructor. More...
 
virtual ~CEntity ()
 Class destructor. More...
 
virtual void Destroy ()
 Destroys the entity, undoing whatever was done by Init() or by the standalone constructor. More...
 
const std::string & GetId () const
 Returns the id of this entity. More...
 
std::string GetContext () const
 Returns the context of this entity. More...
 
bool HasParent () const
 Returns true if this entity has a parent. More...
 
CEntityGetRootEntity ()
 Returns the root entity containing this entity. More...
 
const CEntityGetRootEntity () const
 Returns the root entity containing this entity. More...
 
CComposableEntityGetParent ()
 Returns this entity's parent. More...
 
const CComposableEntityGetParent () const
 Returns this entity's parent. More...
 
void SetParent (CComposableEntity &c_parent)
 Sets this entity's parent. More...
 
ssize_t GetIndex () const
 Returns the entity index. More...
 
void SetIndex (ssize_t n_idx)
 Sets the entity index. More...
 
bool IsEnabled () const
 Returns true if the entity is enabled. More...
 
void Enable ()
 Enables the entity. More...
 
void Disable ()
 Disables the entity. More...
 
TConfigurationNodeGetConfigurationNode ()
 Returns a pointer to the configuration node that was used to create this entity. More...
 
- Public Member Functions inherited from argos::CBaseConfigurableResource
virtual ~CBaseConfigurableResource ()
 Class destructor. More...
 
- Public Member Functions inherited from argos::EnableVTableFor< CEntity >
size_t GetTagHelper (const DERIVED *) const
 

Protected Member Functions

virtual void UpdateComponents ()
 Calls the Update() method on all the components. More...
 

Protected Attributes

SActuator::TList m_tLEDs
 List of the LEDs managed by this entity. More...
 

Detailed Description

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.

See also
CLEDEntity

Definition at line 36 of file led_equipped_entity.h.

Member Typedef Documentation

◆ TMap

typedef std::map<std::string, CLEDEquippedEntity*> argos::CLEDEquippedEntity::TMap

Definition at line 42 of file led_equipped_entity.h.

Constructor & Destructor Documentation

◆ CLEDEquippedEntity() [1/2]

argos::CLEDEquippedEntity::CLEDEquippedEntity ( CComposableEntity pc_parent)

Class constructor.

Parameters
pc_parentThe parent entity.

Definition at line 27 of file led_equipped_entity.cpp.

◆ CLEDEquippedEntity() [2/2]

argos::CLEDEquippedEntity::CLEDEquippedEntity ( CComposableEntity pc_parent,
const std::string &  str_id 
)

Class constructor.

Parameters
pc_parentThe parent entity.
str_idThe id of this entity.

Definition at line 35 of file led_equipped_entity.cpp.

◆ ~CLEDEquippedEntity()

argos::CLEDEquippedEntity::~CLEDEquippedEntity ( )

Class destructor.

Definition at line 44 of file led_equipped_entity.cpp.

Member Function Documentation

◆ AddLED()

void argos::CLEDEquippedEntity::AddLED ( const CVector3 c_offset,
SAnchor s_anchor,
const CColor c_color = CColor::BLACK 
)

Adds an LED to this entity.

Parameters
c_offsetThe position of the LED wrt the anchor.
s_anchorThe anchor of the LED.
c_colorThe color of the LED.

Definition at line 132 of file led_equipped_entity.cpp.

◆ AddLEDRing()

void argos::CLEDEquippedEntity::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.

Parameters
c_centerThe position of LED ring center wrt the reference entity.
f_radiusThe radius of the LED ring.
c_start_angleThe angle at which the first LED must be placed. Expressed wrt the local entity x-axis.
un_num_ledsThe number of LEDs to place along the ring.
s_anchorThe anchor of the LED.
c_colorThe color of the LEDs.

Definition at line 148 of file led_equipped_entity.cpp.

◆ Disable()

void argos::CLEDEquippedEntity::Disable ( )
virtual

Definition at line 120 of file led_equipped_entity.cpp.

◆ Enable()

void argos::CLEDEquippedEntity::Enable ( )
virtual

Definition at line 108 of file led_equipped_entity.cpp.

◆ ENABLE_VTABLE()

argos::CLEDEquippedEntity::ENABLE_VTABLE ( )

◆ GetLED()

CLEDEntity & argos::CLEDEquippedEntity::GetLED ( UInt32  un_index)

Returns an LED by numeric index.

Parameters
un_indexThe index of the wanted LED.
Returns
An LED by numeric index.
See also
GetAllLEDs()

Definition at line 170 of file led_equipped_entity.cpp.

◆ GetLEDOffset()

const CVector3& argos::CLEDEquippedEntity::GetLEDOffset ( size_t  un_idx) const
inline

Returns the offset position of the given LED.

The actual position of an LED is calculated as the vector sum of the offset position and the anchor.

Returns
The offset position of the given LED.

Definition at line 136 of file led_equipped_entity.h.

◆ GetLEDs()

SActuator::TList& argos::CLEDEquippedEntity::GetLEDs ( )
inline

Returns all the LEDs.

Returns
All the LEDs.
See also
GetLED()

Definition at line 126 of file led_equipped_entity.h.

◆ GetTypeDescription()

virtual std::string argos::CLEDEquippedEntity::GetTypeDescription ( ) const
inlinevirtual

Returns a string label for this class.

Returns
A string label for this class.

Reimplemented from argos::CComposableEntity.

Definition at line 185 of file led_equipped_entity.h.

◆ Init()

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().

Exceptions
CARGoSExceptionif a parse error occurred

Reimplemented from argos::CEntity.

Definition at line 54 of file led_equipped_entity.cpp.

◆ Reset()

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 97 of file led_equipped_entity.cpp.

◆ SetAllLEDsColors() [1/2]

void argos::CLEDEquippedEntity::SetAllLEDsColors ( const CColor c_color)

Sets the color of all the LEDs to the same value.

Parameters
c_colorThe color of the LEDs.
See also
SetAllLEDsColors()

Definition at line 214 of file led_equipped_entity.cpp.

◆ SetAllLEDsColors() [2/2]

void argos::CLEDEquippedEntity::SetAllLEDsColors ( const std::vector< CColor > &  vec_colors)

Sets the color of all the LEDs to the given setting.

Parameters
vec_colorsA vector containing the colors of the LEDs.
See also
SetAllLEDsColors()
Exceptions
CARGoSExceptionif the size of the passed vector is different from the number of LED.

Definition at line 223 of file led_equipped_entity.cpp.

◆ SetLEDColor()

void argos::CLEDEquippedEntity::SetLEDColor ( UInt32  un_index,
const CColor c_color 
)

Sets the color of an LED.

Parameters
un_indexThe index of the wanted LED.
c_colorThe color of the LED.

Definition at line 199 of file led_equipped_entity.cpp.

◆ SetLEDOffset()

void argos::CLEDEquippedEntity::SetLEDOffset ( UInt32  un_index,
const CVector3 c_offset 
)

Sets the position of an LED.

Parameters
un_indexThe index of the wanted LED.
c_offsetThe position of the LED wrt the anchor.

Definition at line 184 of file led_equipped_entity.cpp.

◆ SetMedium()

void argos::CLEDEquippedEntity::SetMedium ( CLEDMedium c_medium)

Sets the medium associated to this entity.

Parameters
c_mediumThe medium to associate to this entity.
See also
CLEDMedium

Definition at line 260 of file led_equipped_entity.cpp.

◆ UpdateComponents()

void argos::CLEDEquippedEntity::UpdateComponents ( )
protectedvirtual

Calls the Update() method on all the components.

See also
Update()

Reimplemented from argos::CComposableEntity.

Definition at line 244 of file led_equipped_entity.cpp.

Member Data Documentation

◆ m_tLEDs

SActuator::TList argos::CLEDEquippedEntity::m_tLEDs
protected

List of the LEDs managed by this entity.

Definition at line 196 of file led_equipped_entity.h.