#include <MobileRob.h>
Public Member Functions | |
MobileRob () | |
Default constructor. | |
MobileRob (int argc, const char *argv[]) | |
Constructor with options. | |
virtual MobileRobPar * | robPar () |
Gets Robot parameters. | |
virtual MobileRobVar * | robVar () |
Gets Robot variables pointer. | |
void | activateMotionThread () |
Initializes the thread for the SND algorithm. | |
void | pauseMotionThread () |
Pause the thread for the SND algorithm but does not close it. | |
void | unpauseMotionThread () |
Unpause the thread for the SND algorithm. | |
bool | isPauseMotionThread () |
Return if motionthread is paused or unpaused. | |
virtual RangeSensPar * | rangeSensPar () |
Gets the parameters of the range sensor. | |
virtual RangeSensmmPar * | rangeSensmmPar () |
Gets the parameters of the range sensor in millimetres. | |
virtual bool | updatedScan (Scan &s) |
Gets an updated scan in metres. | |
virtual bool | updatedScan (Scan &s, MotionModuleTState &state) |
Gets an updated scan and the state of the robot in that moment. | |
virtual bool | updatedState (MotionModuleTState &state, Time &timeStamp) |
Gets an updated state of the robot in that moment. | |
virtual bool | updatedState (MotionModuleTState &state) |
Gets an updated state of the robot in that moment. | |
virtual bool | updatedLastState (MotionModuleTState &state, Time &timeStamp, const Decimal &delta) |
Gets the last state of the robot in that moment. | |
virtual bool | updatedLastState (MotionModuleTState &state, const Decimal &delta) |
Gets the last state of the robot in that moment. | |
virtual void | startScan (unsigned int num) |
Starts a continuous scan. | |
virtual void | stopScan () |
Stops a continuous scan. | |
virtual bool | storedScan (Scan &s, Time timeout) |
Gets the stored scan. | |
virtual UnicyclePar * | unicyclePar () |
Gets the parameters of the unicycle. | |
virtual void | velCmd (Decimal drive, Decimal turnrate) |
Sets the velocity of the unicycle. | |
virtual void | getVel (Decimal &linVel, Decimal &angVel) |
Gets the velocity of the unicycle. | |
virtual Pose | getPose () |
Gets the pose of the unicycle. | |
virtual MotionModuleTState | getMotionState () |
Gets the state of the unicycle (pose, velocities and timestamp). | |
void | getCurvature (Decimal &c, bool &infinity) |
Gets an estimate of the curvature of the current path on the basis of the odometry. | |
virtual bool | setMotionState (MotionModuleState state, 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. | |
virtual void | setPose (Pose p) |
Sets the current pose of the unicycle. | |
virtual bool | updatedIRScan (Scan &scan) |
Gets an updated range IR scan in meters. | |
virtual bool | updatedIRGroundScan (vector< int > &s) |
Gets an updated ground IR scan. | |
virtual bool | getSonarMeasures (Scan &scan) |
Gets an updated Sonar scan in meters. | |
virtual bool | getGPSMeasures (Position pos) |
Gets the position given by the GPS. | |
virtual void | setGoal (Pose g) |
Sets the goal. | |
Pose | getGoal () |
Gets the goal. | |
void | setGoalVel (Position gv) |
Sets the goal vel. | |
Position | goalVel () |
Gets the goal vel. | |
bool | getRangeSensActive () |
Gets the activity state of the specified periferal. | |
void | setRangeSensActive (bool set) |
Set if the range sensor is active or not. | |
bool | getInfraredActive () |
Gets the activity state of the specified periferal. | |
bool | getUnicycleActive () |
Gets the activity state of the specified periferal. | |
bool | getSonarActive () |
Gets the activity state of the specified periferal. | |
bool | getGpsActive () |
Gets the activity state of the specified periferal. | |
bool | getRangeSensorType (ScanTypes &type) |
virtual int | totScans (int lastTakenScan) |
Gets the total number of scans taken. | |
virtual void | sendString (string s) |
virtual void | turnLaserOn () |
Protected Attributes | |
MobileRobOptions | options |
MobileRobPar * | _par |
MobileRobVar * | _var |
RangeSens * | _rangeSens |
Unicycle * | _unicycle |
RangeSens * | _infrared |
GroundSens * | _groundInfrared |
RangeSens * | _sonar |
PositionDetector * | _gps |
ScanTypes | rangeSensorType |
ScanTypes | infraredType |
bool | rangeSensActive |
bool | infraredActive |
bool | unicycleActive |
bool | sonarActive |
bool | gpsActive |
bool | useOdometryLocalization |
bool | goalIsSet |
Thread | _motionThread |
bool | _motionThreadActive |
bool | _motionThreadPause |
ofstream * | outputFile |
MipResources::MobileRob::MobileRob | ( | ) | [inline] |
Default constructor.
MipResources::MobileRob::MobileRob | ( | int | argc, | |
const char * | argv[] | |||
) |
Constructor with options.
virtual MobileRobPar* MipResources::MobileRob::robPar | ( | ) | [inline, virtual] |
Gets Robot parameters.
virtual MobileRobVar* MipResources::MobileRob::robVar | ( | ) | [inline, virtual] |
Gets Robot variables pointer.
void MipResources::MobileRob::activateMotionThread | ( | ) |
Initializes the thread for the SND algorithm.
void MipResources::MobileRob::pauseMotionThread | ( | ) |
Pause the thread for the SND algorithm but does not close it.
void MipResources::MobileRob::unpauseMotionThread | ( | ) |
Unpause the thread for the SND algorithm.
bool MipResources::MobileRob::isPauseMotionThread | ( | ) |
Return if motionthread is paused or unpaused.
virtual RangeSensPar* MipResources::MobileRob::rangeSensPar | ( | ) | [inline, virtual] |
Gets the parameters of the range sensor.
Reimplemented in MipResources::RemoteKhepera.
virtual RangeSensmmPar* MipResources::MobileRob::rangeSensmmPar | ( | ) | [inline, virtual] |
Gets the parameters of the range sensor in millimetres.
bool MipResources::MobileRob::updatedScan | ( | Scan & | s | ) | [virtual] |
Gets an updated scan in metres.
s | A scan in metres in which the current scan is copied, if return is true. |
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
bool MipResources::MobileRob::updatedScan | ( | Scan & | s, | |
MotionModuleTState & | state | |||
) | [virtual] |
Gets an updated scan and the state of the robot in that moment.
s | A scan in metres in which the current scan is copied, if return is true. |
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
bool MipResources::MobileRob::updatedState | ( | MotionModuleTState & | state, | |
Time & | timeStamp | |||
) | [virtual] |
Gets an updated state of the robot in that moment.
[in] | &timeStamp | Time to be searched |
[out] | &state | Output of the function. State associated with time |
Reimplemented in MipResources::RemoteKhepera.
bool MipResources::MobileRob::updatedState | ( | MotionModuleTState & | state | ) | [virtual] |
Gets an updated state of the robot in that moment.
[out] | &state | Output of the function. State associated with time |
Reimplemented in MipResources::RemoteKhepera.
bool MipResources::MobileRob::updatedLastState | ( | MotionModuleTState & | state, | |
Time & | timeStamp, | |||
const Decimal & | delta | |||
) | [virtual] |
Gets the last state of the robot in that moment.
[in] | &timeStamp | Time to be searched |
[in] | &delta | Delta threshold to assign that last odometry data might be associated with timeStamp |
[out] | &state | Output of the function. State associated with time It searches the last TState stored and it check if it is close to the given timeStamp. A threshold delta is given in order to check the close constraint |
Reimplemented in MipResources::RemoteKhepera.
bool MipResources::MobileRob::updatedLastState | ( | MotionModuleTState & | state, | |
const Decimal & | delta | |||
) | [virtual] |
Gets the last state of the robot in that moment.
[in] | &delta | Delta threshold to assign that last odometry data might be associated with current time |
[out] | &state | Output of the function. State associated with time It searches the last TState stored and it check if it is close to the given timeStamp. A threshold delta is given in order to check the close constraint |
Reimplemented in MipResources::RemoteKhepera.
virtual void MipResources::MobileRob::startScan | ( | unsigned int | num | ) | [inline, virtual] |
Starts a continuous scan.
num | Number of scans to perform, (0 means unbounded). |
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
virtual void MipResources::MobileRob::stopScan | ( | ) | [inline, virtual] |
Stops a continuous scan.
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
Gets the stored scan.
This is a wrapper of RangeSens::currentScan.
s | A scan in which the current scan is copied. | |
timeout | Timeout. |
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
virtual UnicyclePar* MipResources::MobileRob::unicyclePar | ( | ) | [inline, virtual] |
Gets the parameters of the unicycle.
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
Sets the velocity of the unicycle.
drive | Drive. | |
turnrate | Trunrate. |
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
virtual void MipResources::MobileRob::getVel | ( | Decimal & | linVel, | |
Decimal & | angVel | |||
) | [inline, virtual] |
Gets the velocity of the unicycle.
[out] | &linVel | Linear velocity. |
[out] | &angVel | Angular velocity. |
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
virtual Pose MipResources::MobileRob::getPose | ( | void | ) | [inline, virtual] |
Gets the pose of the unicycle.
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
virtual MotionModuleTState MipResources::MobileRob::getMotionState | ( | ) | [inline, virtual] |
Gets the state of the unicycle (pose, velocities and timestamp).
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
void MipResources::MobileRob::getCurvature | ( | Decimal & | c, | |
bool & | infinity | |||
) | [inline] |
Gets an estimate of the curvature of the current path on the basis of the odometry.
[out] | &c | Current curvature estimate, it is valid only if infinity is true. |
[out] | &infinity | true if the estimated curvature is infinite false if it is finite. |
virtual bool MipResources::MobileRob::setMotionState | ( | MotionModuleState | state, | |
bool | setPastTimeStamp = false , |
|||
Time | pastTimeStamp = Time() | |||
) | [inline, virtual] |
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 . |
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
virtual void MipResources::MobileRob::setPose | ( | Pose | p | ) | [inline, virtual] |
Sets the current pose of the unicycle.
p | Current pose. |
Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.
virtual bool MipResources::MobileRob::updatedIRScan | ( | Scan & | scan | ) | [inline, virtual] |
Gets an updated range IR scan in meters.
s | A scan in meters in which the current scan is copied, if return is true. |
virtual bool MipResources::MobileRob::updatedIRGroundScan | ( | vector< int > & | s | ) | [inline, virtual] |
Gets an updated ground IR scan.
s | A scan in which the current scan is copied, if return is true. |
virtual bool MipResources::MobileRob::getSonarMeasures | ( | Scan & | scan | ) | [inline, virtual] |
Gets an updated Sonar scan in meters.
s | A scan in meters in which the current scan is copied, if return is true. |
virtual bool MipResources::MobileRob::getGPSMeasures | ( | Position | pos | ) | [inline, virtual] |
Gets the position given by the GPS.
pos | Position. |
virtual void MipResources::MobileRob::setGoal | ( | Pose | g | ) | [inline, virtual] |
Sets the goal.
Pose MipResources::MobileRob::getGoal | ( | ) | [inline] |
Gets the goal.
void MipResources::MobileRob::setGoalVel | ( | Position | gv | ) |
Sets the goal vel.
Position MipResources::MobileRob::goalVel | ( | ) |
Gets the goal vel.
bool MipResources::MobileRob::getRangeSensActive | ( | ) |
Gets the activity state of the specified periferal.
void MipResources::MobileRob::setRangeSensActive | ( | bool | set | ) |
Set if the range sensor is active or not.
bool MipResources::MobileRob::getInfraredActive | ( | ) |
Gets the activity state of the specified periferal.
bool MipResources::MobileRob::getUnicycleActive | ( | ) |
Gets the activity state of the specified periferal.
bool MipResources::MobileRob::getSonarActive | ( | ) |
Gets the activity state of the specified periferal.
bool MipResources::MobileRob::getGpsActive | ( | ) |
Gets the activity state of the specified periferal.
bool MipResources::MobileRob::getRangeSensorType | ( | ScanTypes & | type | ) | [inline] |
virtual int MipResources::MobileRob::totScans | ( | int | lastTakenScan | ) | [inline, virtual] |
virtual void MipResources::MobileRob::sendString | ( | string | s | ) | [inline, virtual] |
virtual void MipResources::MobileRob::turnLaserOn | ( | ) | [inline, virtual] |
Reimplemented in MipResources::KheperaIII.
MobileRobOptions MipResources::MobileRob::options [protected] |
Options for the mobile robot.
MobileRobPar* MipResources::MobileRob::_par [protected] |
Abstract Robot parameters.
MobileRobVar* MipResources::MobileRob::_var [protected] |
Abstract Robot variables.
RangeSens* MipResources::MobileRob::_rangeSens [protected] |
Abstract Robot range sensor.
Unicycle* MipResources::MobileRob::_unicycle [protected] |
Abstract Robot motion module.
RangeSens* MipResources::MobileRob::_infrared [protected] |
Abstract Robot range sensor infrared.
GroundSens* MipResources::MobileRob::_groundInfrared [protected] |
Abstract Robot ground sensor infrared.
RangeSens* MipResources::MobileRob::_sonar [protected] |
Abstract Robot range sensor sonar.
PositionDetector* MipResources::MobileRob::_gps [protected] |
Abstract Robot gps.
ScanTypes MipResources::MobileRob::rangeSensorType [protected] |
0 if the range sensor in use is in m, 1 if in mm.
ScanTypes MipResources::MobileRob::infraredType [protected] |
0 if the range sensor in use is in m, 1 if in mm.
bool MipResources::MobileRob::rangeSensActive [protected] |
Whether or not the range sansor is activated.
bool MipResources::MobileRob::infraredActive [protected] |
Whether or not the infraRed is activated.
bool MipResources::MobileRob::unicycleActive [protected] |
Whether or not the unycycle is activated.
bool MipResources::MobileRob::sonarActive [protected] |
Whether or not the sonare is activated.
bool MipResources::MobileRob::gpsActive [protected] |
Whether or not the gps is activated.
bool MipResources::MobileRob::useOdometryLocalization [protected] |
whether (1) or not (0) localization is given by simple odometry.
bool MipResources::MobileRob::goalIsSet [protected] |
Thread MipResources::MobileRob::_motionThread [protected] |
bool MipResources::MobileRob::_motionThreadActive [protected] |
bool MipResources::MobileRob::_motionThreadPause [protected] |
ofstream* MipResources::MobileRob::outputFile [protected] |