epuck_entity.cpp
Go to the documentation of this file.
1 
7 #include "epuck_entity.h"
8 
9 #include <argos3/core/utility/math/matrix/rotationmatrix3.h>
10 #include <argos3/core/simulator/space/space.h>
11 #include <argos3/core/simulator/entity/controllable_entity.h>
12 #include <argos3/core/simulator/entity/embodied_entity.h>
13 #include <argos3/plugins/simulator/entities/rab_equipped_entity.h>
14 #include <argos3/plugins/simulator/entities/ground_sensor_equipped_entity.h>
15 #include <argos3/plugins/simulator/entities/led_equipped_entity.h>
16 #include <argos3/plugins/simulator/entities/light_sensor_equipped_entity.h>
17 #include <argos3/plugins/simulator/entities/proximity_sensor_equipped_entity.h>
18 #include <argos3/plugins/simulator/entities/battery_equipped_entity.h>
19 
20 namespace argos {
21 
22  /****************************************/
23  /****************************************/
24 
25  static const Real BODY_RADIUS = 0.035f;
26  static const Real BODY_HEIGHT = 0.086f;
27 
28  static const Real INTERWHEEL_DISTANCE = 0.053f;
29  static const Real HALF_INTERWHEEL_DISTANCE = INTERWHEEL_DISTANCE * 0.5f;
30  static const Real WHEEL_RADIUS = 0.0205f;
31 
32  static const Real PROXIMITY_SENSOR_RING_ELEVATION = 0.06f;
33  static const Real PROXIMITY_SENSOR_RING_RADIUS = BODY_RADIUS;
34  static const CRadians PROXIMITY_SENSOR_RING_START_ANGLE = CRadians((2 * ARGOS_PI / 8.0f) * 0.5f);
35  static const Real PROXIMITY_SENSOR_RING_RANGE = 0.1f;
36 
37  static const CRadians LED_RING_START_ANGLE = CRadians((ARGOS_PI / 8.0f) * 0.5f);
38  static const Real LED_RING_RADIUS = BODY_RADIUS + 0.007;
39  static const Real LED_RING_ELEVATION = 0.086f;
40  static const Real RAB_ELEVATION = LED_RING_ELEVATION;
41 
42  /****************************************/
43  /****************************************/
44 
46  CComposableEntity(nullptr),
47  m_pcControllableEntity(nullptr),
48  m_pcEmbodiedEntity(nullptr),
49  m_pcGroundSensorEquippedEntity(nullptr),
50  m_pcLEDEquippedEntity(nullptr),
51  m_pcLightSensorEquippedEntity(nullptr),
52  m_pcProximitySensorEquippedEntity(nullptr),
53  m_pcRABEquippedEntity(nullptr),
54  m_pcWheeledEntity(nullptr),
55  m_pcBatteryEquippedEntity(nullptr) {
56  }
57 
58  /****************************************/
59  /****************************************/
60 
61  CEPuckEntity::CEPuckEntity(const std::string& str_id,
62  const std::string& str_controller_id,
63  const CVector3& c_position,
64  const CQuaternion& c_orientation,
65  Real f_rab_range,
66  size_t un_rab_data_size,
67  const std::string& str_bat_model) :
68  CComposableEntity(nullptr, str_id),
69  m_pcControllableEntity(nullptr),
70  m_pcEmbodiedEntity(nullptr),
71  m_pcGroundSensorEquippedEntity(nullptr),
72  m_pcLEDEquippedEntity(nullptr),
73  m_pcLightSensorEquippedEntity(nullptr),
74  m_pcProximitySensorEquippedEntity(nullptr),
75  m_pcRABEquippedEntity(nullptr),
76  m_pcWheeledEntity(nullptr),
77  m_pcBatteryEquippedEntity(nullptr) {
78  try {
79  /*
80  * Create and init components
81  */
82  /* Embodied entity */
83  m_pcEmbodiedEntity = new CEmbodiedEntity(this, "body_0", c_position, c_orientation);
84  AddComponent(*m_pcEmbodiedEntity);
85  /* Wheeled entity and wheel positions (left, right) */
86  m_pcWheeledEntity = new CWheeledEntity(this, "wheels_0", 2);
87  AddComponent(*m_pcWheeledEntity);
88  m_pcWheeledEntity->SetWheel(0, CVector3(0.0f, HALF_INTERWHEEL_DISTANCE, 0.0f), WHEEL_RADIUS);
89  m_pcWheeledEntity->SetWheel(1, CVector3(0.0f, -HALF_INTERWHEEL_DISTANCE, 0.0f), WHEEL_RADIUS);
90  /* LED equipped entity */
91  m_pcLEDEquippedEntity = new CLEDEquippedEntity(this, "leds_0");
92  AddComponent(*m_pcLEDEquippedEntity);
93  m_pcLEDEquippedEntity->AddLEDRing(
94  CVector3(0.0f, 0.0f, LED_RING_ELEVATION),
95  LED_RING_RADIUS,
96  LED_RING_START_ANGLE,
97  8,
98  m_pcEmbodiedEntity->GetOriginAnchor());
99  /* Proximity sensor equipped entity */
100  m_pcProximitySensorEquippedEntity =
102  "proximity_0");
103  AddComponent(*m_pcProximitySensorEquippedEntity);
104 
105 
106  /*m_pcProximitySensorEquippedEntity->AddSensorRing(
107  CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION),
108  PROXIMITY_SENSOR_RING_RADIUS,
109  PROXIMITY_SENSOR_RING_START_ANGLE,
110  PROXIMITY_SENSOR_RING_RANGE,
111  8,
112  m_pcEmbodiedEntity->GetOriginAnchor());*/
113  CRadians sensor_angle[8];
114  sensor_angle[0] = CRadians::PI / 10.5884f;
115  sensor_angle[1] = CRadians::PI / 3.5999f;
116  sensor_angle[2] = CRadians::PI_OVER_TWO; //side sensor
117  sensor_angle[3] = CRadians::PI / 1.2f; // back sensor
118  sensor_angle[4] = CRadians::PI / 0.8571f; // back sensor
119  sensor_angle[5] = CRadians::PI / 0.6667f; //side sensor
120  sensor_angle[6] = CRadians::PI / 0.5806f;
121  sensor_angle[7] = CRadians::PI / 0.5247f;
122 
123  CRadians cAngle;
124  CVector3 cOff, cDir, c_center = CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION);
125  for(UInt32 i = 0; i < 8; ++i)
126  {
127  cAngle = sensor_angle[i];
128  cAngle.SignedNormalize();
129  cOff.Set(PROXIMITY_SENSOR_RING_RADIUS, 0.0f, 0.0f);
130  cOff.RotateZ(cAngle);
131  cOff += c_center;
132  cDir.Set(PROXIMITY_SENSOR_RING_RANGE, 0.0f, 0.0f);
133  cDir.RotateZ(cAngle);
134  m_pcProximitySensorEquippedEntity->AddSensor(cOff, cDir, PROXIMITY_SENSOR_RING_RANGE, m_pcEmbodiedEntity->GetOriginAnchor());
135  }
136 
137 
138  /* Light sensor equipped entity */
139  m_pcLightSensorEquippedEntity =
141  "light_0");
142  AddComponent(*m_pcLightSensorEquippedEntity);
143  m_pcLightSensorEquippedEntity->AddSensorRing(
144  CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION),
145  PROXIMITY_SENSOR_RING_RADIUS,
146  PROXIMITY_SENSOR_RING_START_ANGLE,
147  PROXIMITY_SENSOR_RING_RANGE,
148  8,
149  m_pcEmbodiedEntity->GetOriginAnchor());
150  /* Ground sensor equipped entity */
151  m_pcGroundSensorEquippedEntity =
153  "ground_0");
154  AddComponent(*m_pcGroundSensorEquippedEntity);
155  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.03f, -0.009f),
157  m_pcEmbodiedEntity->GetOriginAnchor());
158  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.03f, 0.0f),
160  m_pcEmbodiedEntity->GetOriginAnchor());
161  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.03f, 0.009f),
163  m_pcEmbodiedEntity->GetOriginAnchor());
164  /* RAB equipped entity */
165  m_pcRABEquippedEntity = new CRABEquippedEntity(this,
166  "rab_0",
167  un_rab_data_size,
168  f_rab_range,
169  m_pcEmbodiedEntity->GetOriginAnchor(),
170  *m_pcEmbodiedEntity,
171  CVector3(0.0f, 0.0f, RAB_ELEVATION));
172  AddComponent(*m_pcRABEquippedEntity);
173  /* Battery equipped entity */
174  m_pcBatteryEquippedEntity = new CBatteryEquippedEntity(this, "battery_0", str_bat_model);
175  AddComponent(*m_pcBatteryEquippedEntity);
176  /* Controllable entity
177  It must be the last one, for actuators/sensors to link to composing entities correctly */
178  m_pcControllableEntity = new CControllableEntity(this, "controller_0");
179  AddComponent(*m_pcControllableEntity);
180  m_pcControllableEntity->SetController(str_controller_id);
181  /* Update components */
183  }
184  catch(CARGoSException& ex) {
185  THROW_ARGOSEXCEPTION_NESTED("Failed to initialize entity \"" << GetId() << "\".", ex);
186  }
187  }
188 
189  /****************************************/
190  /****************************************/
191 
193  try {
194  /*
195  * Init parent
196  */
197  CComposableEntity::Init(t_tree);
198  /*
199  * Create and init components
200  */
201  /* Embodied entity */
202  m_pcEmbodiedEntity = new CEmbodiedEntity(this);
203  AddComponent(*m_pcEmbodiedEntity);
204  m_pcEmbodiedEntity->Init(GetNode(t_tree, "body"));
205  /* Wheeled entity and wheel positions (left, right) */
206  m_pcWheeledEntity = new CWheeledEntity(this, "wheels_0", 2);
207  AddComponent(*m_pcWheeledEntity);
208  m_pcWheeledEntity->SetWheel(0, CVector3(0.0f, HALF_INTERWHEEL_DISTANCE, 0.0f), WHEEL_RADIUS);
209  m_pcWheeledEntity->SetWheel(1, CVector3(0.0f, -HALF_INTERWHEEL_DISTANCE, 0.0f), WHEEL_RADIUS);
210  /* LED equipped entity, with LEDs [0-11] and beacon [12] */
211  m_pcLEDEquippedEntity = new CLEDEquippedEntity(this, "leds_0");
212  AddComponent(*m_pcLEDEquippedEntity);
213  m_pcLEDEquippedEntity->AddLEDRing(
214  CVector3(0.0f, 0.0f, LED_RING_ELEVATION),
215  LED_RING_RADIUS,
216  LED_RING_START_ANGLE,
217  8,
218  m_pcEmbodiedEntity->GetOriginAnchor());
219 
220  /* Proximity sensor equipped entity */
221  m_pcProximitySensorEquippedEntity =
223  "proximity_0");
224  AddComponent(*m_pcProximitySensorEquippedEntity);
225  /*m_pcProximitySensorEquippedEntity->AddSensorRing(
226  CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION),
227  PROXIMITY_SENSOR_RING_RADIUS,
228  PROXIMITY_SENSOR_RING_START_ANGLE,
229  PROXIMITY_SENSOR_RING_RANGE,
230  8,
231  m_pcEmbodiedEntity->GetOriginAnchor());*/
232 
233  CRadians sensor_angle[8];
234  sensor_angle[0] = CRadians::PI / 10.5884f;
235  sensor_angle[1] = CRadians::PI / 3.5999f;
236  sensor_angle[2] = CRadians::PI_OVER_TWO; //side sensor
237  sensor_angle[3] = CRadians::PI / 1.2f; // back sensor
238  sensor_angle[4] = CRadians::PI / 0.8571f; // back sensor
239  sensor_angle[5] = CRadians::PI / 0.6667f; //side sensor
240  sensor_angle[6] = CRadians::PI / 0.5806f;
241  sensor_angle[7] = CRadians::PI / 0.5247f;
242 
243  CRadians cAngle;
244  CVector3 cOff, cDir, c_center = CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION);
245  for(UInt32 i = 0; i < 8; ++i)
246  {
247  cAngle = sensor_angle[i];
248  cAngle.SignedNormalize();
249  cOff.Set(PROXIMITY_SENSOR_RING_RADIUS, 0.0f, 0.0f);
250  cOff.RotateZ(cAngle);
251  cOff += c_center;
252  cDir.Set(PROXIMITY_SENSOR_RING_RANGE, 0.0f, 0.0f);
253  cDir.RotateZ(cAngle);
254  m_pcProximitySensorEquippedEntity->AddSensor(cOff, cDir, PROXIMITY_SENSOR_RING_RANGE, m_pcEmbodiedEntity->GetOriginAnchor());
255  }
256 
257 
258 
259  /* Light sensor equipped entity */
260  m_pcLightSensorEquippedEntity =
262  "light_0");
263  AddComponent(*m_pcLightSensorEquippedEntity);
264  m_pcLightSensorEquippedEntity->AddSensorRing(
265  CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION),
266  PROXIMITY_SENSOR_RING_RADIUS,
267  PROXIMITY_SENSOR_RING_START_ANGLE,
268  PROXIMITY_SENSOR_RING_RANGE,
269  8,
270  m_pcEmbodiedEntity->GetOriginAnchor());
271  /* Ground sensor equipped entity */
272  m_pcGroundSensorEquippedEntity =
274  "ground_0");
275  AddComponent(*m_pcGroundSensorEquippedEntity);
276  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.03f, -0.009f),
278  m_pcEmbodiedEntity->GetOriginAnchor());
279  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.03f, 0.0f),
281  m_pcEmbodiedEntity->GetOriginAnchor());
282  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.03f, 0.009f),
284  m_pcEmbodiedEntity->GetOriginAnchor());
285  /* RAB equipped entity */
286  Real fRange = 0.8f;
287  GetNodeAttributeOrDefault(t_tree, "rab_range", fRange, fRange);
288  UInt32 unDataSize = 2;
289  GetNodeAttributeOrDefault(t_tree, "rab_data_size", unDataSize, unDataSize);
290  m_pcRABEquippedEntity = new CRABEquippedEntity(this,
291  "rab_0",
292  unDataSize,
293  fRange,
294  m_pcEmbodiedEntity->GetOriginAnchor(),
295  *m_pcEmbodiedEntity,
296  CVector3(0.0f, 0.0f, RAB_ELEVATION));
297  AddComponent(*m_pcRABEquippedEntity);
298  /* Battery equipped entity */
299  m_pcBatteryEquippedEntity = new CBatteryEquippedEntity(this, "battery_0");
300  if(NodeExists(t_tree, "battery"))
301  m_pcBatteryEquippedEntity->Init(GetNode(t_tree, "battery"));
302  AddComponent(*m_pcBatteryEquippedEntity);
303  /* Controllable entity
304  It must be the last one, for actuators/sensors to link to composing entities correctly */
305  m_pcControllableEntity = new CControllableEntity(this);
306  AddComponent(*m_pcControllableEntity);
307  m_pcControllableEntity->Init(GetNode(t_tree, "controller"));
308  /* Update components */
310  }
311  catch(CARGoSException& ex) {
312  THROW_ARGOSEXCEPTION_NESTED("Failed to initialize entity \"" << GetId() << "\".", ex);
313  }
314  }
315 
316  /****************************************/
317  /****************************************/
318 
320  /* Reset all components */
322  /* Update components */
324  }
325 
326  /****************************************/
327  /****************************************/
328 
331  }
332 
333  /****************************************/
334  /****************************************/
335 
336 #define UPDATE(COMPONENT) if(COMPONENT->IsEnabled()) COMPONENT->Update();
337 
339  UPDATE(m_pcRABEquippedEntity);
340  UPDATE(m_pcLEDEquippedEntity);
341  UPDATE(m_pcBatteryEquippedEntity);
342  }
343 
344  /****************************************/
345  /****************************************/
346 
348  "e-puck",
349  "Carlo Pinciroli [ilpincy@gmail.com]",
350  "1.0",
351  "The e-puck robot.",
352  "The e-puck is a open-hardware, extensible robot intended for education. In its\n"
353  "simplest form, it is a two-wheeled robot equipped with proximity sensors,\n"
354  "ground sensors, light sensors, a microphone, a frontal camera, and a ring of\n"
355  "red LEDs. More information is available at http://www.epuck.org\n\n"
356  "REQUIRED XML CONFIGURATION\n\n"
357  " <arena ...>\n"
358  " ...\n"
359  " <e-puck id=\"eb0\">\n"
360  " <body position=\"0.4,2.3,0.25\" orientation=\"45,90,0\" />\n"
361  " <controller config=\"mycntrl\" />\n"
362  " </e-puck>\n"
363  " ...\n"
364  " </arena>\n\n"
365  "The 'id' attribute is necessary and must be unique among the entities. If two\n"
366  "entities share the same id, initialization aborts.\n"
367  "The 'body/position' attribute specifies the position of the pucktom point of the\n"
368  "e-puck in the arena. When the robot is untranslated and unrotated, the\n"
369  "pucktom point is in the origin and it is defined as the middle point between\n"
370  "the two wheels on the XY plane and the lowest point of the robot on the Z\n"
371  "axis, that is the point where the wheels touch the floor. The attribute values\n"
372  "are in the X,Y,Z order.\n"
373  "The 'body/orientation' attribute specifies the orientation of the e-puck. All\n"
374  "rotations are performed with respect to the pucktom point. The order of the\n"
375  "angles is Z,Y,X, which means that the first number corresponds to the rotation\n"
376  "around the Z axis, the second around Y and the last around X. This reflects\n"
377  "the internal convention used in ARGoS, in which rotations are performed in\n"
378  "that order. Angles are expressed in degrees. When the robot is unrotated, it\n"
379  "is oriented along the X axis.\n"
380  "The 'controller/config' attribute is used to assign a controller to the\n"
381  "e-puck. The value of the attribute must be set to the id of a previously\n"
382  "defined controller. Controllers are defined in the <controllers> XML subtree.\n\n"
383  "OPTIONAL XML CONFIGURATION\n\n"
384  "You can set the emission range of the range-and-bearing system. By default, a\n"
385  "message sent by an e-puck can be received up to 80cm. By using the 'rab_range'\n"
386  "attribute, you can change it to, i.e., 4m as follows:\n\n"
387  " <arena ...>\n"
388  " ...\n"
389  " <e-puck id=\"eb0\" rab_range=\"4\">\n"
390  " <body position=\"0.4,2.3,0.25\" orientation=\"45,90,0\" />\n"
391  " <controller config=\"mycntrl\" />\n"
392  " </e-puck>\n"
393  " ...\n"
394  " </arena>\n\n"
395  "You can also set the data sent at each time step through the range-and-bearing\n"
396  "system. By default, a message sent by an e-puck is 2 bytes long. By using the\n"
397  "'rab_data_size' attribute, you can change it to, i.e., 20 bytes as follows:\n\n"
398  " <arena ...>\n"
399  " ...\n"
400  " <e-puck id=\"eb0\" rab_data_size=\"20\">\n"
401  " <body position=\"0.4,2.3,0.25\" orientation=\"45,90,0\" />\n"
402  " <controller config=\"mycntrl\" />\n"
403  " </e-puck>\n"
404  " ...\n"
405  " </arena>\n\n"
406  "You can also configure the battery of the robot. By default, the battery never\n"
407  "depletes. You can choose among several battery discharge models, such as\n"
408  "- time: the battery depletes by a fixed amount at each time step\n"
409  "- motion: the battery depletes according to how the robot moves\n"
410  "- time_motion: a combination of the above models.\n"
411  "You can define your own models too. Follow the examples in the file\n"
412  "argos3/src/plugins/simulator/entities/battery_equipped_entity.cpp.\n\n"
413  " <arena ...>\n"
414  " ...\n"
415  " <e-puck id=\"eb0\"\n"
416  " <body position=\"0.4,2.3,0.25\" orientation=\"45,0,0\" />\n"
417  " <controller config=\"mycntrl\" />\n"
418  " <battery model=\"time\" factor=\"1e-5\"/>\n"
419  " </e-puck>\n"
420  " ...\n"
421  " </arena>\n\n"
422  " <arena ...>\n"
423  " ...\n"
424  " <e-puck id=\"eb0\"\n"
425  " <body position=\"0.4,2.3,0.25\" orientation=\"45,0,0\" />\n"
426  " <controller config=\"mycntrl\" />\n"
427  " <battery model=\"motion\" pos_factor=\"1e-3\"\n"
428  " orient_factor=\"1e-3\"/>\n"
429  " </e-puck>\n"
430  " ...\n"
431  " </arena>\n\n"
432  " <arena ...>\n"
433  " ...\n"
434  " <e-puck id=\"eb0\"\n"
435  " <body position=\"0.4,2.3,0.25\" orientation=\"45,0,0\" />\n"
436  " <controller config=\"mycntrl\" />\n"
437  " <battery model=\"time_motion\" time_factor=\"1e-5\"\n"
438  " pos_factor=\"1e-3\"\n"
439  " orient_factor=\"1e-3\"/>\n"
440  " </e-puck>\n"
441  " ...\n"
442  " </arena>\n\n",
443  "Under development"
444  );
445 
446  /****************************************/
447  /****************************************/
448 
450 
451  /****************************************/
452  /****************************************/
453 
454 }
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception.
unsigned int UInt32
32-bit unsigned integer.
Definition: datatypes.h:97
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
#define ARGOS_PI
To be used when initializing static variables.
Definition: angles.h:32
#define UPDATE(COMPONENT)
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
TConfigurationNode & GetNode(TConfigurationNode &t_node, const std::string &str_tag)
Given a tree root node, returns the first of its child nodes with the wanted name.
void GetNodeAttributeOrDefault(TConfigurationNode &t_node, const std::string &str_attribute, T &t_buffer, const T &t_default)
Returns the value of a node's attribute, or the passed default value.
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
bool NodeExists(TConfigurationNode &t_node, const std::string &str_tag)
Given a tree root node, returns true if one of its child nodes has the wanted name.
REGISTER_STANDARD_SPACE_OPERATIONS_ON_COMPOSABLE(CComposableEntity)
REGISTER_ENTITY(CFloorEntity, "floor", "Carlo Pinciroli [ilpincy@gmail.com]", "1.0", "It contains the properties of the arena floor.", "The floor entity contains the properties of the arena floor. In the current\n" "implementation, it contains only the color of the floor. The floor color is\n" "detected by the robots' ground sensors.\n\n" "REQUIRED XML CONFIGURATION\n\n" " <arena ...>\n" " ...\n" " <floor id=\"floor\"\n" " source=\"SOURCE\" />\n" " ...\n" " </arena>\n\n" "The 'id' attribute is necessary and must be unique among the entities. If two\n" "entities share the same id, initialization aborts.\n" "The 'source' attribute specifies where to get the color of the floor from. Its\n" "value, here denoted as SOURCE, can assume the following values:\n\n" " image The color is calculated from the passed image file\n" " loop_functions The color is calculated calling the loop functions\n\n" "When 'source' is set to 'image', as showed in the following example, you have\n" "to specify the image path in the additional attribute 'path':\n\n" " <arena ...>\n" " ...\n" " <floor id=\"floor\"\n" " source=\"image\"\n" " path=\"/path/to/imagefile.ext\" />\n" " ...\n" " </arena>\n\n" "Many image formats are available, such as PNG, JPG, BMP, GIF and many more.\n" "Refer to the FreeImage webpage for a complete list of supported image formats\n" "(http://freeimage.sourceforge.net/features.html).\n\n" "When 'source' is set to 'loop_functions', as showed in the following example,\n" "an image is implicitly created to be used as texture for graphical\n" "visualizations. The algorithm that creates the texture needs to convert from\n" "meters (in the arena) to pixels (of the texture). You control how many pixels\n" "per meter are used with the attribute 'pixels_per_meter'. Clearly, the higher\n" "value, the higher the quality, but also the slower the algorithm and the bigger\n" "the texture. The algorithm is called only once at init time, so the fact that\n" "it is slow is not so important. However, the image size is limited by OpenGL.\n" "Every implementation has its own limit, and you should check yours if any\n" "texture-related problem arises. Now for the example:\n\n" " <arena ...>\n" " ...\n" " <floor id=\"floor\"\n" " source=\"loop_functions\"\n" " pixels_per_meter=\"100\" />\n" " ...\n" " </arena>\n\n" "OPTIONAL XML CONFIGURATION\n\n" "None for the time being.\n", "Usable")
Basic class for an entity that contains other entities.
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
void AddComponent(CEntity &c_component)
Adds a component to this composable entity.
An entity that contains a pointer to the user-defined controller.
void SetController(const std::string &str_controller_id)
Creates and assigns a controller with the given id.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
This entity is a link to a body in the physics engine.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
const SAnchor & GetOriginAnchor() const
Returns a const reference to the origin anchor associated to this entity.
const std::string & GetId() const
Returns the id of this entity.
Definition: entity.h:157
virtual void Destroy()
Destroys the entity, undoing whatever was done by Init() or by the standalone constructor.
Definition: entity.h:151
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
Definition: entity.cpp:40
The exception that wraps all errors in ARGoS.
It defines the basic type CRadians, used to store an angle value in radians.
Definition: angles.h:42
static const CRadians PI
The PI constant.
Definition: angles.h:49
static const CRadians PI_OVER_TWO
Set to PI / 2.
Definition: angles.h:59
CRadians & SignedNormalize()
Normalizes the value in the range [-PI:PI].
Definition: angles.h:137
A 2D vector class.
Definition: vector2.h:27
A 3D vector class.
Definition: vector3.h:31
void Set(const Real f_x, const Real f_y, const Real f_z)
Sets the vector contents from Cartesian coordinates.
Definition: vector3.h:155
CVector3 & RotateZ(const CRadians &c_angle)
Rotates this vector wrt the z axis.
Definition: vector3.h:287
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
virtual void UpdateComponents()
Calls the Update() method on all the components.
virtual void Destroy()
Destroys the entity, undoing whatever was done by Init() or by the standalone constructor.
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
void AddSensor(const CVector2 &c_offset, ESensorType e_type, SAnchor &s_anchor)
A container of CLEDEntity.
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.
void AddSensorRing(const CVector3 &c_center, Real f_radius, const CRadians &c_start_angle, Real f_range, UInt32 un_num_sensors, SAnchor &s_anchor)
void AddSensor(const CVector3 &c_offset, const CVector3 &c_direction, Real f_range, SAnchor &s_anchor)
void SetWheel(UInt32 un_index, const CVector3 &c_position, Real f_radius)