robots.h
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 #ifndef ROBOTS_H
25 #define ROBOTS_H
26 
27 #include "experimentsconfig.h"
28 #include "parametersettable.h"
29 #include "configurationparameters.h"
30 #include "phyicub.h"
31 #include "phymarxbot.h"
32 #include "phyepuck.h"
33 #include "phykhepera.h"
34 #include "wheeledexperimenthelper.h"
35 
36 namespace farsa {
37 
43  class FARSA_EXPERIMENTS_TEMPLATE Robot : public ParameterSettableInConstructor
44 {
45 public:
56  Robot(ConfigurationParameters& params, QString prefix) :
57  ParameterSettableInConstructor(params, prefix)
58  {
59  }
60 
64  virtual ~Robot()
65  {
66  }
67 };
68 
69 #ifdef FARSA_USE_YARP_AND_ICUB
70 
75 class FARSA_EXPERIMENTS_API iCubRobot : public Robot, public PhyiCub
76 {
77 public:
78 
89  iCubRobot(ConfigurationParameters& params, QString prefix);
90 
101  virtual void save(ConfigurationParameters& params, QString prefix);
102 
110  static void describe(QString type);
111 
115  virtual ~iCubRobot();
116 };
117 #endif // FARSA_USE_YARP_AND_ICUB
118 
127 class FARSA_EXPERIMENTS_API RobotOnPlane : public Robot
128 {
129 public:
130 
141  RobotOnPlane(ConfigurationParameters& params, QString prefix);
142 
153  virtual void save(ConfigurationParameters& params, QString prefix);
154 
162  static void describe(QString type);
163 
167  virtual ~RobotOnPlane();
168 
179  void setPosition(const Box2DWrapper* plane, const wVector& pos);
180 
191  virtual void setPosition(const Box2DWrapper* plane, real x, real y) = 0;
192 
198  virtual wVector position() const = 0;
199 
211  virtual void setOrientation(const Box2DWrapper* plane, real angle) = 0;
212 
223  virtual real orientation(const Box2DWrapper* plane) const = 0;
224 
233  virtual real robotHeight() const = 0;
234 
243  virtual real robotRadius() const = 0;
244 
250  virtual bool isKinematic() const = 0;
251 
252 protected:
259  const QColor& robotColor() const
260  {
261  return m_color;
262  }
263 
264 private:
269  const QColor m_color;
270 };
271 
277 class FARSA_EXPERIMENTS_API MarXbot : public RobotOnPlane, public PhyMarXbot
278 {
279 public:
280 
291  MarXbot(ConfigurationParameters& params, QString prefix);
292 
303  virtual void save(ConfigurationParameters& params, QString prefix);
304 
312  static void describe(QString type);
313 
317  virtual ~MarXbot();
318 
329  virtual void setPosition(const Box2DWrapper* plane, real x, real y);
330 
336  virtual wVector position() const;
337 
349  virtual void setOrientation(const Box2DWrapper* plane, real angle);
350 
361  virtual real orientation(const Box2DWrapper* plane) const;
362 
371  virtual real robotHeight() const;
372 
381  virtual real robotRadius() const;
382 
388  virtual bool isKinematic() const;
389 };
390 
396 class FARSA_EXPERIMENTS_API Epuck : public RobotOnPlane, public PhyEpuck
397 {
398 public:
399 
410  Epuck(ConfigurationParameters& params, QString prefix);
411 
422  virtual void save(ConfigurationParameters& params, QString prefix);
423 
431  static void describe(QString type);
432 
436  virtual ~Epuck();
437 
448  virtual void setPosition(const Box2DWrapper* plane, real x, real y);
449 
455  virtual wVector position() const;
456 
468  virtual void setOrientation(const Box2DWrapper* plane, real angle);
469 
480  virtual real orientation(const Box2DWrapper* plane) const;
481 
490  virtual real robotHeight() const;
491 
500  virtual real robotRadius() const;
501 
507  virtual bool isKinematic() const;
508 };
509 
515 class FARSA_EXPERIMENTS_API Khepera : public RobotOnPlane, public PhyKhepera
516 {
517 public:
518 
529  Khepera(ConfigurationParameters& params, QString prefix);
530 
541  virtual void save(ConfigurationParameters& params, QString prefix);
542 
550  static void describe(QString type);
551 
555  virtual ~Khepera();
556 
567  virtual void setPosition(const Box2DWrapper* plane, real x, real y);
568 
574  virtual wVector position() const;
575 
587  virtual void setOrientation(const Box2DWrapper* plane, real angle);
588 
599  virtual real orientation(const Box2DWrapper* plane) const;
600 
609  virtual real robotHeight() const;
610 
619  virtual real robotRadius() const;
620 
626  virtual bool isKinematic() const;
627 };
628 
629 } //end namespace farsa
630 
631 #endif