phykhepera.h
1 /********************************************************************************
2  * WorldSim -- library for robot simulations *
3  * Copyright (C) 2012-2013 *
4  * Gianluca Massera <emmegian@yahoo.it> *
5  * Fabrizio Papi <erkito87@gmail.com> *
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program; if not, write to the Free Software *
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
20  ********************************************************************************/
21 
22 #ifndef PHYKHEPERA_H
23 #define PHYKHEPERA_H
24 
25 #include "worldsimconfig.h"
26 #include "wvector.h"
27 #include "wmatrix.h"
28 #include "world.h"
29 #include "motorcontrollers.h"
30 #include "sensorcontrollers.h"
31 #include "graphicalwobject.h"
32 #include <QVector>
33 
34 namespace farsa {
35  class PhyObject;
36  class PhyJoint;
37  class PhyCylinder;
38 
45  class FARSA_WSIM_API PhyKhepera : public WObject {
46  Q_OBJECT
47 
48  public:
53 
57  static const real bodyr;
58 
62  static const real bodyh;
63 
67  static const real bodym;
68 
72  static const real wheelr;
73 
77  static const real wheelh;
78 
82  static const real wheelm;
83 
87  static const real axletrack;
88 
95  static const real passivewheelr;
96 
103  static const real passivewheelm;
104 
105  public:
113  PhyKhepera(World* world, QString name, const wMatrix& transformation = wMatrix::identity());
114 
118  virtual ~PhyKhepera();
119 
126  {
127  return m_wheelsCtrl;
128  }
129 
136  {
137  return m_proximityIR;
138  }
139 
146  virtual void preUpdate();
147 
154  virtual void postUpdate();
155 
166  void setProximityIRSensorsGraphicalProperties(bool drawSensor, bool drawRay = false, bool drawRealRay = false);
167 
175  void setDrawFrontMarker(bool drawMarker);
176 
184  bool getDrawFrontMarker() const;
185 
194  void doKinematicSimulation(bool k);
195 
201  bool isKinematic() const
202  {
203  return m_kinematicSimulation;
204  }
205 
206  protected slots:
216  void setLeftWheelDesideredVelocity(real velocity);
217 
227  void setRightWheelDesideredVelocity(real velocity);
228 
229  protected:
236  virtual void changedMatrix();
237 
238  private:
242  PhyObject* m_body;
243 
248  wMatrix m_bodyTransformation;
249 
254  wMatrix m_bodyInvTransformation;
255 
262  QVector<PhyObject*> m_wheels;
263 
271  QVector<wMatrix> m_wheelsTransformation;
272 
279  QVector<PhyJoint*> m_wheelJoints;
280 
286  WheelMotorController* m_wheelsCtrl;
287 
292 
296  bool m_kinematicSimulation;
297 
301  real m_leftWheelVelocity;
302 
306  real m_rightWheelVelocity;
307 
314  GraphicalWObject* m_frontMarker;
315  };
316 } // end namespace farsa
317 
318 #endif
World's Object class.
Definition: wobject.h:39
static wMatrix identity()
create an identity matrix
Definition: wmatrix.h:460
static const real passivewheelm
The mass of the passive wheels.
Definition: phykhepera.h:103
bool isKinematic() const
Returns true if we are using the kinematic model.
Definition: phykhepera.h:201
static const real passivewheelr
The radius of the passive wheels.
Definition: phykhepera.h:95
static const real axletrack
The distance between the two motorized wheels.
Definition: phykhepera.h:87
static const real bodyh
The height of the body of the robot.
Definition: phykhepera.h:62
SimulatedIRProximitySensorController * proximityIRSensorController()
Returns the proximity infrared sensors controller.
Definition: phykhepera.h:135
World class.
Definition: world.h:223
WheelMotorController * wheelsController()
Returns the motor controller for the wheels.
Definition: phykhepera.h:125
static const real bodydistancefromground
The distance of the body from the ground.
Definition: phykhepera.h:52
static const real wheelm
The mass of one motorized wheel.
Definition: phykhepera.h:82
wMatrix class
Definition: wmatrix.h:48
static const real wheelh
The height of the motorized wheels.
Definition: phykhepera.h:77
An helper class to draw stuffs in the world.
static const real wheelr
The radius of the motorized wheels.
Definition: phykhepera.h:72
float real
static const real bodyr
The radius of the body of the robot.
Definition: phykhepera.h:57
static const real bodym
The mass of the robot without the wheels.
Definition: phykhepera.h:67
Dedicated controller for wheeled robots.
The class modelling a kephera II robot.
Definition: phykhepera.h:45
PhyObject class.
Definition: phyobject.h:46