#include <ArActionDriveDistance.h>
Inheritance diagram for ArActionDriveDistance:
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 ActivMedia's ARNL or SONARNL software.)
Definition at line 54 of file ArActionDriveDistance.h.
Public Member Functions | |
ArActionDriveDistance (const char *name="driveDistance", double speed=400, double deceleration=200) | |
void | cancelDistance (void) |
Cancels the goal the robot has. | |
virtual ArActionDesired * | fire (ArActionDesired currentDesired) |
double | getDeceleration (void) |
Gets the deceleration the action will use (mm/sec/sec). | |
virtual const ArActionDesired * | getDesired (void) const |
virtual ArActionDesired * | getDesired (void) |
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. | |
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 |