ARGoS 3
A parallel, multi-engine simulator for swarm robotics
directional_led_entity.h
Go to the documentation of this file.
1
7#ifndef DIRECTIONAL_LED_ENTITY_H
8#define DIRECTIONAL_LED_ENTITY_H
9
10namespace argos {
11 class CDirectionalLEDEntity;
12 class CDirectionalLEDMedium;
13}
14
15#include <argos3/core/simulator/entity/positional_entity.h>
16#include <argos3/core/utility/datatypes/set.h>
17#include <argos3/core/utility/datatypes/color.h>
18#include <argos3/core/utility/math/vector3.h>
19#include <argos3/core/simulator/space/positional_indices/space_hash.h>
20#include <argos3/core/simulator/space/positional_indices/grid.h>
21
22namespace argos {
23
25
26 public:
27
29
30 typedef std::vector<CDirectionalLEDEntity*> TList;
32
33 public:
34
36
38 const std::string& str_id,
39 const CVector3& c_position,
40 const CQuaternion& c_orientation,
41 const CRadians& c_observable_angle,
42 const CColor& c_color);
43
45
46 virtual void Init(TConfigurationNode& t_tree);
47
48 virtual void Reset();
49
50 virtual void Destroy();
51
52 virtual void SetEnabled(bool b_enabled);
53
60 inline const CColor& GetColor() const {
61 return m_cColor;
62 }
63
68 inline const CRadians& GetObservableAngle() const {
69 return m_cObservableAngle;
70 }
71
79 inline const CColor& GetInitColor() const {
80 return m_cInitColor;
81 }
82
88 void SetColor(const CColor& c_color);
89
97 inline void SetInitColor(const CColor& c_color) {
98 m_cInitColor = c_color;
99 }
100
101 virtual std::string GetTypeDescription() const {
102 return "directional_led";
103 }
104
110 inline bool HasMedium() const {
111 return m_pcMedium != nullptr;
112 }
113
120
126 void SetMedium(CDirectionalLEDMedium& c_medium);
127
128 protected:
129
134
135 };
136
137 /****************************************/
138 /****************************************/
139
140 class CDirectionalLEDEntitySpaceHashUpdater : public CSpaceHashUpdater<CDirectionalLEDEntity> {
141
142 public:
143
144 virtual void operator()(CAbstractSpaceHash<CDirectionalLEDEntity>& c_space_hash,
145 CDirectionalLEDEntity& c_element);
146
147 private:
148
149 SInt32 m_nI, m_nJ, m_nK;
150
151 };
152
153 /****************************************/
154 /****************************************/
155
156 class CDirectionalLEDEntityGridUpdater : public CGrid<CDirectionalLEDEntity>::COperation {
157
158 public:
159
161 virtual bool operator()(CDirectionalLEDEntity& c_entity);
162
163 private:
164
166 SInt32 m_nI, m_nJ, m_nK;
167
168 };
169
170 /****************************************/
171 /****************************************/
172
173}
174
175#endif
signed int SInt32
32-bit signed integer.
Definition datatypes.h:93
The namespace containing all the ARGoS related code.
Definition ci_actuator.h:12
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
Basic class for an entity that contains other entities.
The abstract definition of a space hash.
Definition space_hash.h:34
Defines the basic cell updater of the space hash.
Definition space_hash.h:269
The basic color type.
Definition color.h:25
Defines a very simple double-linked list that stores unique elements.
Definition set.h:101
It defines the basic type CRadians, used to store an angle value in radians.
Definition angles.h:42
A 3D vector class.
Definition vector3.h:31
virtual void Destroy()
Destroys the entity, undoing whatever was done by Init() or by the standalone constructor.
virtual std::string GetTypeDescription() const
Returns a string label for this class.
std::vector< CDirectionalLEDEntity * > TList
void SetColor(const CColor &c_color)
Sets the current color of the LED.
void SetMedium(CDirectionalLEDMedium &c_medium)
Sets the medium associated to this entity.
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
const CColor & GetColor() const
Returns the current color of the LED.
const CRadians & GetObservableAngle() const
Returns the observable angle of the LED.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
virtual void SetEnabled(bool b_enabled)
Enables or disables an entity.
CDirectionalLEDEntity(CComposableEntity *pc_parent)
CSet< CDirectionalLEDEntity * > TSet
CDirectionalLEDMedium & GetMedium() const
Returns the medium associated to this directional LED.
void SetInitColor(const CColor &c_color)
Sets the initialization color for this LED.
bool HasMedium() const
Returns true if this directional LED is associated to a medium.
const CColor & GetInitColor() const
Returns the color with which the LED was initialized.
virtual void operator()(CAbstractSpaceHash< CDirectionalLEDEntity > &c_space_hash, CDirectionalLEDEntity &c_element)
Updates the necessary cells of a space hash.
CDirectionalLEDEntityGridUpdater(CGrid< CDirectionalLEDEntity > &c_grid)
virtual bool operator()(CDirectionalLEDEntity &c_entity)