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{
35public:
36
39 {
40 float width;
41 float height;
42 };
43
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
101 {
102 return this->geometry;
103 }
104
105private:
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
Base class for all concrete interfaces of e-puck.
Definition epuckInterface.hpp:34
const SerialPort *const serialPort
A SerialPort class instance shared among the device interfaces.
Definition epuckInterface.hpp:59
It controls the e-puck velocity and odometry.
Definition epuckPosition2d.hpp:34
EpuckPosition2d(const SerialPort *const serialPort)
The EpuckPosition2d class constructor.
Definition epuckPosition2d.cpp:34
void SetVel(float px, float pa) const
Set linear and angular velocities to e-puck.
Definition epuckPosition2d.cpp:42
void SetOdometry(Triple odometry)
Set the current pose estimated by odometry.
Definition epuckPosition2d.cpp:83
void ResetOdometry()
Set the current pose estimated by odometry - (x,y,theta) - to (0,0,0).
Definition epuckPosition2d.cpp:98
BodyGeometry GetGeometry() const
Give the e-puck geometry.
Definition epuckPosition2d.hpp:100
void StopMotors() const
Stop the e-puck motors.
Definition epuckPosition2d.cpp:104
DynamicConfiguration UpdateOdometry()
Estimate the current pose and velocities.
Definition epuckPosition2d.cpp:112
A timer class.
Definition timer.hpp:36
Send and receive messages from e-puck.
Definition serialPort.hpp:41
Header file of the EpuckInterface class and the struct EpuckInterface::Triple.
Struct which represents a triple (x,y,theta).
Definition epuckInterface.hpp:39
Struct which represents the geometry of e-puck body.
Definition epuckPosition2d.hpp:39
float width
Width of e-puck body.
Definition epuckPosition2d.hpp:40
float height
Height of e-puck body.
Definition epuckPosition2d.hpp:41
Struct which represents the pose and velocity of e-puck.
Definition epuckPosition2d.hpp:46
Triple velocity
E-puck velocity in a 2D surface.
Definition epuckPosition2d.hpp:48
Triple pose
E-puck pose in a 2D surface.
Definition epuckPosition2d.hpp:47
Header file of EpuckTimer class.