It controls the e-puck velocity and odometry. More...

#include <epuckPosition2d.hpp>

Inheritance diagram for EpuckPosition2d:
Inheritance graph
Collaboration diagram for EpuckPosition2d:
Collaboration graph

Detailed Description

It controls the e-puck velocity and odometry.

Author
Renato Florentino Garcia
Date
August 2008

Classes

struct  BodyGeometry
 Struct which represents the geometry of e-puck body. More...
 
struct  DynamicConfiguration
 Struct which represents the pose and velocity of e-puck. More...
 

Public Member Functions

 EpuckPosition2d (const SerialPort *const serialPort)
 The EpuckPosition2d class constructor.
 
void SetVel (float px, float pa) const
 Set linear and angular velocities to e-puck.
 
DynamicConfiguration UpdateOdometry ()
 Estimate the current pose and velocities.
 
void SetOdometry (Triple odometry)
 Set the current pose estimated by odometry.
 
void ResetOdometry ()
 Set the current pose estimated by odometry - (x,y,theta) - to (0,0,0).
 
void StopMotors () const
 Stop the e-puck motors.
 
BodyGeometry GetGeometry () const
 Give the e-puck geometry.
 

Private Attributes

EpuckTimer timer
 
DynamicConfiguration odometryState
 
BodyGeometry geometry
 

Static Private Attributes

static const float WHEEL_DIAMETER = 0.0412
 
static const float TRACK = 0.05255
 
static const float r_DIV_L = 0.392007612
 
static const float r_DIV_2 = 0.0103
 
static const float STEP_ANG_DISP = 6.283185308e-3
 

Additional Inherited Members

- Protected Types inherited from EpuckInterface
enum  Request {
  CONFIG_CAMERA = 0x02 , SET_VEL = 0x13 , GET_STEPS = 0x14 , STOP_MOTORS = 0x15 ,
  GET_IR_PROX = 0x16 , GET_CAMERA_IMG = 0x17 , SET_LED_POWER = 0x18
}
 Request codes acceptable by e-puck. More...
 
- Protected Member Functions inherited from EpuckInterface
 EpuckInterface (const SerialPort *const serialPort)
 The EpuckInterface class constructor.
 
void SendRequest (Request request) const
 
- Protected Attributes inherited from EpuckInterface
const SerialPort *const serialPort
 A SerialPort class instance shared among the device interfaces.
 
- Static Protected Attributes inherited from EpuckInterface
static const float EPUCK_DIAMETER = 0.07
 Diameter of e-puck body [m].
 

Constructor & Destructor Documentation

◆ EpuckPosition2d()

EpuckPosition2d::EpuckPosition2d ( const SerialPort *const serialPort)

The EpuckPosition2d class constructor.

Parameters
serialPortPointer for a SerialPort class already created and connected with an e-puck.

References EpuckInterface::EPUCK_DIAMETER, EpuckPosition2d::BodyGeometry::height, and EpuckPosition2d::BodyGeometry::width.

Member Function Documentation

◆ GetGeometry()

BodyGeometry EpuckPosition2d::GetGeometry ( ) const
inline

Give the e-puck geometry.

Returns
A BodyGeometry struct.

◆ SetOdometry()

void EpuckPosition2d::SetOdometry ( Triple odometry)

Set the current pose estimated by odometry.

Set the internal representation for e-puck current pose estimated from odometry to the given value.

Parameters
odometryThe value which will be set.

References EpuckInterface::GET_STEPS, EpuckPosition2d::DynamicConfiguration::pose, SerialPort::recvInt(), EpuckInterface::serialPort, EpuckInterface::Triple::theta, EpuckInterface::Triple::x, and EpuckInterface::Triple::y.

Here is the call graph for this function:

◆ SetVel()

void EpuckPosition2d::SetVel ( float px,
float pa ) const

Set linear and angular velocities to e-puck.

Receive the linear and agular velocities, convert to correspondent steps per seconds motors commands and send to e-puck.

Parameters
pxLinear velocity. [m/s]
paAngular velocity. [rad/s]

References SerialPort::recvChar(), SerialPort::sendInt(), EpuckInterface::serialPort, and EpuckInterface::SET_VEL.

Here is the call graph for this function:

◆ StopMotors()

void EpuckPosition2d::StopMotors ( ) const

Stop the e-puck motors.

Stop the two motors and update the odometry by the steps yet non computed.

References SerialPort::recvChar(), EpuckInterface::serialPort, and EpuckInterface::STOP_MOTORS.

Here is the call graph for this function:

◆ UpdateOdometry()

EpuckPosition2d::DynamicConfiguration EpuckPosition2d::UpdateOdometry ( )

Estimate the current pose and velocities.

Receive from e-puck the motors steps made since the last call at this function, and estimate the new current pose and velocities.

Returns
A DynamicConfiguration struct.

References EpuckInterface::GET_STEPS, EpuckTimer::intervalDelay(), EpuckPosition2d::DynamicConfiguration::pose, SerialPort::recvInt(), EpuckTimer::resetInterval(), EpuckInterface::serialPort, EpuckInterface::Triple::theta, EpuckPosition2d::DynamicConfiguration::velocity, EpuckInterface::Triple::x, and EpuckInterface::Triple::y.

Here is the call graph for this function:

The documentation for this class was generated from the following files: