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 <QVector>
32 
33 namespace farsa {
34  class PhyObject;
35  class PhyJoint;
36  class PhyCylinder;
37 
44  class FARSA_WSIM_API PhyKhepera : public WObject {
45  Q_OBJECT
46 
47  public:
51  static const real bodydistancefromground;
52 
56  static const real bodyr;
57 
61  static const real bodyh;
62 
66  static const real bodym;
67 
71  static const real wheelr;
72 
76  static const real wheelh;
77 
81  static const real wheelm;
82 
86  static const real axletrack;
87 
94  static const real passivewheelr;
95 
102  static const real passivewheelm;
103 
104  public:
105 // /**
106 // * \brief Creates a khepera II robot
107 // *
108 // * \param world the world in which the robot lives
109 // * \param name the name of the robots
110 // * \param transformation the transformation matrix of the robot
111 // */
112 // PhyKhepera(World* world, QString name, const wMatrix& transformation = wMatrix::identity());
113 //
114 // /**
115 // * \brief Destructor
116 // */
117 // virtual ~PhyKhepera();
118 //
119 // /**
120 // * \brief Returns the motor controller for the wheels
121 // *
122 // * \return the motor controller for the wheels
123 // */
124 // WheelMotorController* wheelsController()
125 // {
126 // return m_wheelsCtrl;
127 // }
128 //
129 // /**
130 // * \brief Pre-updates the robot
131 // *
132 // * This method is called at each step of the world just before
133 // * the physic update
134 // */
135 // virtual void preUpdate();
136 //
137 // /**
138 // * \brief Post-updates the robot
139 // *
140 // * This method is called at each step of the world just after
141 // * the physic update
142 // */
143 // virtual void postUpdate();
144 //
145 // /**
146 // * \brief Changes the robot model from dynamic to kinematic and
147 // * vice-versa
148 // *
149 // * \param k if true switches to the kinematic Kephera II model,
150 // * if false to the dynamic one (at creation the model
151 // * is always dynamic)
152 // */
153 // void doKinematicSimulation(bool k);
154 //
155 // /**
156 // * \brief Returns true if we are using the kinematic model
157 // *
158 // * \return true if we are using the kinematic model
159 // */
160 // bool isKinematic() const
161 // {
162 // return m_kinematicSimulation;
163 // }
164 //
165 // protected slots:
166 // /**
167 // * \brief Sets the desidered velocity of the left wheel
168 // *
169 // * This is used when in kinematic to move the robot. We only use
170 // * velocity because robots can only move by setting wheel
171 // * velocities
172 // * \param velocity the desidered velocity (in radiants per
173 // * second)
174 // */
175 // void setLeftWheelDesideredVelocity(real velocity);
176 //
177 // /**
178 // * \brief Sets the desidered velocity of the right wheel
179 // *
180 // * This is used when in kinematic to move the robot. We only use
181 // * velocity because robots can only move by setting wheel
182 // * velocities
183 // * \param velocity the desidered velocity (in radiants per
184 // * second)
185 // */
186 // void setRightWheelDesideredVelocity(real velocity);
187 //
188 // protected:
189 // /**
190 // * \brief The function called when the transformation matrix of
191 // * the robot is changed
192 // *
193 // * This updates the matrix of all sub-objects
194 // */
195 // virtual void changedMatrix();
196 //
197 // private:
198 // /**
199 // * \brief The object representing the robot body
200 // */
201 // PhyObject* m_body;
202 //
203 // /**
204 // * \brief The transformation matrix of the body relative to the
205 // * robot frame of reference
206 // */
207 // wMatrix m_bodyTransformation;
208 //
209 // /**
210 // * \brief The inverse transformation matrix of the body relative
211 // * to the robot frame of reference
212 // */
213 // wMatrix m_bodyInvTransformation;
214 //
215 // /**
216 // * \brief The vector containing the wheels
217 // *
218 // * The order is: right wheel, left wheel, and 2 passive
219 // * spherical wheels
220 // */
221 // QVector<PhyObject*> m_wheels;
222 //
223 // /**
224 // * \brief The relative matrices of wheels respect to body
225 // *
226 // * The order is: right wheel, left wheel, and 2 passive
227 // * spherical wheels
228 // */
229 // QVector<wMatrix> m_wheelsTransformation;
230 //
231 // /**
232 // * \brief The vector containing the wheel joints
233 // *
234 // * The order is: right wheel, left wheel, and 2 passive
235 // * spherical wheels
236 // */
237 // QVector<PhyJoint*> m_wheelJoints;
238 //
239 // /**
240 // * \brief The motor controller for the two motorized wheels
241 // *
242 // * The wheels order it (right, left)
243 // */
244 // WheelMotorController* m_wheelsCtrl;
245 //
246 // /**
247 // * \brief True if we are doing a kinematic simulation
248 // */
249 // bool m_kinematicSimulation;
250 //
251 // /**
252 // * \brief The speed of the left wheel (used when in kinematic)
253 // */
254 // real m_leftWheelVelocity;
255 //
256 // /**
257 // * \brief The speed of the left wheel (used when in kinematic)
258 // */
259 // real m_rightWheelVelocity;
260  };
261 } // end namespace farsa
262 
263 #endif