epuckPosition2d.hpp
Go to the documentation of this file.
1 /* Copyright 2008 Renato Florentino Garcia <fgar.renato@gmail.com>
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2, as
5  * published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef EPUCK_POSITION2D_HPP
17 #define EPUCK_POSITION2D_HPP
18 
19 #include "epuckInterface.hpp"
20 #include "timer.hpp"
21 
34 {
35 public:
36 
38  struct BodyGeometry
39  {
40  float width;
41  float height;
42  };
43 
46  {
49  };
50 
57 
65  void SetVel(float px, float pa) const;
66 
75 
82  void SetOdometry(Triple odometry);
83 
84 
87  void ResetOdometry();
88 
94  void StopMotors() const;
95 
100  inline BodyGeometry GetGeometry() const
101  {
102  return this->geometry;
103  }
104 
105 private:
106 
107  EpuckTimer timer;
108 
109  // Holder for current position data estimated by e-puck robot odometry.
110  DynamicConfiguration odometryState;
111 
112  BodyGeometry geometry;
113 
114  // Diameter of e-puck wheels [m]
115  static const float WHEEL_DIAMETER;
116 
117  // Distance between e-puck wheels [m]
118  static const float TRACK;
119 
120  // Wheel radius divided by TRACK [m]
121  static const float r_DIV_L;
122 
123  // Half of wheel radius [m]
124  static const float r_DIV_2;
125 
126  // Angular displacement of one motor step [rad]
127  static const float STEP_ANG_DISP;
128 };
129 
130 #endif
131 
Triple pose
E-puck pose in a 2D surface.
Definition: epuckPosition2d.hpp:47
void SetOdometry(Triple odometry)
Set the current pose estimated by odometry.
Definition: epuckPosition2d.cpp:83
const SerialPort *const serialPort
A SerialPort class instance shared among the device interfaces.
Definition: epuckInterface.hpp:59
void StopMotors() const
Stop the e-puck motors.
Definition: epuckPosition2d.cpp:104
DynamicConfiguration UpdateOdometry()
Estimate the current pose and velocities.
Definition: epuckPosition2d.cpp:112
Struct which represents the geometry of e-puck body.
Definition: epuckPosition2d.hpp:38
float width
Width of e-puck body.
Definition: epuckPosition2d.hpp:40
Header file of the EpuckInterface class and the struct EpuckInterface::Triple.
Struct which represents a triple (x,y,theta).
Definition: epuckInterface.hpp:38
float height
Height of e-puck body.
Definition: epuckPosition2d.hpp:41
Triple velocity
E-puck velocity in a 2D surface.
Definition: epuckPosition2d.hpp:48
Header file of EpuckTimer class.
BodyGeometry GetGeometry() const
Give the e-puck geometry.
Definition: epuckPosition2d.hpp:100
void SetVel(float px, float pa) const
Set linear and angular velocities to e-puck.
Definition: epuckPosition2d.cpp:42
void ResetOdometry()
Set the current pose estimated by odometry - (x,y,theta) - to (0,0,0).
Definition: epuckPosition2d.cpp:98
Struct which represents the pose and velocity of e-puck.
Definition: epuckPosition2d.hpp:45
It controls the e-puck velocity and odometry.
Definition: epuckPosition2d.hpp:33
Base class for all concrete interfaces of e-puck.
Definition: epuckInterface.hpp:33
A timer class.
Definition: timer.hpp:35
EpuckPosition2d(const SerialPort *const serialPort)
The EpuckPosition2d class constructor.
Definition: epuckPosition2d.cpp:34
Send and receive messages from e-puck.
Definition: serialPort.hpp:40