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 
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  void Resize(const CVector3& c_size);
85 
86  inline Real GetMass() const {
87  return m_fMass;
88  }
89 
90  inline void SetMass(Real f_mass) {
91  m_fMass = f_mass;
92  }
93 
94  virtual std::string GetTypeDescription() const {
95  return "box";
96  }
97 
98  private:
99 
100  CEmbodiedEntity* m_pcEmbodiedEntity;
101  CLEDEquippedEntity* m_pcLEDEquippedEntity;
102  CVector3 m_cSize;
103  Real m_fMass;
104  CLEDMedium* m_pcLEDMedium;
105 
106  };
107 
108 }
109 
110 #endif
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
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.
This entity is a link to a body in the physics engine.
The basic color type.
Definition: color.h:25
static CColor BLACK
Definition: color.h:29
A 3D vector class.
Definition: vector3.h:31
CEmbodiedEntity & GetEmbodiedEntity()
Definition: box_entity.h:64
CLEDEquippedEntity & GetLEDEquippedEntity()
Definition: box_entity.h:72
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:100
const CEmbodiedEntity & GetEmbodiedEntity() const
Definition: box_entity.h:68
virtual std::string GetTypeDescription() const
Returns a string label for this class.
Definition: box_entity.h:94
void SetMass(Real f_mass)
Definition: box_entity.h:90
Real GetMass() const
Definition: box_entity.h:86
const CVector3 & GetSize() const
Definition: box_entity.h:80
void EnableLEDs(CLEDMedium &c_medium)
Definition: box_entity.cpp:110
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
Definition: box_entity.cpp:54
const CLEDEquippedEntity & GetLEDEquippedEntity() const
Definition: box_entity.h:76
void Resize(const CVector3 &c_size)
Definition: box_entity.cpp:137
void AddLED(const CVector3 &c_offset, const CColor &c_color=CColor::BLACK)
Adds an LED to this entity.
Definition: box_entity.cpp:126
A container of CLEDEntity.