MipResources::KorebotROS Class Reference
[Motion module]

Represents an Koremotor differential drive. More...

#include <KorebotROS.h>

Inheritance diagram for MipResources::KorebotROS:

MipResources::DiffDrive MipResources::Unicycle MipResources::MotionModule MipResources::Resource MIPObject

List of all members.

Public Member Functions

 KorebotROS (int argc, const char *argv[], KorebotROSPar *krp)
 Default constructor.
 ~KorebotROS ()
 Destructor.
ResourcePlate getPlate () const
 Gets the plate.
void setWheelCommands (Decimal leftAngVel, Decimal rightAngVel)
 Sets the angular velocities of the left and right wheels.
DiffDriveEncoderReading getEncoders ()
 Gets the DiffDriveEncoderReading of the encoders of the left and right wheels.
void resetEncoders ()
 Sets to 0 the encoders of the left and right wheels.
bool setStateKorebotROS (MotionModuleState correctedState, bool setPastTimeStamp=false, Time pastTimeStamp=Time())
 This method emulates the setState method of class MotionModule without launching the algorithm DiffDriveOdometer. It sets the pose and velocities of the robot. If setPastTimeStamp is true and then it sets the pose and velocities referred pastTimeStamp and accordingly updates the current pose and velocities. If setPastTimeStamp is false it sets the current pose and velocities.
void _localizationStepKorebotROS ()
 Embedding function to initialize the odometry and save the first odometry message.
MotionModuleTState _providedLocStepKorebotROS ()
 It initializes the odometry, at the first run, and computes the odometry step.
void _initOdometerKorebotROS ()
 This method initializes the odometry structures.
void _computeVelocities (DiffDriveEncoderReading &currReading)
 It takes the encoder measurements and compute the linear and angular speed.
void _intVelocities ()
 Integrate the velocities (here linear and angular velocities are in the KorebotROS workspace).
void _setWheelCommandsKorebotROS ()
 Apply commands to ROS gazebo robot.
void _providedLocSetKorebotROS (MotionModuleState state)
MotionModuleTState getStateKorebotROS ()
 Gets the current state (pose, velocities and timeStamp).
MotionModuleTState getState (Time ts)
 Gets the state refferred to a certain timestamp, if inside the log may be interpolated, if after (but before now) a new state is got, otherwise fatal is called.
bool setStateKorebotROS (MotionModuleState correctedState, MotionModuleState &finalState, bool setPastTimeStamp=false, Time pastTimeStamp=Time())
 Sets the pose and velocities of the robot. If setPastTimeStamp is true and then it sets the pose and velocities referred pastTimeStamp and accordingly updates the current pose and velocities. If setPastTimeStamp is false it sets the current pose and velocities.
void setCommandsKorebotROS (const Decimal &drive, const Decimal &turnrate, bool scaled=true)
 Sets velocity commands.
void setCommandsKorebotROS (const Decimal &drive, const Decimal &turnrate, MotionModuleTState &finalTState, bool scaled=true)
 Sets velocity commands.
void setCommandsAndTStateKorebotROS (MotionModuleState correctedState, const Decimal &drive, const Decimal &turnrate, MotionModuleTState &finalTState, bool scaled=true, bool setPastTimeStamp=false, Time pastTimeStamp=Time())
 Sets velocity commands and TState.
void _providedSetCommandsKorebotROS (const Decimal &drive, const Decimal &turnrate)
 It sets the commands and ask for applying them.

Protected Attributes

KorebotROSPar_korePar
KorebotROSVar_koreVar
long int _leftPulses
long int _rightPulses


Detailed Description

Represents an Koremotor differential drive.

Author:
Marco Cognetti
Todo:
options for korebot
Todo:
change name in koremotor
Todo:
provide reset encoders?

Constructor & Destructor Documentation

MipResources::KorebotROS::KorebotROS ( int  argc,
const char *  argv[],
KorebotROSPar krp 
)

Default constructor.

Parameters:
argc Argc.
argv Argv.

MipResources::KorebotROS::~KorebotROS (  ) 

Destructor.


Member Function Documentation

ResourcePlate MipResources::KorebotROS::getPlate (  )  const [inline, virtual]

Gets the plate.

Implements MipResources::DiffDrive.

void MipResources::KorebotROS::setWheelCommands ( Decimal  leftAngVel,
Decimal  rightAngVel 
) [virtual]

Sets the angular velocities of the left and right wheels.

Parameters:
leftAngVel Angular velocity to drive the left wheel.
rightAngVel Angular velocity to drive the right wheel.

Implements MipResources::DiffDrive.

DiffDriveEncoderReading MipResources::KorebotROS::getEncoders (  )  [virtual]

Gets the DiffDriveEncoderReading of the encoders of the left and right wheels.

Returns:
DiffDriveEncoderReading.
Note:
Here the return item is slightly different from the usual one ( DiffDriveEncoderReading = leftPulses, rightPulses, leftTime, rightTime) Since in ROS the time in wheels is taken at the instant, it is redundant to return leftTime and rightTime. Here, one returns the actualTime and the deltaTime instead of leftTime, rightTime

Implements MipResources::DiffDrive.

void MipResources::KorebotROS::resetEncoders (  ) 

Sets to 0 the encoders of the left and right wheels.

bool MipResources::KorebotROS::setStateKorebotROS ( MotionModuleState  correctedState,
bool  setPastTimeStamp = false,
Time  pastTimeStamp = Time() 
)

