#include <KorebotROS.h>
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 |
MipResources::KorebotROS::KorebotROS | ( | int | argc, | |
const char * | argv[], | |||
KorebotROSPar * | krp | |||
) |
Default constructor.
argc | Argc. | |
argv | Argv. |
MipResources::KorebotROS::~KorebotROS | ( | ) |
Destructor.
ResourcePlate MipResources::KorebotROS::getPlate | ( | ) | const [inline, virtual] |
void MipResources::KorebotROS::setWheelCommands | ( | Decimal | leftAngVel, | |
Decimal | rightAngVel | |||
) | [virtual] |
Sets the angular velocities of the left and right wheels.
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.
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.
[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.
[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).
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.
[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.
[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.
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.
[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.
[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.
[in] | &drive | Linear velocity one wants to apply |
[in] | &turnrate | Angular velocity one wants to apply |
KorebotROSPar* MipResources::KorebotROS::_korePar [protected] |
Parameters, implemented class.
KorebotROSVar* MipResources::KorebotROS::_koreVar [protected] |
Variables, implemented class.
long int MipResources::KorebotROS::_leftPulses [protected] |
long int MipResources::KorebotROS::_rightPulses [protected] |