MipResources::MobileRob Class Reference
[Mobile robot]

Abstract mobile robot. More...

#include <MobileRob.h>

Inheritance diagram for MipResources::MobileRob:

MipResources::Resource MIPObject MipResources::KheperaIII MipResources::RemoteKhepera MipResources::RemoteRob

List of all members.

Public Member Functions

 MobileRob ()
 Default constructor.
 MobileRob (int argc, const char *argv[])
 Constructor with options.
virtual MobileRobParrobPar ()
 Gets Robot parameters.
virtual MobileRobVarrobVar ()
 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 RangeSensParrangeSensPar ()
 Gets the parameters of the range sensor.
virtual RangeSensmmParrangeSensmmPar ()
 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 UnicycleParunicyclePar ()
 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


Detailed Description

Abstract mobile robot.

Author:
Antonio Franchi
Todo:
Virtual logging method, but logger is a task...

Constructor & Destructor Documentation

MipResources::MobileRob::MobileRob (  )  [inline]

Default constructor.

Note:
Not used.

MipResources::MobileRob::MobileRob ( int  argc,
const char *  argv[] 
)

Constructor with options.

Note:
This is the constructor called using the scheduler.


Member Function Documentation

virtual MobileRobPar* MipResources::MobileRob::robPar (  )  [inline, virtual]

Gets Robot parameters.

Returns:
Pointer to the robot parameters.

virtual MobileRobVar* MipResources::MobileRob::robVar (  )  [inline, virtual]

Gets Robot variables pointer.

Returns:
Pointer to the robot variables.

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.

Returns:
Pointer to the range sensor variables (NULL if range sensor is not present).

Reimplemented in MipResources::RemoteKhepera.

virtual RangeSensmmPar* MipResources::MobileRob::rangeSensmmPar (  )  [inline, virtual]

Gets the parameters of the range sensor in millimetres.

Returns:
Pointer to the range sensor variables (NULL if range sensor is not present).

bool MipResources::MobileRob::updatedScan ( Scan s  )  [virtual]

Gets an updated scan in metres.

Note:
This is a wrapper of RangeSens::updatedScan.
Returns:
True if all is ok (remeber that scan is a MutExed Resource), false otherwise.
Parameters:
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.

Note:
This is, in part, a wrapper of RangeSens::updatedScan.
Returns:
True if all is ok (remeber that scan is a MutExed Resource), false otherwise.
Parameters:
s A scan in metres in which the current scan is copied, if return is true.
Todo:
Implement me searching the correct timestamp.

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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Parameters:
[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.

Note:
This is a wrapper of RangeSens::startScan or RangeSensmm::startScan.
Parameters:
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.

Note:
This is a wrapper of RangeSens::stopScan or RangeSensmm::stopScan.

Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.

virtual bool MipResources::MobileRob::storedScan ( Scan s,
Time  timeout 
) [inline, virtual]

Gets the stored scan.

Note:
Make sense only if startScan has been called before.

This is a wrapper of RangeSens::currentScan.

Parameters:
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.

Returns:
Pointer to the unycycle parameters.

Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.

virtual void MipResources::MobileRob::velCmd ( Decimal  drive,
Decimal  turnrate 
) [inline, virtual]

Sets the velocity of the unicycle.

Parameters:
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.

Parameters:
[out] &linVel Linear velocity.
[out] &angVel Angular velocity.
Note:
Deprecated. use getMotionState.

Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.

virtual Pose MipResources::MobileRob::getPose ( void   )  [inline, virtual]

Gets the pose of the unicycle.

Returns:
Pose.
Note:
Deprecated. use getMotionState.

Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.

virtual MotionModuleTState MipResources::MobileRob::getMotionState (  )  [inline, virtual]

Gets the state of the unicycle (pose, velocities and timestamp).

Returns:
State.

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.

Parameters:
[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.

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 .
Todo:
To implement the check on future.
Todo:
To implement all.

Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.

virtual void MipResources::MobileRob::setPose ( Pose  p  )  [inline, virtual]

Sets the current pose of the unicycle.

Parameters:
p Current pose.
Todo:
Be sure that setState(p,0.0,0.0) make sense.
Note:
Deprecated. use setMotionState.

Reimplemented in MipResources::RemoteKhepera, and MipResources::RemoteRob.

virtual bool MipResources::MobileRob::updatedIRScan ( Scan scan  )  [inline, virtual]

Gets an updated range IR scan in meters.

Note:
This is a wrapper of RangeSens::updatedScan.
Returns:
True if all is ok (remeber that scan is a MutExed Resource), false otherwise.
Parameters:
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.

Note:
This is a wrapper of GroundSens::updatedScan.
Returns:
True if all is ok (remeber that scan is a MutExed Resource), false otherwise.
Parameters:
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.

Note:
This is a wrapper of RangeSens::updatedScan.
Returns:
True if all is ok (remeber that scan is a MutExed Resource), false otherwise.
Parameters:
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.

Returns:
True if the gps is active, false otherwise.
Parameters:
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]

Gets the total number of scans taken.

Reimplemented in MipResources::KheperaIII.

virtual void MipResources::MobileRob::sendString ( string  s  )  [inline, virtual]

virtual void MipResources::MobileRob::turnLaserOn (  )  [inline, virtual]

Reimplemented in MipResources::KheperaIII.


Member Data Documentation

Options for the mobile robot.

Abstract Robot parameters.

Abstract Robot variables.

Abstract Robot range sensor.

Abstract Robot motion module.

Abstract Robot range sensor infrared.

Abstract Robot ground sensor infrared.

Abstract Robot range sensor sonar.

Abstract Robot gps.

0 if the range sensor in use is in m, 1 if in mm.

0 if the range sensor in use is in m, 1 if in mm.

Whether or not the range sansor is activated.

Whether or not the infraRed is activated.

Whether or not the unycycle is activated.

Whether or not the sonare is activated.

Whether or not the gps is activated.

whether (1) or not (0) localization is given by simple odometry.

ofstream* MipResources::MobileRob::outputFile [protected]


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