This method emulates the setState method of class MotionModule without launching the algorithm DiffDriveOdometer. It sets the pose and velocities of the robot. If setPastTimeStamp is true and then it sets the pose and velocities referred pastTimeStamp and accordingly updates the current pose and velocities. If setPastTimeStamp is false it sets the current pose and velocities.

Returns:
true if ok, false if the timestamp refers to the future or other errors occurred.
Parameters:
[in] &state Pose velocities to set and timeStamp they refer to.
[in] &setPastTimeStamp If true it sets the pose and velocities referred pastTimeStamp and accordingly updates the current pose and velocities. If false it sets the current pose and velocities.
[in] &pastTimeStamp Time stamp in the past, make sense only if setPastTimeStamp is true .

void MipResources::KorebotROS::_localizationStepKorebotROS (  ) 

Embedding function to initialize the odometry and save the first odometry message.

MotionModuleTState MipResources::KorebotROS::_providedLocStepKorebotROS (  ) 

It initializes the odometry, at the first run, and computes the odometry step.

void MipResources::KorebotROS::_initOdometerKorebotROS (  ) 

This method initializes the odometry structures.

void MipResources::KorebotROS::_computeVelocities ( DiffDriveEncoderReading currReading  ) 

It takes the encoder measurements and compute the linear and angular speed.

Parameters:
[in] &currReading Current reading by the encoders

void MipResources::KorebotROS::_intVelocities (  ) 

Integrate the velocities (here linear and angular velocities are in the KorebotROS workspace).

void MipResources::KorebotROS::_setWheelCommandsKorebotROS (  ) 

Apply commands to ROS gazebo robot.

void MipResources::KorebotROS::_providedLocSetKorebotROS ( MotionModuleState  state  ) 

MotionModuleTState MipResources::KorebotROS::getStateKorebotROS (  ) 

Gets the current state (pose, velocities and timeStamp).

Returns:
The state (pose and velocities).

MotionModuleTState MipResources::KorebotROS::getState ( Time  ts  )  [virtual]

Gets the state refferred to a certain timestamp, if inside the log may be interpolated, if after (but before now) a new state is got, otherwise fatal is called.

Returns:
Returned TState.
Parameters:
[in] ts The returned TState must have this timestamp.

Reimplemented from MipResources::MotionModule.

bool MipResources::KorebotROS::setStateKorebotROS ( MotionModuleState  correctedState,
MotionModuleState finalState,
bool  setPastTimeStamp = false,
Time  pastTimeStamp = Time() 
)

Sets the pose and velocities of the robot. If setPastTimeStamp is true and then it sets the pose and velocities referred pastTimeStamp and accordingly updates the current pose and velocities. If setPastTimeStamp is false it sets the current pose and velocities.

Returns:
true if ok, false if the timestamp refers to the future or other errors occurred.
Parameters:
[in] &state Pose velocities to set and timeStamp they refer to.
[out] &finalState Actual MotionModuleTState after the correction.
[in] &setPastTimeStamp If true it sets the pose and velocities referred pastTimeStamp and accordingly updates the current pose and velocities. If false it sets the current pose and velocities.
[in] &pastTimeStamp Time stamp in the past, make sense only if setPastTimeStamp is true .

void MipResources::KorebotROS::setCommandsKorebotROS ( const Decimal drive,
const Decimal turnrate,
bool  scaled = true 
)

Sets velocity commands.

Note:
This method must be implemented by the derived class on the basis of the real structure of the module.
Parameters:
drive Linear velocity command.
turnrate Sngular velocity command.
scaled If true the actual velocity commands are scaled whenever a saturation is detected.

void MipResources::KorebotROS::setCommandsKorebotROS ( const Decimal drive,
const Decimal turnrate,
MotionModuleTState finalTState,
bool  scaled = true 
)

Sets velocity commands.

Note:
This method must be implemented by the derived class on the basis of the real structure of the module.
Parameters:
[in] drive Linear velocity command.
[in] turnrate Angular velocity command.
[out] &finalTState Actual MotionModuleTState.
[in] scaled If true the actual velocity commands are scaled whenever a saturation is detected.

void MipResources::KorebotROS::setCommandsAndTStateKorebotROS ( MotionModuleState  correctedState,
const Decimal drive,
const Decimal turnrate,
MotionModuleTState finalTState,
bool  scaled = true,
bool  setPastTimeStamp = false,
Time  pastTimeStamp = Time() 
)

Sets velocity commands and TState.

Note:
This method must be implemented by the derived class on the basis of the real structure of the module.
Parameters:
[in] correctedState Pose velocities to set and timeStamp they refer to.
[in] drive Linear velocity command.
[in] turnrate Angular velocity command.
[out] &finalSTtate Actual MotionModuleTState after the correction.
[in] scaled If true the actual velocity commands are scaled whenever a saturation is detected.
[in] &setPastTimeStamp If true it sets the pose and velocities referred pastTimeStamp and accordingly updates the current pose and velocities. If false it sets the current pose and velocities.
[in] &pastTimeStamp Time stamp in the past, make sense only if setPastTimeStamp is true .

void MipResources::KorebotROS::_providedSetCommandsKorebotROS ( const Decimal drive,
const Decimal turnrate 
)

It sets the commands and ask for applying them.

Parameters:
[in] &drive Linear velocity one wants to apply
[in] &turnrate Angular velocity one wants to apply


Member Data Documentation

Parameters, implemented class.

Variables, implemented class.


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

Generated on Mon Feb 20 07:01:12 2017 for MIP by  doxygen 1.5.6