box_entity.h
Go to the documentation of this file.
1 
7 #ifndef BOX_ENTITY_H
8 #define BOX_ENTITY_H
9 
10 namespace argos {
11  class CBoxEntity;
12 }
13 
14 #include <argos3/core/simulator/entity/embodied_entity.h>
15 #include <argos3/core/simulator/entity/composable_entity.h>
16 #include <argos3/plugins/simulator/entities/led_equipped_entity.h>
17 
18 namespace argos {
19 
20  class CBoxEntity : public CComposableEntity {
21 
22  public:
23 
24  ENABLE_VTABLE();
25 
26  CBoxEntity();
27 
28  CBoxEntity(const std::string& str_id,
29  const CVector3& c_position,
30  const CQuaternion& c_orientation,
31  bool b_movable,
32  const CVector3& c_size,
33  Real f_mass = 1.0f);
34 
35  virtual void Init(TConfigurationNode& t_tree);
36  virtual void Reset();
37 
38  /*
39  * Enables the LEDs for this entity.
40  * Adds the LED equipped entity to the given medium.
41  * If you don't call this method, the LEDs added with
42  * CBoxEntity::AddLED() won't be updated correctly.
43  * @param c_medium The medium to which the LEDs must be associated.
44  * @see CBoxEntity::AddLED()
45  */
46  void EnableLEDs(CLEDMedium& c_medium);
47 
48  /*
49  * Disables the LEDs for this entity.
50  */
51  void DisableLEDs();
52 
61  void AddLED(const CVector3& c_offset,
62  const CColor& c_color = CColor::BLACK);
63 
65  return *m_pcEmbodiedEntity;
66  }
67 
68  inline const CEmbodiedEntity& GetEmbodiedEntity() const {
69  return *m_pcEmbodiedEntity;
70  }
71 
73  return *m_pcLEDEquippedEntity;
74  }
75 
76  inline const CLEDEquippedEntity& GetLEDEquippedEntity() const {
77  return *m_pcLEDEquippedEntity;
78  }
79 
80  inline const CVector3& GetSize() const {
81  return m_cSize;
82  }
83 
84  inline void SetSize(const CVector3& c_size) {
85  m_cSize = c_size;
86  }
87 
88  inline Real GetMass() const {
89  return m_fMass;
90  }
91 
92  inline void SetMass(Real f_mass) {
93  m_fMass = f_mass;
94  }
95 
96  virtual std::string GetTypeDescription() const {
97  return "box";
98  }
99 
100  private:
101 
102  CEmbodiedEntity* m_pcEmbodiedEntity;
103  CLEDEquippedEntity* m_pcLEDEquippedEntity;
104  CVector3 m_cSize;
105  Real m_fMass;
106  CLEDMedium* m_pcLEDMedium;
107 
108  };
109 
110 }
111 
112 #endif
A 3D vector class.
Definition: vector3.h:29
static CColor BLACK
Definition: color.h:29
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
CLEDEquippedEntity & GetLEDEquippedEntity()
Definition: box_entity.h:72
const CLEDEquippedEntity & GetLEDEquippedEntity() const
Definition: box_entity.h:76
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
This entity is a link to a body in the physics engine.
Real GetMass() const
Definition: box_entity.h:88
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
Definition: box_entity.cpp:53
void EnableLEDs(CLEDMedium &c_medium)
Definition: box_entity.cpp:109
A container of CLEDEntity.
Basic class for an entity that contains other entities.
void SetMass(Real f_mass)
Definition: box_entity.h:92
CEmbodiedEntity & GetEmbodiedEntity()
Definition: box_entity.h:64
const CEmbodiedEntity & GetEmbodiedEntity() const
Definition: box_entity.h:68
The basic color type.
Definition: color.h:25
void SetSize(const CVector3 &c_size)
Definition: box_entity.h:84
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
Definition: box_entity.cpp:99
void AddLED(const CVector3 &c_offset, const CColor &c_color=CColor::BLACK)
Adds an LED to this entity.
Definition: box_entity.cpp:125
virtual std::string GetTypeDescription() const
Returns a string label for this class.
Definition: box_entity.h:96
const CVector3 & GetSize() const
Definition: box_entity.h:80
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12