ARGoS  3
A parallel, multi-engine simulator for swarm robotics
footbot_entity.cpp
Go to the documentation of this file.
1 
7 #include "footbot_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/gripper_equipped_entity.h>
15 #include <argos3/plugins/simulator/entities/ground_sensor_equipped_entity.h>
16 #include <argos3/plugins/simulator/entities/led_equipped_entity.h>
17 #include <argos3/plugins/simulator/entities/light_sensor_equipped_entity.h>
18 #include <argos3/plugins/simulator/entities/omnidirectional_camera_equipped_entity.h>
19 #include <argos3/plugins/simulator/entities/perspective_camera_equipped_entity.h>
20 #include <argos3/plugins/simulator/entities/proximity_sensor_equipped_entity.h>
21 #include <argos3/plugins/simulator/entities/wifi_equipped_entity.h>
23 #include "footbot_turret_entity.h"
24 
25 namespace argos {
26 
27  /****************************************/
28  /****************************************/
29 
30  static const Real BODY_RADIUS = 0.085036758f;
31  static const Real BODY_HEIGHT = 0.146899733f;
32 
33  static const Real LED_RING_RADIUS = BODY_RADIUS + 0.005;
34 
35  static const Real INTERWHEEL_DISTANCE = 0.14f;
36  static const Real HALF_INTERWHEEL_DISTANCE = INTERWHEEL_DISTANCE * 0.5f;
37  static const Real WHEEL_RADIUS = 0.029112741f;
38 
39  static const Real PROXIMITY_SENSOR_RING_ELEVATION = 0.06f;
40  static const Real PROXIMITY_SENSOR_RING_RADIUS = BODY_RADIUS;
41  static const CRadians PROXIMITY_SENSOR_RING_START_ANGLE = CRadians((ARGOS_PI / 12.0f) * 0.5f);
42  static const Real PROXIMITY_SENSOR_RING_RANGE = 0.1f;
43 
44  static const Real LED_RING_ELEVATION = 0.085f;
45  static const Real RAB_ELEVATION = 0.1f;
46  static const Real BEACON_ELEVATION = 0.174249733f;
47 
48  static const Real GRIPPER_ELEVATION = LED_RING_ELEVATION;
49 
50  static const CRadians LED_ANGLE_SLICE = CRadians(ARGOS_PI / 6.0);
51  static const CRadians HALF_LED_ANGLE_SLICE = LED_ANGLE_SLICE * 0.5f;
52 
53  static const Real OMNIDIRECTIONAL_CAMERA_ELEVATION = 0.288699733f;
54 
55  /****************************************/
56  /****************************************/
57 
59  CComposableEntity(NULL),
60  m_pcControllableEntity(NULL),
61  m_pcDistanceScannerEquippedEntity(NULL),
62  m_pcTurretEntity(NULL),
63  m_pcEmbodiedEntity(NULL),
64  m_pcGripperEquippedEntity(NULL),
65  m_pcGroundSensorEquippedEntity(NULL),
66  m_pcLEDEquippedEntity(NULL),
67  m_pcLightSensorEquippedEntity(NULL),
68  m_pcOmnidirectionalCameraEquippedEntity(NULL),
69  m_pcPerspectiveCameraEquippedEntity(NULL),
70  m_pcProximitySensorEquippedEntity(NULL),
71  m_pcRABEquippedEntity(NULL),
72  m_pcWheeledEntity(NULL),
73  m_pcWiFiEquippedEntity(NULL) {
74  }
75 
76  /****************************************/
77  /****************************************/
78 
79  CFootBotEntity::CFootBotEntity(const std::string& str_id,
80  const std::string& str_controller_id,
81  const CVector3& c_position,
82  const CQuaternion& c_orientation,
83  Real f_rab_range,
84  size_t un_rab_data_size,
85  const CRadians& c_omnicam_aperture,
86  bool b_perspcam_front,
87  const CRadians& c_perspcam_aperture,
88  Real f_perspcam_focal_length,
89  Real f_perspcam_range) :
90  CComposableEntity(NULL, str_id),
91  m_pcControllableEntity(NULL),
92  m_pcDistanceScannerEquippedEntity(NULL),
93  m_pcTurretEntity(NULL),
94  m_pcEmbodiedEntity(NULL),
95  m_pcGripperEquippedEntity(NULL),
96  m_pcGroundSensorEquippedEntity(NULL),
97  m_pcLEDEquippedEntity(NULL),
98  m_pcLightSensorEquippedEntity(NULL),
99  m_pcOmnidirectionalCameraEquippedEntity(NULL),
100  m_pcPerspectiveCameraEquippedEntity(NULL),
101  m_pcProximitySensorEquippedEntity(NULL),
102  m_pcRABEquippedEntity(NULL),
103  m_pcWheeledEntity(NULL),
104  m_pcWiFiEquippedEntity(NULL) {
105  try {
106  /*
107  * Create and init components
108  */
109  /*
110  * Embodied entity
111  * Better to put this first, because many other entities need this one
112  */
113  m_pcEmbodiedEntity = new CEmbodiedEntity(this, "body_0", c_position, c_orientation);
114  AddComponent(*m_pcEmbodiedEntity);
115  SAnchor& cTurretAnchor = m_pcEmbodiedEntity->AddAnchor("turret");
116  CQuaternion cPerspCamOrient(b_perspcam_front ? CRadians::ZERO : -CRadians::PI_OVER_TWO,
117  CVector3::Y);
118  SAnchor& cPerspCamAnchor = m_pcEmbodiedEntity->AddAnchor("perspective_camera",
119  CVector3(BODY_RADIUS, 0.0, BEACON_ELEVATION),
120  cPerspCamOrient);
121  /* Wheeled entity and wheel positions (left, right) */
122  m_pcWheeledEntity = new CWheeledEntity(this, "wheels_0", 2);
123  AddComponent(*m_pcWheeledEntity);
124  m_pcWheeledEntity->SetWheel(0, CVector3(0.0f, HALF_INTERWHEEL_DISTANCE, 0.0f), WHEEL_RADIUS);
125  m_pcWheeledEntity->SetWheel(1, CVector3(0.0f, -HALF_INTERWHEEL_DISTANCE, 0.0f), WHEEL_RADIUS);
126  /* LED equipped entity, with LEDs [0-11] and beacon [12] */
127  m_pcLEDEquippedEntity = new CLEDEquippedEntity(this, "leds_0");
128  AddComponent(*m_pcLEDEquippedEntity);
129  m_pcLEDEquippedEntity->AddLEDRing(
130  CVector3(0.0f, 0.0f, LED_RING_ELEVATION),
131  LED_RING_RADIUS,
132  HALF_LED_ANGLE_SLICE,
133  12,
134  cTurretAnchor);
135  m_pcLEDEquippedEntity->AddLED(
136  CVector3(0.0f, 0.0f, BEACON_ELEVATION),
137  cTurretAnchor);
138  /* Proximity sensor equipped entity */
139  m_pcProximitySensorEquippedEntity =
140  new CProximitySensorEquippedEntity(this, "proximity_0");
141  AddComponent(*m_pcProximitySensorEquippedEntity);
142  m_pcProximitySensorEquippedEntity->AddSensorRing(
143  CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION),
144  PROXIMITY_SENSOR_RING_RADIUS,
145  PROXIMITY_SENSOR_RING_START_ANGLE,
146  PROXIMITY_SENSOR_RING_RANGE,
147  24,
148  m_pcEmbodiedEntity->GetOriginAnchor());
149  /* Light sensor equipped entity */
150  m_pcLightSensorEquippedEntity =
151  new CLightSensorEquippedEntity(this, "light_0");
152  AddComponent(*m_pcLightSensorEquippedEntity);
153  m_pcLightSensorEquippedEntity->AddSensorRing(
154  CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION),
155  PROXIMITY_SENSOR_RING_RADIUS,
156  PROXIMITY_SENSOR_RING_START_ANGLE,
157  PROXIMITY_SENSOR_RING_RANGE,
158  24,
159  m_pcEmbodiedEntity->GetOriginAnchor());
160  /* Gripper equipped entity */
161  m_pcGripperEquippedEntity =
162  new CGripperEquippedEntity(this,
163  "gripper_0",
164  CVector3(BODY_RADIUS, 0.0f, GRIPPER_ELEVATION),
165  CVector3::X);
166  AddComponent(*m_pcGripperEquippedEntity);
167  /* Ground sensor equipped entity */
168  m_pcGroundSensorEquippedEntity =
169  new CGroundSensorEquippedEntity(this, "ground_0");
170  AddComponent(*m_pcGroundSensorEquippedEntity);
171  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.063, 0.0116),
173  m_pcEmbodiedEntity->GetOriginAnchor());
174  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.063, 0.0116),
176  m_pcEmbodiedEntity->GetOriginAnchor());
177  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.063, -0.0116),
179  m_pcEmbodiedEntity->GetOriginAnchor());
180  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.063, -0.0116),
182  m_pcEmbodiedEntity->GetOriginAnchor());
183  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.08, 0.0),
185  m_pcEmbodiedEntity->GetOriginAnchor());
186  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.042, 0.065),
188  m_pcEmbodiedEntity->GetOriginAnchor());
189  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.0, 0.08),
191  m_pcEmbodiedEntity->GetOriginAnchor());
192  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.042, 0.065),
194  m_pcEmbodiedEntity->GetOriginAnchor());
195  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.08, 0.0),
197  m_pcEmbodiedEntity->GetOriginAnchor());
198  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.042, -0.065),
200  m_pcEmbodiedEntity->GetOriginAnchor());
201  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.0, -0.08),
203  m_pcEmbodiedEntity->GetOriginAnchor());
204  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.042, -0.065),
206  m_pcEmbodiedEntity->GetOriginAnchor());
207  /* Distance scanner */
208  m_pcDistanceScannerEquippedEntity =
209  new CFootBotDistanceScannerEquippedEntity(this, "distance_scanner_0");
210  AddComponent(*m_pcDistanceScannerEquippedEntity);
211  /* RAB equipped entity */
212  m_pcRABEquippedEntity =
213  new CRABEquippedEntity(this,
214  "rab_0",
215  un_rab_data_size,
216  f_rab_range,
217  m_pcEmbodiedEntity->GetOriginAnchor(),
218  *m_pcEmbodiedEntity,
219  CVector3(0.0f, 0.0f, RAB_ELEVATION));
220  AddComponent(*m_pcRABEquippedEntity);
221  /* Omnidirectional camera equipped entity */
222  m_pcOmnidirectionalCameraEquippedEntity =
224  "omnidirectional_camera_0",
225  c_omnicam_aperture,
226  CVector3(0.0f,
227  0.0f,
228  OMNIDIRECTIONAL_CAMERA_ELEVATION));
229  AddComponent(*m_pcOmnidirectionalCameraEquippedEntity);
230  /* Perspective camera equipped entity */
231  m_pcPerspectiveCameraEquippedEntity =
233  "perspective_camera_0",
234  c_perspcam_aperture,
235  f_perspcam_focal_length,
236  f_perspcam_range,
237  640, 480,
238  cPerspCamAnchor);
239  AddComponent(*m_pcPerspectiveCameraEquippedEntity);
240  /* Turret equipped entity */
241  m_pcTurretEntity = new CFootBotTurretEntity(this, "turret_0", cTurretAnchor);
242  AddComponent(*m_pcTurretEntity);
243  /* WiFi equipped entity */
244  m_pcWiFiEquippedEntity = new CWiFiEquippedEntity(this, "wifi_0");
245  AddComponent(*m_pcWiFiEquippedEntity);
246  /* Controllable entity
247  It must be the last one, for actuators/sensors to link to composing entities correctly */
248  m_pcControllableEntity = new CControllableEntity(this, "controller_0");
249  AddComponent(*m_pcControllableEntity);
250  m_pcControllableEntity->SetController(str_controller_id);
251  /* Update components */
253  }
254  catch(CARGoSException& ex) {
255  THROW_ARGOSEXCEPTION_NESTED("Failed to initialize entity \"" << GetId() << "\".", ex);
256  }
257  }
258 
259  /****************************************/
260  /****************************************/
261 
263  try {
264  /*
265  * Init parent
266  */
267  CComposableEntity::Init(t_tree);
268  /*
269  * Create and init components
270  */
271  /*
272  * Embodied entity
273  * Better to put this first, because many other entities need this one
274  */
275  m_pcEmbodiedEntity = new CEmbodiedEntity(this);
276  AddComponent(*m_pcEmbodiedEntity);
277  m_pcEmbodiedEntity->Init(GetNode(t_tree, "body"));
278  SAnchor& cTurretAnchor = m_pcEmbodiedEntity->AddAnchor("turret");
279  /* Wheeled entity and wheel positions (left, right) */
280  m_pcWheeledEntity = new CWheeledEntity(this, "wheels_0", 2);
281  AddComponent(*m_pcWheeledEntity);
282  m_pcWheeledEntity->SetWheel(0, CVector3(0.0f, HALF_INTERWHEEL_DISTANCE, 0.0f), WHEEL_RADIUS);
283  m_pcWheeledEntity->SetWheel(1, CVector3(0.0f, -HALF_INTERWHEEL_DISTANCE, 0.0f), WHEEL_RADIUS);
284  /* LED equipped entity, with LEDs [0-11] and beacon [12] */
285  m_pcLEDEquippedEntity = new CLEDEquippedEntity(this, "leds_0");
286  AddComponent(*m_pcLEDEquippedEntity);
287  m_pcLEDEquippedEntity->AddLEDRing(
288  CVector3(0.0f, 0.0f, LED_RING_ELEVATION),
289  LED_RING_RADIUS,
290  HALF_LED_ANGLE_SLICE,
291  12,
292  cTurretAnchor);
293  m_pcLEDEquippedEntity->AddLED(
294  CVector3(0.0f, 0.0f, BEACON_ELEVATION),
295  cTurretAnchor);
296  /* Proximity sensor equipped entity */
297  m_pcProximitySensorEquippedEntity =
298  new CProximitySensorEquippedEntity(this, "proximity_0");
299  AddComponent(*m_pcProximitySensorEquippedEntity);
300  m_pcProximitySensorEquippedEntity->AddSensorRing(
301  CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION),
302  PROXIMITY_SENSOR_RING_RADIUS,
303  PROXIMITY_SENSOR_RING_START_ANGLE,
304  PROXIMITY_SENSOR_RING_RANGE,
305  24,
306  m_pcEmbodiedEntity->GetOriginAnchor());
307  /* Light sensor equipped entity */
308  m_pcLightSensorEquippedEntity =
309  new CLightSensorEquippedEntity(this, "light_0");
310  AddComponent(*m_pcLightSensorEquippedEntity);
311  m_pcLightSensorEquippedEntity->AddSensorRing(
312  CVector3(0.0f, 0.0f, PROXIMITY_SENSOR_RING_ELEVATION),
313  PROXIMITY_SENSOR_RING_RADIUS,
314  PROXIMITY_SENSOR_RING_START_ANGLE,
315  PROXIMITY_SENSOR_RING_RANGE,
316  24,
317  m_pcEmbodiedEntity->GetOriginAnchor());
318  /* Gripper equipped entity */
319  m_pcGripperEquippedEntity =
320  new CGripperEquippedEntity(this,
321  "gripper_0",
322  CVector3(BODY_RADIUS, 0.0f, GRIPPER_ELEVATION),
323  CVector3::X);
324  AddComponent(*m_pcGripperEquippedEntity);
325  /* Ground sensor equipped entity */
326  m_pcGroundSensorEquippedEntity =
327  new CGroundSensorEquippedEntity(this, "ground_0");
328  AddComponent(*m_pcGroundSensorEquippedEntity);
329  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.063, 0.0116),
331  m_pcEmbodiedEntity->GetOriginAnchor());
332  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.063, 0.0116),
334  m_pcEmbodiedEntity->GetOriginAnchor());
335  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.063, -0.0116),
337  m_pcEmbodiedEntity->GetOriginAnchor());
338  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.063, -0.0116),
340  m_pcEmbodiedEntity->GetOriginAnchor());
341  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.08, 0.0),
343  m_pcEmbodiedEntity->GetOriginAnchor());
344  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.042, 0.065),
346  m_pcEmbodiedEntity->GetOriginAnchor());
347  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.0, 0.08),
349  m_pcEmbodiedEntity->GetOriginAnchor());
350  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.042, 0.065),
352  m_pcEmbodiedEntity->GetOriginAnchor());
353  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.08, 0.0),
355  m_pcEmbodiedEntity->GetOriginAnchor());
356  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(-0.042, -0.065),
358  m_pcEmbodiedEntity->GetOriginAnchor());
359  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.0, -0.08),
361  m_pcEmbodiedEntity->GetOriginAnchor());
362  m_pcGroundSensorEquippedEntity->AddSensor(CVector2(0.042, -0.065),
364  m_pcEmbodiedEntity->GetOriginAnchor());
365  /* Distance scanner */
366  m_pcDistanceScannerEquippedEntity =
367  new CFootBotDistanceScannerEquippedEntity(this, "distance_scanner_0");
368  AddComponent(*m_pcDistanceScannerEquippedEntity);
369  /* RAB equipped entity */
370  Real fRange = 3.0f;
371  GetNodeAttributeOrDefault(t_tree, "rab_range", fRange, fRange);
372  UInt32 unDataSize = 10;
373  GetNodeAttributeOrDefault(t_tree, "rab_data_size", unDataSize, unDataSize);
374  m_pcRABEquippedEntity =
375  new CRABEquippedEntity(this,
376  "rab_0",
377  unDataSize,
378  fRange,
379  m_pcEmbodiedEntity->GetOriginAnchor(),
380  *m_pcEmbodiedEntity,
381  CVector3(0.0f, 0.0f, RAB_ELEVATION));
382  AddComponent(*m_pcRABEquippedEntity);
383  /* Omnidirectional camera equipped entity */
384  CDegrees cAperture(70.0f);
385  GetNodeAttributeOrDefault(t_tree, "omnidirectional_camera_aperture", cAperture, cAperture);
386  m_pcOmnidirectionalCameraEquippedEntity =
388  "omnidirectional_camera_0",
389  ToRadians(cAperture),
390  CVector3(0.0f,
391  0.0f,
392  OMNIDIRECTIONAL_CAMERA_ELEVATION));
393  AddComponent(*m_pcOmnidirectionalCameraEquippedEntity);
394  /* Perspective camera equipped entity */
395  bool bPerspCamFront = true;
396  GetNodeAttributeOrDefault(t_tree, "perspective_camera_front", bPerspCamFront, bPerspCamFront);
397  Real fPerspCamFocalLength = 0.035;
398  GetNodeAttributeOrDefault(t_tree, "perspective_camera_focal_length", fPerspCamFocalLength, fPerspCamFocalLength);
399  Real fPerspCamRange = 2.0;
400  GetNodeAttributeOrDefault(t_tree, "perspective_camera_range", fPerspCamRange, fPerspCamRange);
401  cAperture.SetValue(30.0f);
402  GetNodeAttributeOrDefault(t_tree, "perspective_camera_aperture", cAperture, cAperture);
403  CQuaternion cPerspCamOrient(bPerspCamFront ? CRadians::ZERO : -CRadians::PI_OVER_TWO,
404  CVector3::Y);
405  SAnchor& cPerspCamAnchor = m_pcEmbodiedEntity->AddAnchor("perspective_camera",
406  CVector3(BODY_RADIUS, 0.0, BEACON_ELEVATION),
407  cPerspCamOrient);
408  m_pcPerspectiveCameraEquippedEntity =
410  "perspective_camera_0",
411  ToRadians(cAperture),
412  fPerspCamFocalLength,
413  fPerspCamRange,
414  640, 480,
415  cPerspCamAnchor);
416  AddComponent(*m_pcPerspectiveCameraEquippedEntity);
417  /* Turret equipped entity */
418  m_pcTurretEntity = new CFootBotTurretEntity(this, "turret_0", cTurretAnchor);
419  AddComponent(*m_pcTurretEntity);
420  /* WiFi equipped entity */
421  m_pcWiFiEquippedEntity = new CWiFiEquippedEntity(this, "wifi_0");
422  AddComponent(*m_pcWiFiEquippedEntity);
423  /* Controllable entity
424  It must be the last one, for actuators/sensors to link to composing entities correctly */
425  m_pcControllableEntity = new CControllableEntity(this);
426  AddComponent(*m_pcControllableEntity);
427  m_pcControllableEntity->Init(GetNode(t_tree, "controller"));
428  /* Update components */
430  }
431  catch(CARGoSException& ex) {
432  THROW_ARGOSEXCEPTION_NESTED("Failed to initialize entity \"" << GetId() << "\".", ex);
433  }
434  }
435 
436  /****************************************/
437  /****************************************/
438 
440  /* Reset all components */
442  /* Update components */
444  }
445 
446  /****************************************/
447  /****************************************/
448 
449 #define UPDATE(COMPONENT) if(COMPONENT->IsEnabled()) COMPONENT->Update();
450 
452  /* Update only the components that might change */
453  UPDATE(m_pcDistanceScannerEquippedEntity);
454  UPDATE(m_pcTurretEntity);
455  UPDATE(m_pcGripperEquippedEntity);
456  UPDATE(m_pcRABEquippedEntity);
457  UPDATE(m_pcLEDEquippedEntity);
458  }
459 
460  /****************************************/
461  /****************************************/
462 
464  "foot-bot",
465  "Carlo Pinciroli [ilpincy@gmail.com]",
466  "1.0",
467  "The foot-bot robot, developed in the Swarmanoid project.",
468  "The foot-bot is a wheeled robot developed in the Swarmanoid Project. It is a\n"
469  "modular robot with a rich set of sensors and actuators. For more information,\n"
470  "refer to the dedicated web page\n"
471  "(http://www.swarmanoid.org/swarmanoid_hardware.php).\n\n"
472  "REQUIRED XML CONFIGURATION\n\n"
473  " <arena ...>\n"
474  " ...\n"
475  " <foot-bot id=\"fb0\">\n"
476  " <body position=\"0.4,2.3,0.25\" orientation=\"45,0,0\" />\n"
477  " <controller config=\"mycntrl\" />\n"
478  " </foot-bot>\n"
479  " ...\n"
480  " </arena>\n\n"
481  "The 'id' attribute is necessary and must be unique among the entities. If two\n"
482  "entities share the same id, initialization aborts.\n"
483  "The 'body/position' attribute specifies the position of the bottom point of the\n"
484  "foot-bot in the arena. When the robot is untranslated and unrotated, the\n"
485  "bottom point is in the origin and it is defined as the middle point between\n"
486  "the two wheels on the XY plane and the lowest point of the robot on the Z\n"
487  "axis, that is the point where the wheels touch the floor. The attribute values\n"
488  "are in the X,Y,Z order.\n"
489  "The 'body/orientation' attribute specifies the orientation of the foot-bot. All\n"
490  "rotations are performed with respect to the bottom point. The order of the\n"
491  "angles is Z,Y,X, which means that the first number corresponds to the rotation\n"
492  "around the Z axis, the second around Y and the last around X. This reflects\n"
493  "the internal convention used in ARGoS, in which rotations are performed in\n"
494  "that order. Angles are expressed in degrees. When the robot is unrotated, it\n"
495  "is oriented along the X axis.\n"
496  "The 'controller/config' attribute is used to assign a controller to the\n"
497  "foot-bot. The value of the attribute must be set to the id of a previously\n"
498  "defined controller. Controllers are defined in the <controllers> XML subtree.\n\n"
499  "OPTIONAL XML CONFIGURATION\n\n"
500  "You can set the emission range of the range-and-bearing system. By default, a\n"
501  "message sent by a foot-bot can be received up to 3m. By using the 'rab_range'\n"
502  "attribute, you can change it to, i.e., 4m as follows:\n\n"
503  " <arena ...>\n"
504  " ...\n"
505  " <foot-bot id=\"fb0\" rab_range=\"4\">\n"
506  " <body position=\"0.4,2.3,0.25\" orientation=\"45,0,0\" />\n"
507  " <controller config=\"mycntrl\" />\n"
508  " </foot-bot>\n"
509  " ...\n"
510  " </arena>\n\n"
511  "You can also set the data sent at each time step through the range-and-bearing"
512  "system. By default, a message sent by a foot-bot is 10 bytes long. By using the"
513  "'rab_data_size' attribute, you can change it to, i.e., 20 bytes as follows:\n\n"
514  " <arena ...>\n"
515  " ...\n"
516  " <foot-bot id=\"fb0\" rab_data_size=\"20\">\n"
517  " <body position=\"0.4,2.3,0.25\" orientation=\"45,0,0\" />\n"
518  " <controller config=\"mycntrl\" />\n"
519  " </foot-bot>\n"
520  " ...\n"
521  " </arena>\n\n"
522  "You can also change the aperture of the omnidirectional camera. The aperture is\n"
523  "set to 70 degrees by default. The tip of the omnidirectional camera is placed on\n"
524  "top of the robot (h=0.289), and with an aperture of 70 degrees the range on the\n"
525  "ground is r=h*tan(aperture)=0.289*tan(70)=0.794m. To change the aperture to 80\n"
526  "degrees, use the 'omnidirectional_camera_aperture' as follows:\n\n"
527  " <arena ...>\n"
528  " ...\n"
529  " <foot-bot id=\"fb0\" omnidirectional_camera_aperture=\"80\">\n"
530  " <body position=\"0.4,2.3,0.25\" orientation=\"45,0,0\" />\n"
531  " <controller config=\"mycntrl\" />\n"
532  " </foot-bot>\n"
533  " ...\n"
534  " </arena>\n\n"
535  "Finally, you can change the parameters of the perspective camera. You can set\n"
536  "its direction, aperture, focal length, and range with the attributes\n"
537  "'perspective_camera_front', 'perspective_camera_aperture',\n"
538  "'perspective_camera_focal_length', and 'perspective_camera_range', respectively.\n"
539  "The default values are: 'true' for front direction, 30 degrees for aperture,\n"
540  "0.035 for focal length, and 2 meters for range. When the direction is set to\n"
541  "'false', the camera looks up. This can be useful to see the eye-bot LEDs. Check\n"
542  "the following example:\n\n"
543  " <arena ...>\n"
544  " ...\n"
545  " <foot-bot id=\"fb0\"\n"
546  " perspective_camera_front=\"false\"\n"
547  " perspective_camera_aperture=\"45\"\n"
548  " perspective_camera_focal_length=\"0.07\"\n"
549  " perspective_camera_range=\"10\">\n"
550  " <body position=\"0.4,2.3,0.25\" orientation=\"45,0,0\" />\n"
551  " <controller config=\"mycntrl\" />\n"
552  " </foot-bot>\n"
553  " ...\n"
554  " </arena>\n\n"
555  ,
556  "Under development"
557  );
558 
559  /****************************************/
560  /****************************************/
561 
563 
564  /****************************************/
565  /****************************************/
566 
567 }
ARGOS_PI
#define ARGOS_PI
To be used when initializing static variables.
Definition: angles.h:32
argos::CEmbodiedEntity::GetOriginAnchor
const SAnchor & GetOriginAnchor() const
Returns a const reference to the origin anchor associated to this entity.
Definition: embodied_entity.h:119
argos::CFootBotEntity::UpdateComponents
virtual void UpdateComponents()
Calls the Update() method on all the components.
Definition: footbot_entity.cpp:451
argos::CLEDEquippedEntity::AddLEDRing
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.
Definition: led_equipped_entity.cpp:144
argos::CGroundSensorEquippedEntity::TYPE_GRAYSCALE
@ TYPE_GRAYSCALE
Definition: ground_sensor_equipped_entity.h:29
footbot_turret_entity.h
argos::CEntity::GetId
const std::string & GetId() const
Returns the id of this entity.
Definition: entity.h:157
argos
The namespace containing all the ARGoS related code.
Definition: ci_actuator.h:12
argos::CVector3
A 3D vector class.
Definition: vector3.h:29
argos::CVector3::X
static const CVector3 X
The x axis.
Definition: vector3.h:34
argos::CPerspectiveCameraEquippedEntity
Definition: perspective_camera_equipped_entity.h:23
argos::CRadians
It defines the basic type CRadians, used to store an angle value in radians.
Definition: angles.h:42
argos::CComposableEntity
Basic class for an entity that contains other entities.
Definition: composable_entity.h:32
argos::GetNode
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.
Definition: argos_configuration.h:63
argos::CLightSensorEquippedEntity
Definition: light_sensor_equipped_entity.h:21
argos::CARGoSException
The exception that wraps all errors in ARGoS.
Definition: argos_exception.h:61
argos::CRadians::PI_OVER_TWO
static const CRadians PI_OVER_TWO
Set to PI / 2.
Definition: angles.h:59
argos::CGroundSensorEquippedEntity::TYPE_BLACK_WHITE
@ TYPE_BLACK_WHITE
Definition: ground_sensor_equipped_entity.h:28
argos::CWheeledEntity
Definition: wheeled_entity.h:15
argos::CComposableEntity::Reset
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
Definition: composable_entity.cpp:29
argos::CEmbodiedEntity
This entity is a link to a body in the physics engine.
Definition: embodied_entity.h:48
argos::COmnidirectionalCameraEquippedEntity
Definition: omnidirectional_camera_equipped_entity.h:21
argos::CGroundSensorEquippedEntity::AddSensor
void AddSensor(const CVector2 &c_offset, ESensorType e_type, SAnchor &s_anchor)
Definition: ground_sensor_equipped_entity.cpp:130
argos::TConfigurationNode
ticpp::Element TConfigurationNode
The ARGoS configuration XML node.
Definition: argos_configuration.h:27
argos::CRABEquippedEntity
Definition: rab_equipped_entity.h:25
argos::CGripperEquippedEntity
An entity that stores the state of a robot gripper.
Definition: gripper_equipped_entity.h:37
argos::CFootBotEntity
Definition: footbot_entity.h:32
argos::CComposableEntity::AddComponent
void AddComponent(CEntity &c_component)
Adds a component to this composable entity.
Definition: composable_entity.cpp:72
argos::CFootBotEntity::CFootBotEntity
CFootBotEntity()
Definition: footbot_entity.cpp:58
argos::CLEDEquippedEntity
A container of CLEDEntity.
Definition: led_equipped_entity.h:36
argos::CControllableEntity::Init
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
Definition: controllable_entity.cpp:44
argos::CVector3::Y
static const CVector3 Y
The y axis.
Definition: vector3.h:37
argos::CQuaternion
Definition: quaternion.h:14
THROW_ARGOSEXCEPTION_NESTED
#define THROW_ARGOSEXCEPTION_NESTED(message, nested)
This macro throws an ARGoS exception with the passed message and nesting the passed exception.
Definition: argos_exception.h:115
footbot_distance_scanner_equipped_entity.h
argos::REGISTER_STANDARD_SPACE_OPERATIONS_ON_COMPOSABLE
REGISTER_STANDARD_SPACE_OPERATIONS_ON_COMPOSABLE(CComposableEntity)
argos::CDegrees::SetValue
void SetValue(Real f_value)
Sets the value in degrees.
Definition: angles.h:338
argos::SAnchor
An anchor related to the body of an entity.
Definition: physics_model.h:38
argos::CFootBotDistanceScannerEquippedEntity
Definition: footbot_distance_scanner_equipped_entity.h:19
argos::CProximitySensorEquippedEntity::AddSensorRing
void AddSensorRing(const CVector3 &c_center, Real f_radius, const CRadians &c_start_angle, Real f_range, UInt32 un_num_sensors, SAnchor &s_anchor)
Definition: proximity_sensor_equipped_entity.cpp:154
argos::CVector2
A 2D vector class.
Definition: vector2.h:25
argos::CControllableEntity::SetController
void SetController(const std::string &str_controller_id)
Creates and assigns a controller with the given id.
Definition: controllable_entity.cpp:139
argos::CWheeledEntity::SetWheel
void SetWheel(UInt32 un_index, const CVector3 &c_position, Real f_radius)
Definition: wheeled_entity.cpp:64
UPDATE
#define UPDATE(COMPONENT)
Definition: footbot_entity.cpp:449
argos::CFootBotEntity::Init
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
Definition: footbot_entity.cpp:262
argos::CWiFiEquippedEntity
Definition: wifi_equipped_entity.h:15
argos::CFootBotTurretEntity
Definition: footbot_turret_entity.h:20
argos::CProximitySensorEquippedEntity
Definition: proximity_sensor_equipped_entity.h:21
argos::CFootBotEntity::Reset
virtual void Reset()
Resets the state of the entity to whatever it was after Init() or the standalone constructor was call...
Definition: footbot_entity.cpp:439
argos::REGISTER_ENTITY
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")
argos::CLightSensorEquippedEntity::AddSensorRing
void AddSensorRing(const CVector3 &c_center, Real f_radius, const CRadians &c_start_angle, Real f_range, UInt32 un_num_sensors, SAnchor &s_anchor)
Definition: light_sensor_equipped_entity.cpp:154
UInt32
unsigned int UInt32
32-bit unsigned integer.
Definition: datatypes.h:97
argos::GetNodeAttributeOrDefault
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.
Definition: argos_configuration.h:318
argos::CGroundSensorEquippedEntity
Definition: ground_sensor_equipped_entity.h:21
argos::CEmbodiedEntity::Init
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
Definition: embodied_entity.cpp:68
argos::CEmbodiedEntity::AddAnchor
SAnchor & AddAnchor(const std::string &str_id, const CVector3 &c_rel_position=CVector3(), const CQuaternion &c_rel_orientation=CQuaternion())
Adds an anchor to the embodied entity.
Definition: embodied_entity.cpp:121
footbot_entity.h
argos::CDegrees
It defines the basic type CDegrees, used to store an angle value in degrees.
Definition: angles.h:288
argos::CControllableEntity
An entity that contains a pointer to the user-defined controller.
Definition: controllable_entity.h:26
argos::ToRadians
CRadians ToRadians(const CDegrees &c_degrees)
Converts CDegrees to CRadians.
Definition: angles.h:498
Real
float Real
Collects all ARGoS code.
Definition: datatypes.h:39
argos::CEntity::Init
virtual void Init(TConfigurationNode &t_tree)
Initializes the state of the entity from the XML configuration tree.
Definition: entity.cpp:36
argos::CLEDEquippedEntity::AddLED
void AddLED(const CVector3 &c_offset, SAnchor &s_anchor, const CColor &c_color=CColor::BLACK)
Adds an LED to this entity.
Definition: led_equipped_entity.cpp:128
argos::CRadians::ZERO
static const CRadians ZERO
Set to zero radians.
Definition: angles.h:79