Aria  2.8.0
ArActionDriveDistance Class Reference

This action goes to a given ArPose very naively. More...

#include <ArActionDriveDistance.h>

Inherits ArAction.

Public Member Functions

 ArActionDriveDistance (const char *name="driveDistance", double speed=400, double deceleration=200)
 
void cancelDistance (void)
 Cancels the goal the robot has.
 
virtual ArActionDesiredfire (ArActionDesired currentDesired)
 
double getDeceleration (void)
 Gets the deceleration the action will use (mm/sec/sec)
 
virtual ArActionDesiredgetDesired (void)
 
virtual const ArActionDesiredgetDesired (void) const
 
double getSpeed (void)
 Gets the speed the action will travel at (mm/sec)
 
bool haveAchievedDistance (void)
 Sees if the goal has been achieved.
 
void setDeceleration (double deceleration=200)
 Sets the deceleration the action will use (mm/sec/sec)
 
void setDistance (double distance, bool useEncoders=true)
 Sets a new goal and sets the action to go there.
 
void setPrinting (bool printing)
 Sets if we're printing or not.
 
void setSpeed (double speed=400)
 Sets the speed the action will travel at (mm/sec)
 
bool usingEncoders (void)
 Gets whether we're using the encoder position or the normal position.
 
- Public Member Functions inherited from ArAction
virtual void activate (void)
 Activate the action.
 
 ArAction (const char *name, const char *description="")
 Constructor.
 
virtual void deactivate (void)
 Deactivate the action.
 
virtual const ArArggetArg (int number) const
 Gets the numbered argument. More...
 
virtual ArArggetArg (int number)
 Gets the numbered argument.
 
virtual const char * getDescription (void) const
 Gets the long description of the action.
 
virtual const char * getName (void) const
 Gets the name of the action.
 
virtual int getNumArgs (void) const
 Find the number of arguments this action takes.
 
ArRobotgetRobot () const
 Get the robot we are controlling, which was set by setRobot()
 
virtual bool isActive (void) const
 Returns whether the action is active or not.
 
virtual void log (bool verbose=true) const
 Log information about this action using ArLog.
 
virtual void setRobot (ArRobot *robot)
 Sets the robot this action is driving. More...
 
virtual ~ArAction ()
 Desructor.
 

Protected Types

enum  State { STATE_NO_DISTANCE, STATE_ACHIEVED_DISTANCE, STATE_GOING_DISTANCE }
 

Protected Attributes

double myDeceleration
 
ArActionDesired myDesired
 
double myDistance
 
double myDistTravelled
 
ArPose myLastPose
 
double myLastVel
 
bool myPrinting
 
double mySpeed
 
State myState
 
bool myUseEncoders
 
- Protected Attributes inherited from ArAction
std::map< int, ArArgmyArgumentMap
 
std::string myDescription
 
bool myIsActive
 
std::string myName
 
int myNumArgs
 
ArRobotmyRobot
 The robot we are controlling, set by the action resolver using setRobot()
 

Additional Inherited Members

- Static Public Member Functions inherited from ArAction
static bool getDefaultActivationState (void)
 Gets the default activation state for all ArActions.
 
static void setDefaultActivationState (bool defaultActivationState)
 Sets the default activation state for all ArActions.
 
- Protected Member Functions inherited from ArAction
void setNextArgument (ArArg const &arg)
 Sets the argument type for the next argument (must only be used in a constructor!)
 
- Static Protected Attributes inherited from ArAction
static bool ourDefaultActivationState = true
 

Detailed Description

This action goes to a given ArPose very naively.

This action naively drives a fixed distance. The action stops the robot when it has travelled the appropriate distance. It travels at 'speed' mm/sec.

You can give it a distance with setDistance(), cancel its movement with cancelDistance(), and see if it got there with haveAchievedDistance().

You can tell it to go backwards by calling setDistance with a negative value.

This doesn't avoid obstacles or anything, you could add have an limiting ArAction at a higher priority to try to do this (so you don't smash things). (For truly intelligent navigation, see the ARNL or SONARNL software libraries.)


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