robots.cpp
1 /********************************************************************************
2  * FARSA Experiments Library *
3  * Copyright (C) 2007-2012 *
4  * Tomassino Ferrauto <tomassino.ferrauto@istc.cnr.it> *
5  * Stefano Nolfi <stefano.nolfi@istc.cnr.it> *
6  * Onofrio Gigliotta <onofrio.gigliotta@istc.cnr.it> *
7  * Gianluca Massera <emmegian@yahoo.it> *
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  * This program is distributed in the hope that it will be useful, *
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
17  * GNU General Public License for more details. *
18  * *
19  * You should have received a copy of the GNU General Public License *
20  * along with this program; if not, write to the Free Software *
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
22  ********************************************************************************/
23 
24 #include "robots.h"
25 #include "configurationhelper.h"
26 #include "logger.h"
27 #include "mathutils.h"
28 #include <QStringList>
29 #include <QRegExp>
30 
31 namespace farsa {
32 
33 namespace robotConfigurationUtilities {
35  {
37 
38  if (r == NULL) {
39  ConfigurationHelper::throwUserMissingResourceError("world", "We need a world to create the iCub robot!");
40  }
41 
42  return r->getResource<World>("world");
43  }
44 
45  QString extractRobotName(ConfigurationParameters& params, QString prefix, QString defaultName)
46  {
47  return ConfigurationHelper::getString(params, prefix + "name", defaultName);
48  }
49 
51  {
52  QString value = ConfigurationHelper::getString(params, prefix + "transformation", QString());
53 
54  if (value.isEmpty()) {
55  return wMatrix::identity();
56  }
57 
58  // The values on the same row are separated by spaces, rows are separated by semicolons
59  QStringList rows = value.split(";");
60  if (rows.size() != 4) {
61  ConfigurationHelper::throwUserConfigError(prefix + "transformation", value, "The transformation matrix must have 4 rows. The format is: a11 a12 a13 a14; a21 a22 a23 a24; a31 a32 a33 a34; a41 a42 a43 a44");
62  }
63 
64  wMatrix mtr;
65  for (int i = 0; i < rows.size(); i++) {
66  QStringList elements = rows[i].split(QRegExp("\\s+"));
67  if (elements.size() != 4) {
68  ConfigurationHelper::throwUserConfigError(prefix + "transformation", value, "The transformation matrix must have 4 columns. The format is: a11 a12 a13 a14; a21 a22 a23 a24; a31 a32 a33 a34; a41 a42 a43 a44");
69  }
70  for (int j = 0; j < elements.size(); j++) {
71  bool ok;
72  mtr[i][j] = elements[j].toDouble(&ok);
73  if (!ok) {
74  ConfigurationHelper::throwUserConfigError(prefix + "transformation", value, "The transformation matrix elements must be numbers");
75  }
76  }
77  }
78 
79  return mtr;
80  }
81 }
82 
83 using namespace robotConfigurationUtilities;
84 
86  Robot(params, prefix),
87  m_color(ConfigurationHelper::getString(params, prefix + "color", "+FFFFFF").replace("+", "#")) // We have to do this because # is for comments in .ini files
88 {
89  if (!m_color.isValid()) {
90  ConfigurationHelper::throwUserConfigError(prefix + "color", params.getValue(prefix + "color"), "The value of the \"color\" parameter is not a valid color");
91  }
92 }
93 
94 void RobotOnPlane::save(ConfigurationParameters& /*params*/, QString /*prefix*/)
95 {
96  Logger::error("NOT IMPLEMENTED (RobotOnPlane::save)");
97  abort();
98 }
99 
100 void RobotOnPlane::describe(QString type)
101 {
102  Robot::describe(type);
103 
104  Descriptor d = addTypeDescription(type, "The base class for robots that lie on a plane", "The base class for robots that lie on a plane");
105  d.describeString("color").def("+FFFFFF").help("The color of the robot.", "This is a string. Its format can be: +RGB, +RRGGBB, +RRRGGGBBB, +RRRRGGGGBBBB (each of R, G, and B is a single hex digit) or a name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium (see http://www.w3.org/TR/SVG/types.html#ColorKeywords). The default value is \"+FFFFFF\"");
106 }
107 
109 {
110  // Nothing to do here
111 }
112 
113 void RobotOnPlane::setPosition(const Box2DWrapper* plane, const wVector& pos)
114 {
115  setPosition(plane, pos.x, pos.y);
116 }
117 
118 MarXbot::MarXbot(ConfigurationParameters& params, QString prefix) :
119  RobotOnPlane(params, prefix),
120  PhyMarXbot(extractWorld(params), extractRobotName(params, prefix, "marXbot"), extractRobotTranformation(params, prefix))
121 {
122  doKinematicSimulation(ConfigurationHelper::getBool(params, prefix + "kinematicRobot", false));
123 
124  const bool enableWheels = ConfigurationHelper::getBool(params, prefix + "enableWheels", true);
125  const bool enableProximityIR = ConfigurationHelper::getBool(params, prefix + "enableProximityIR", false);
126  const bool enableGroundBottomIR = ConfigurationHelper::getBool(params, prefix + "enableGroundBottomIR", false);
127  const bool enableGroundAroundIR = ConfigurationHelper::getBool(params, prefix + "enableGroundAroundIR", false);
128  const bool enableAttachDev = ConfigurationHelper::getBool(params, prefix + "enableAttachmentDevice", false);
129  const bool drawProximityIR = ConfigurationHelper::getBool(params, prefix + "drawProximityIR", false);
130  const bool drawGroundBottomIR = ConfigurationHelper::getBool(params, prefix + "drawGroundBottomIR", false);
131  const bool drawGroundAroundIR = ConfigurationHelper::getBool(params, prefix + "drawGroundAroundIR", false);
132  const bool drawIRRays =ConfigurationHelper::getBool(params, prefix + "drawIRRays", false);
133  const bool drawIRRaysRange = ConfigurationHelper::getBool(params, prefix + "drawIRRaysRange", false);
134 
135  wheelsController()->setEnabled(enableWheels);
136  proximityIRSensorController()->setEnabled(enableProximityIR);
137  setProximityIRSensorsGraphicalProperties(drawProximityIR, drawIRRays, drawIRRaysRange);
138  groundBottomIRSensorController()->setEnabled(enableGroundBottomIR);
139  setGroundBottomIRSensorsGraphicalProperties(drawGroundBottomIR, drawIRRays, drawIRRaysRange);
140  groundAroundIRSensorController()->setEnabled(enableGroundAroundIR);
141  setGroundAroundIRSensorsGraphicalProperties(drawGroundAroundIR, drawIRRays, drawIRRaysRange);
142  enableAttachmentDevice(enableAttachDev);
143 
144  QString ledColorsString = ConfigurationHelper::getString(params, prefix + "ledColors", "").replace("+", "#");
145  if (!ledColorsString.isEmpty()) {
146  // Converting all colors
147  QList<QColor> ledColors;
148  QStringList c = ledColorsString.split(" ", QString::SkipEmptyParts);
149  if (c.size() != 12) {
150  ConfigurationHelper::throwUserConfigError(prefix + "ledColors", params.getValue(prefix + "ledColors"), "The ledColors parameter must be a list of exactly 12 elements");
151  }
152  for (int i = 0; i < c.size(); ++i) {
153  const QColor curColor(c[i]);
154  if (!curColor.isValid()) {
155  ConfigurationHelper::throwUserConfigError(prefix + "ledColors", params.getValue(prefix + "ledColors"), QString("The value of the %1th color is not a valid color").arg(i));
156  }
157  ledColors << curColor;
158  }
159  // Finally setting the led colors
160  setLedColors(ledColors);
161  }
162 
163  // Setting the color of the robot
165 }
166 
167 void MarXbot::save(ConfigurationParameters& /*params*/, QString /*prefix*/) {
168  Logger::error("NOT IMPLEMENTED (MarXBot::save)");
169  abort();
170 }
171 
172 void MarXbot::describe(QString type) {
174 
175  Descriptor d = addTypeDescription(type, "The simulated wheeled MarXBot robot in a physical world", "This type models the wheeled MarXBot robot in a physical world. Note that to create a robot we need a resource named \"world\" with a valid World instance");
176 
177  d.describeBool("kinematicRobot").def(false).help("Whether only the kinematic behaviour of the robot has to be simulated or not", "If true only the kinematic properties of the robot are simulated (i.e. velocity); is false (the default) the whole dynamic of the robot is simulated");
178 
179  d.describeString("name").def("marXbot").help("The name of the MarXBot robot", "The name of the MarXBot robot");
180 
181  d.describeString("transformation").def("").help("The initial transformation matrix for the robot", "The transformation matrix must be a 4x4 matrix. The format is: a11 a12 a13 a14; a21 a22 a23 a24; a31 a32 a33 a34; a41 a42 a43 a44");
182 
183  d.describeBool("enableWheels").def(true).help("If true enables the wheel motors", "When set to false the wheel motors are not enabled, so the robot cannot move by itself");
184 
185  d.describeBool("enableProximityIR").def(false).help("If true enables the proximity IR sensors", "When set to false the proximity infrared sensors are not enabled, thus making simulation a bit faster. To increase simulation speed try to enable only the needed parts of the robot");
186 
187  d.describeBool("enableGroundBottomIR").def(false).help("If true enables the bottom ground IR sensors", "When set to false the ground infrared sensors below the battery pack are not enabled, thus making simulation a bit faster. To increase simulation speed try to enable only the needed parts of the robot");
188 
189  d.describeBool("enableGroundAroundIR").def(false).help("If true enables the around ground IR sensors", "When set to false the ground infrared sensors on the bottom part of the base (just above the wheels) are not enabled, thus making simulation a bit faster. To increase simulation speed try to enable only the needed parts of the robot");
190 
191  d.describeBool("enableAttachmentDevice").def(false).help("If true enables the attachement device of the MarXbot", "When set to true the attachement device is enabled. This device can be used by the robot to attach to another robot. The default is false");
192 
193  d.describeBool("drawProximityIR").def(false).help("If true draws the proximity IR sensors", "When set to true draws the proximity infrared sensors");
194 
195  d.describeBool("drawGroundBottomIR").def(false).help("If true draws the bottom ground IR sensors", "When set to true draws the ground infrared sensors below the battery pack");
196 
197  d.describeBool("drawGroundAroundIR").def(false).help("If true draws the around ground IR sensors", "When set to true draws the ground infrared sensors on the bottom part of the base (just above the wheels)");
198 
199  d.describeBool("drawIRRays").def(false).help("If true draws rays of enabled IR sensors", "When set to true rays of the enabled IR sensors (i.e. proximity, ground bottom and ground around infrared sensors) are drawn");
200 
201  d.describeBool("drawIRRaysRange").def(false).help("If true rays of enabled IR sensors are shown in their real range", "When drawIRRays is true, this parameter sets whether rays are drawn in their real range (the parameter is true) or instead only their direction is shown (the parameter is false)");
202 
203  d.describeString("ledColors").def("+FFFFFF +FFFFFF +FFFFFF +FFFFFF +FFFFFF +FFFFFF +FFFFFF +FFFFFF +FFFFFF +FFFFFF +FFFFFF +FFFFFF").help("The color of the leds of the robot.", "This is a list of colors separated by white spaces. Each color can be in one of the following formats: +RGB, +RRGGBB, +RRRGGGBBB, +RRRRGGGGBBBB (each of R, G, and B is a single hex digit) or a name from the list of colors defined in the list of SVG color keyword names provided by the World Wide Web Consortium (see http://www.w3.org/TR/SVG/types.html#ColorKeywords). The list must have exactly 12 elements. The default value is white for all leds");
204 }
205 
207  // Nothing to do here
208 }
209 
210 void MarXbot::setPosition(const Box2DWrapper* plane, real x, real y)
211 {
212  // The frame of reference of the MarXbot lies on the plane, we can simply set its position here
213  PhyMarXbot::setPosition(positionOnPlane(plane, x, y));
214 }
215 
216 wVector MarXbot::position() const
217 {
218  return matrix().w_pos;
219 }
220 
221 void MarXbot::setOrientation(const Box2DWrapper* plane, real angle)
222 {
223  wMatrix mtr = matrix();
224 
225  // Using the helper function to compute the new matrix
226  orientationOnPlane(plane, angle, mtr);
227 
228  setMatrix(mtr);
229 }
230 
231 #if defined(__GNUC__) && defined(DEVELOPER_WARNINGS)
232  #warning LE FUNZIONI orientation() E setOrientation() DEI ROBOT NON USANO LO STESSO RIFERIMENTO, OSSIA setOrientation(orientation()) RUOTA IL ROBOT ANCHE SE NON DOVREBBE! CORREGGERE IN FARSA2
233 #endif
234 
236 {
237  // The -PI_GRECO / 2.0 term is due to the fact that the robot head is towards -y
238  return angleBetweenXAxes(plane->phyObject()->matrix(), matrix()) - PI_GRECO / 2.0;
239 }
240 
242 {
243  return PhyMarXbot::basez + PhyMarXbot::bodyh;
244 }
245 
247 {
248  return PhyMarXbot::bodyr;
249 }
250 
252 {
253  return PhyMarXbot::isKinematic();
254 }
255 
256 QColor MarXbot::robotColor() const
257 {
258  return PhyMarXbot::color();
259 }
260 
261 Epuck::Epuck(ConfigurationParameters& params, QString prefix) :
262  RobotOnPlane(params, prefix),
263  PhyEpuck(extractWorld(params), extractRobotName(params, prefix, "epuck"), extractRobotTranformation(params, prefix))
264 {
265  doKinematicSimulation(ConfigurationHelper::getBool(params, prefix + "kinematicRobot", false));
266 
267  const bool enableWheels = ConfigurationHelper::getBool(params, prefix + "enableWheels", true);
268  const bool enableProximityIR = ConfigurationHelper::getBool(params, prefix + "enableProximityIR", false);
269  const bool enableGroundIR = ConfigurationHelper::getBool(params, prefix + "enableGroundIR", false);
270  const bool drawProximityIR = ConfigurationHelper::getBool(params, prefix + "drawProximityIR", false);
271  const bool drawGroundIR = ConfigurationHelper::getBool(params, prefix + "drawGroundIR", false);
272  const bool drawIRRays =ConfigurationHelper::getBool(params, prefix + "drawIRRays", false);
273  const bool drawIRRaysRange = ConfigurationHelper::getBool(params, prefix + "drawIRRaysRange", false);
274 
275  wheelsController()->setEnabled(enableWheels);
276  proximityIRSensorController()->setEnabled(enableProximityIR);
277  setProximityIRSensorsGraphicalProperties(drawProximityIR, drawIRRays, drawIRRaysRange);
278  groundIRSensorController()->setEnabled(enableGroundIR);
279  setGroundIRSensorsGraphicalProperties(drawGroundIR, drawIRRays, drawIRRaysRange);
280 
281  // Setting the color of the robot
283 }
284 
285 void Epuck::save(ConfigurationParameters& /*params*/, QString /*prefix*/) {
286  Logger::error("NOT IMPLEMENTED (Epuck::save)");
287  abort();
288 }
289 
290 void Epuck::describe(QString type) {
292 
293  Descriptor d = addTypeDescription(type, "The simulated wheeled Epuck robot in a physical world", "This type models the wheeled Epuck robot in a physical world. Note that to create a robot we need a resource named \"world\" with a valid World instance");
294 
295  d.describeBool("kinematicRobot").def(false).help("Whether only the kinematic behaviour of the robot has to be simulated or not", "If true only the kinematic properties of the robot are simulated (i.e. velocity); is false (the default) the whole dynamic of the robot is simulated");
296 
297  d.describeString("name").def("epuck").help("The name of the Epuck robot", "The name of the Epuck robot");
298 
299  d.describeString("transformation").def("").help("The initial transformation matrix for the robot", "The transformation matrix must be a 4x4 matrix. The format is: a11 a12 a13 a14; a21 a22 a23 a24; a31 a32 a33 a34; a41 a42 a43 a44");
300 
301  d.describeBool("enableWheels").def(true).help("If true enables the wheel motors", "When set to false the wheel motors are not enabled, so the robot cannot move by itself");
302 
303  d.describeBool("enableProximityIR").def(false).help("If true enables the proximity IR sensors", "When set to false the proximity infrared sensors are not enabled, thus making simulation a bit faster. To increase simulation speed try to enable only the needed parts of the robot");
304 
305  d.describeBool("enableGroundIR").def(false).help("If true enables the ground IR sensors", "When set to false the ground infrared sensors are not enabled, thus making simulation a bit faster. To increase simulation speed try to enable only the needed parts of the robot");
306 
307  d.describeBool("drawProximityIR").def(false).help("If true draws the proximity IR sensors", "When set to true draws the proximity IR sensors");
308 
309  d.describeBool("drawGroundIR").def(false).help("If true draws the ground IR sensors", "When set to true draws the ground IR sensors");
310 
311  d.describeBool("drawIRRays").def(false).help("If true draws rays of enabled IR sensors", "When set to true rays of the enabled IR sensors (i.e. proximity and ground infrared sensors) are drawn");
312 
313  d.describeBool("drawIRRaysRange").def(false).help("If true rays of enabled IR sensors are shown in their real range", "When drawIRRays is true, this parameter sets whether rays are drawn in their real range (the parameter is true) or instead only their direction is shown (the parameter is false)");
314 
315 }
316 
318  // Nothing to do here
319 }
320 
321 void Epuck::setPosition(const Box2DWrapper* plane, real x, real y)
322 {
323  // The frame of reference of the e-puck lies on the plane, we can simply set its position here
324  PhyEpuck::setPosition(positionOnPlane(plane, x, y));
325 }
326 
327 wVector Epuck::position() const
328 {
329  return matrix().w_pos;
330 }
331 
332 void Epuck::setOrientation(const Box2DWrapper* plane, real angle)
333 {
334  wMatrix mtr = matrix();
335 
336  // Using the helper function to compute the new matrix
337  orientationOnPlane(plane, angle, mtr);
338 
339  setMatrix(mtr);
340 }
341 
343 {
344  // The -PI_GRECO / 2.0 term is due to the fact that the robot head is towards -y
345  return angleBetweenXAxes(plane->phyObject()->matrix(), matrix()) - PI_GRECO / 2.0;
346 }
347 
349 {
351 }
352 
354 {
355  return PhyEpuck::bodyr;
356 }
357 
358 bool Epuck::isKinematic() const
359 {
360  return PhyEpuck::isKinematic();
361 }
362 
363 QColor Epuck::robotColor() const
364 {
365  return PhyEpuck::color();
366 }
367 
368 Khepera::Khepera(ConfigurationParameters& params, QString prefix) :
369  RobotOnPlane(params, prefix),
370  PhyKhepera(extractWorld(params), extractRobotName(params, prefix, "khepera"), extractRobotTranformation(params, prefix))
371 {
372  doKinematicSimulation(ConfigurationHelper::getBool(params, prefix + "kinematicRobot", false));
373 
374  const bool enableWheels = ConfigurationHelper::getBool(params, prefix + "enableWheels", true);
375  const bool enableProximityIR = ConfigurationHelper::getBool(params, prefix + "enableProximityIR", false);
376  const bool drawProximityIR = ConfigurationHelper::getBool(params, prefix + "drawProximityIR", false);
377  const bool drawIRRays = ConfigurationHelper::getBool(params, prefix + "drawIRRays", false);
378  const bool drawIRRaysRange = ConfigurationHelper::getBool(params, prefix + "drawIRRaysRange", false);
379 
380  wheelsController()->setEnabled(enableWheels);
381  proximityIRSensorController()->setEnabled(enableProximityIR);
382  setProximityIRSensorsGraphicalProperties(drawProximityIR, drawIRRays, drawIRRaysRange);
383 
384  setDrawFrontMarker(true);
385 
386  // Setting the color of the robot
388 }
389 
390 void Khepera::save(ConfigurationParameters& /*params*/, QString /*prefix*/) {
391  Logger::error("NOT IMPLEMENTED (Khepera::save)");
392  abort();
393 }
394 
395 void Khepera::describe(QString type) {
397 
398  Descriptor d = addTypeDescription(type, "The simulated wheeled Khepera II robot in a physical world", "This type models the wheeled Khepera II robot in a physical world. Note that to create a robot we need a resource named \"world\" with a valid World instance");
399 
400  d.describeBool("kinematicRobot").def(false).help("Whether only the kinematic behaviour of the robot has to be simulated or not", "If true only the kinematic properties of the robot are simulated (i.e. velocity); is false (the default) the whole dynamic of the robot is simulated");
401 
402  d.describeString("name").def("khepera").help("The name of the Khepera robot", "The name of the Khepera robot");
403 
404  d.describeString("transformation").def("").help("The initial transformation matrix for the robot", "The transformation matrix must be a 4x4 matrix. The format is: a11 a12 a13 a14; a21 a22 a23 a24; a31 a32 a33 a34; a41 a42 a43 a44");
405 
406  d.describeBool("enableWheels").def(true).help("If true enables the wheel motors", "When set to false the wheel motors are not enabled, so the robot cannot move by itself");
407 
408  d.describeBool("enableProximityIR").def(false).help("If true enables the proximity IR sensors", "When set to false the proximity infrared sensors are not enabled, thus making simulation a bit faster. To increase simulation speed try to enable only the needed parts of the robot");
409 
410  d.describeBool("drawProximityIR").def(false).help("If true draws the proximity IR sensors", "When set to true draws the proximity IR sensors");
411 
412  d.describeBool("drawIRRays").def(false).help("If true draws rays of enabled IR sensors", "When set to true rays of the enabled IR sensors (i.e. proximity and ground infrared sensors) are drawn");
413 
414  d.describeBool("drawIRRaysRange").def(false).help("If true rays of enabled IR sensors are shown in their real range", "When drawIRRays is true, this parameter sets whether rays are drawn in their real range (the parameter is true) or instead only their direction is shown (the parameter is false)");
415 
416 }
417 
419  // Nothing to do here
420 }
421 
422 void Khepera::setPosition(const Box2DWrapper* plane, real x, real y)
423 {
424  // The frame of reference of the e-puck lies on the plane, we can simply set its position here
425  PhyKhepera::setPosition(positionOnPlane(plane, x, y));
426 }
427 
428 wVector Khepera::position() const
429 {
430  return matrix().w_pos;
431 }
432 
433 void Khepera::setOrientation(const Box2DWrapper* plane, real angle)
434 {
435  wMatrix mtr = matrix();
436 
437  // Using the helper function to compute the new matrix
438  orientationOnPlane(plane, angle, mtr);
439 
440  setMatrix(mtr);
441 }
442 
444 {
445  // The -PI_GRECO / 2.0 term is due to the fact that the robot head is towards -y
446  return angleBetweenXAxes(plane->phyObject()->matrix(), matrix()) - PI_GRECO / 2.0;
447 }
448 
450 {
452 }
453 
455 {
456  return PhyKhepera::bodyr;
457 }
458 
460 {
461  return PhyKhepera::isKinematic();
462 }
463 
464 QColor Khepera::robotColor() const
465 {
466  return PhyKhepera::color();
467 }
468 
469 } //end namespace farsa
void doKinematicSimulation(bool k)
Epuck(ConfigurationParameters &params, QString prefix)
Constructor.
Definition: robots.cpp:261
virtual bool isKinematic() const
Returns true if the robot is in kinematic mode.
Definition: robots.cpp:459
RobotOnPlane(ConfigurationParameters &params, QString prefix)
Constructor.
Definition: robots.cpp:85
wMatrix extractRobotTranformation(ConfigurationParameters &params, QString prefix)
Gets the transformation matrix of the robot.
Definition: robots.cpp:50
static void describe(QString type)
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
Definition: robots.cpp:100
virtual void save(ConfigurationParameters &params, QString prefix)
Saves the actual status of parameters into the ConfigurationParameters object passed.
Definition: robots.cpp:390
static wMatrix identity()
static void throwUserMissingResourceError(QString resourceName, QString description)
void setGroundIRSensorsGraphicalProperties(bool drawSensor, bool drawRay=false, bool drawRealRay=false)
virtual void setOrientation(const Box2DWrapper *plane, real angle)
Sets the orientation of the robot.
Definition: robots.cpp:332
static QString getString(ConfigurationParameters &params, QString paramPath, QString def=QString())
Khepera(ConfigurationParameters &params, QString prefix)
Constructor.
Definition: robots.cpp:368
virtual void setOrientation(const Box2DWrapper *plane, real angle)
Sets the orientation of the robot.
Definition: robots.cpp:433
The subclass of PhyObject2DWrapper wrapping a box.
bool isKinematic() const
virtual real robotHeight() const
Returns the height of the robot.
Definition: robots.cpp:348
virtual void setPosition(const Box2DWrapper *plane, real x, real y)
Sets the position of the robot in the plane.
Definition: robots.cpp:210
QColor color() const
const QColor & configuredRobotColor() const
Returns the robot color specified by the configuration parameter.
Definition: robots.h:250
The base class for robots that move on a plane.
Definition: robots.h:108
void setPosition(const Box2DWrapper *plane, const wVector &pos)
Sets the position of the robot in the plane.
Definition: robots.cpp:113
static const real bodyh
WheelMotorController * wheelsController()
SimulatedIRProximitySensorController * proximityIRSensorController()
void setDrawFrontMarker(bool drawMarker)
void setProximityIRSensorsGraphicalProperties(bool drawSensor, bool drawRay=false, bool drawRealRay=false)
bool isKinematic() const
virtual void save(ConfigurationParameters &params, QString prefix)
Saves the actual status of parameters into the ConfigurationParameters object passed.
Definition: robots.cpp:167
SimulatedIRGroundSensorController * groundBottomIRSensorController()
static void describe(QString type)
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
Definition: robots.cpp:395
virtual void setPosition(const Box2DWrapper *plane, real x, real y)
Sets the position of the robot in the plane.
Definition: robots.cpp:422
void setGroundAroundIRSensorsGraphicalProperties(bool drawSensor, bool drawRay=false, bool drawRealRay=false)
void setColor(QColor c)
WheelMotorController * wheelsController()
virtual ~MarXbot()
Destructor.
Definition: robots.cpp:206
static const real batteryplacez
static void throwUserConfigError(QString paramName, QString paramValue, QString description)
An abstract class for robots.
Definition: robots.h:74
static const real bodydistancefromground
virtual wVector position() const
Returns the position of the robot.
Definition: robots.cpp:216
void setLedColors(QList< QColor > c)
virtual ~Khepera()
Destructor.
Definition: robots.cpp:418
const wMatrix & matrix() const
static void describe(QString type)
static void describe(QString type)
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
Definition: robots.cpp:172
void setEnabled(bool b)
SimpleResourcesUser * getResourcesUserForResource(QString resourceName)
static bool getBool(ConfigurationParameters &params, QString paramPath, bool def=false)
static void error(QString msg)
World * extractWorld(ConfigurationParameters &params)
Gets the resource for world.
Definition: robots.cpp:34
void doKinematicSimulation(bool k)
QString extractRobotName(ConfigurationParameters &params, QString prefix, QString defaultName)
Gets the name of the robot.
Definition: robots.cpp:45
void setProximityIRSensorsGraphicalProperties(bool drawSensor, bool drawRay=false, bool drawRealRay=false)
SimulatedIRGroundSensorController * groundIRSensorController()
void doKinematicSimulation(bool k)
virtual real robotHeight() const
Returns the height of the robot.
Definition: robots.cpp:449
void setPosition(const wVector &newpos)
virtual real orientation(const Box2DWrapper *plane) const
Returns the orientation of the robot.
Definition: robots.cpp:342
virtual bool isKinematic() const
Returns true if the robot is in kinematic mode.
Definition: robots.cpp:358
virtual QColor robotColor() const
Returns the color of the robot.
Definition: robots.cpp:256
virtual bool isKinematic() const
Returns true if the robot is in kinematic mode.
Definition: robots.cpp:251
MarXbot(ConfigurationParameters &params, QString prefix)
Constructor.
Definition: robots.cpp:118
virtual QColor robotColor() const
Returns the color of the robot.
Definition: robots.cpp:363
virtual void setOrientation(const Box2DWrapper *plane, real angle)
Sets the orientation of the robot.
Definition: robots.cpp:221
static Descriptor addTypeDescription(QString type, QString shortHelp, QString longHelp=QString(""))
QString getValue(QString path, bool alsoMatchParents=false) const
virtual QColor robotColor() const
Returns the color of the robot.
Definition: robots.cpp:464
static const real batteryplacedistancefromground
float real
static const real bodyr
SimulatedIRProximitySensorController * proximityIRSensorController()
void setGroundBottomIRSensorsGraphicalProperties(bool drawSensor, bool drawRay=false, bool drawRealRay=false)
void enableAttachmentDevice(bool enable)
virtual ~Epuck()
Destructor.
Definition: robots.cpp:317
void setMatrix(const wMatrix &newm)
virtual real orientation(const Box2DWrapper *plane) const
Returns the orientation of the robot.
Definition: robots.cpp:443
virtual real robotRadius() const
Returns the radius of the robot.
Definition: robots.cpp:353
QList< QColor > ledColors() const
virtual void save(ConfigurationParameters &params, QString prefix)
Saves the actual status of parameters into the ConfigurationParameters object passed.
Definition: robots.cpp:285
virtual void save(ConfigurationParameters &params, QString prefix)
Saves the actual status of parameters into the ConfigurationParameters object passed.
Definition: robots.cpp:94
virtual void setPosition(const Box2DWrapper *plane, real x, real y)
Sets the position of the robot in the plane.
Definition: robots.cpp:321
virtual real robotRadius() const
Returns the radius of the robot.
Definition: robots.cpp:454
virtual ~RobotOnPlane()
Destructor.
Definition: robots.cpp:108
virtual real robotHeight() const
Returns the height of the robot.
Definition: robots.cpp:241
virtual PhyBox * phyObject()
Returns a pointer to the wrapped PhyObject.
T * getResource(QString name)
static const real bodyh
virtual wVector position() const
Returns the position of the robot.
Definition: robots.cpp:327
virtual real orientation(const Box2DWrapper *plane) const
Returns the orientation of the robot.
Definition: robots.cpp:235
SimulatedIRGroundSensorController * groundAroundIRSensorController()
SimulatedIRProximitySensorController * proximityIRSensorController()
static void describe(QString type)
Add to Factory::typeDescriptions() the descriptions of all parameters and subgroups.
Definition: robots.cpp:290
void setProximityIRSensorsGraphicalProperties(bool drawSensor, bool drawRay=false, bool drawRealRay=false)
virtual real robotRadius() const
Returns the radius of the robot.
Definition: robots.cpp:246
bool isKinematic() const
virtual wVector position() const
Returns the position of the robot.
Definition: robots.cpp:428
WheelMotorController * wheelsController()
static const real bodyr