ARGoS  3
A parallel, multi-engine simulator for swarm robotics
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 update 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
argos::CBoxEntity::GetLEDEquippedEntity
const CLEDEquippedEntity & GetLEDEquippedEntity() const
Definition: box_entity.h:76
argos
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
argos::CBoxEntity::EnableLEDs
void EnableLEDs(CLEDMedium &c_medium)
Definition: box_entity.cpp:108
argos::CVector3
A 3D vector class.
Definition: vector3.h:29
argos::CComposableEntity
Basic class for an entity that contains other entities.
Definition: composable_entity.h:32
argos::CBoxEntity::GetMass
Real GetMass() const
Definition: box_entity.h:88
argos::CBoxEntity
Definition: box_entity.h:20
argos::CBoxEntity::Init
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
Definition: box_entity.cpp:53
argos::CEmbodiedEntity
This entity is a link to a body in the physics engine.
Definition: embodied_entity.h:48
argos::TConfigurationNode
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
Definition: argos_configuration.h:27
argos::CBoxEntity::GetEmbodiedEntity
CEmbodiedEntity & GetEmbodiedEntity()
Definition: box_entity.h:64
argos::CLEDMedium
Definition: led_medium.h:15
argos::CLEDEquippedEntity
A container of CLEDEntity.
Definition: led_equipped_entity.h:36
argos::CQuaternion
Definition: quaternion.h:14
argos::CBoxEntity::SetMass
void SetMass(Real f_mass)
Definition: box_entity.h:92
argos::CBoxEntity::Reset
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:98
argos::CBoxEntity::GetTypeDescription
virtual std::string GetTypeDescription() const
Returns a string label for this class.
Definition: box_entity.h:96
argos::CBoxEntity::SetSize
void SetSize(const CVector3 &c_size)
Definition: box_entity.h:84
argos::CBoxEntity::AddLED
void AddLED(const CVector3 &c_offset, const CColor &c_color=CColor::BLACK)
Adds an LED to this entity.
Definition: box_entity.cpp:122
argos::CBoxEntity::GetLEDEquippedEntity
CLEDEquippedEntity & GetLEDEquippedEntity()
Definition: box_entity.h:72
argos::CColor
The basic color type.
Definition: color.h:25
argos::CColor::BLACK
static CColor BLACK
Definition: color.h:29
argos::CBoxEntity::DisableLEDs
void DisableLEDs()
Definition: box_entity.cpp:115
argos::CBoxEntity::CBoxEntity
CBoxEntity()
Definition: box_entity.cpp:18
argos::CBoxEntity::ENABLE_VTABLE
ENABLE_VTABLE()
argos::CBoxEntity::GetEmbodiedEntity
const CEmbodiedEntity & GetEmbodiedEntity() const
Definition: box_entity.h:68
argos::CBoxEntity::GetSize
const CVector3 & GetSize() const
Definition: box_entity.h:80
Real
float Real
Collects all ARGoS code.
Definition: datatypes.h:39