#include <ArActionRatioInput.h>
Inheritance diagram for ArActionRatioInput:
This action interprets input drive commands as three abstract ratios, translation, rotation, and throttle. (In this way it mimics many joysticks.) The translation speed input ranges from -100 to 100, where -100 requests maximum backwards speed, and 100 requests maximum forward speed, 0 requests no translational speed, and values in between request a linear percentage of the maximum. Similarly, rotation speed input ranges from -100 to 100, where -100 indicates maximum rightwards or clockwise rotation, 100 indicates maximum leftwards or counter-clockwise rotation, 0 requests no rotation, and values in between request a linear percentage of the maximum. The throttle input scales the other speed, and ranges from 0 (no motion) to 100 (maximum motion).
Seperate objects (e.g. ArRatioInputKeydrive, ArRatioInputJoydrive, ArRAtionInputRobotJoydrive) are used to provide input.
When this action is activated it resets all its input ratios to 0 (including throttle).
Configuration parameters are used to map the maximum ratios to actual robot speeds. These are set be default to the robot's maximum configured velocities at startup but you can override them with ArConfig parameters (and call addToConfig()) or setParameters().
Public Member Functions | |
virtual void | activate (void) |
void | addActivateCallback (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST) |
Adds a callback that is called when this action is activated. | |
void | addDeactivateCallback (ArFunctor *functor, ArListPos::Pos position=ArListPos::LAST) |
Adds a callback that is called when this action is deactivated. | |
void | addFireCallback (int priority, ArFunctor *functor) |
Adds a callback that is called from this actions fire call. | |
void | addToConfig (ArConfig *config, const char *section) |
Adds to a section in a config. | |
ArActionRatioInput (const char *name="RatioInput") | |
Constructor. | |
virtual void | deactivate (void) |
virtual ArActionDesired * | fire (ArActionDesired currentDesired) |
virtual const ArActionDesired * | getDesired (void) const |
virtual ArActionDesired * | getDesired (void) |
double | getRotRatio (void) |
Gets the rot ratio (from -100 (full right) to 100 (full left). | |
double | getThrottleRatio (void) |
Gets the throttle ratio (from 0 (stopped) to 100 (full throttle). | |
double | getTransRatio (void) |
Gets the trans ratio (from -100 (full backwards) to 100 (full forwards). | |
void | remActivateCallback (ArFunctor *functor) |
Removes a callback that was called when this action is activated. | |
void | remDeactivateCallback (ArFunctor *functor) |
Removes a callback that was called when this action is deactivated. | |
void | remFireCallback (ArFunctor *functor) |
Removes a callback that was called from this actions fire callback. | |
void | setLatRatio (double latRatio) |
Sets the lat ratio (from -100 (one way) to 100 (the other)). | |
void | setParameters (double fullThrottleForwards, double fullThrottleBackwards, double rotAtFullForwards, double rotAtFullBackwards, double rotAtStopped, double latAtFullForwards=0, double latAtFullBackwards=0, double latAtStopped=0) |
Sets the parameters. | |
void | setRatios (double transRatio, double rotRatio, double throttleRatio, double latRatio=0) |
Set ratios. | |
void | setRotRatio (double rotRatio) |
Sets the rot ratio (from -100 (full right) to 100 (full left). | |
void | setThrottleRatio (double throttleRatio) |
Sets the throttle ratio (from 0 (stopped) to 100 (full throttle). | |
void | setTransRatio (double transRatio) |
Sets the trans ratio (from -100 (full backwards) to 100 (full forwards). | |
virtual | ~ArActionRatioInput () |
Destructor. | |
Protected Attributes | |
std::list< ArFunctor * > | myActivateCallbacks |
std::list< ArFunctor * > | myDeactivateCallbacks |
ArActionDesired | myDesired |
std::multimap< int, ArFunctor * > | myFireCallbacks |
double | myFullThrottleBackwards |
double | myFullThrottleForwards |
double | myLatAtFullBackwards |
double | myLatAtFullForwards |
double | myLatAtStopped |
double | myLatDeadZone |
double | myLatRatio |
bool | myPrinting |
double | myRotAtFullBackwards |
double | myRotAtFullForwards |
double | myRotAtStopped |
double | myRotDeadZone |
double | myRotRatio |
double | myThrottleRatio |
double | myTransDeadZone |
double | myTransRatio |
|
Constructor.
|
|
Adds a callback that is called from this actions fire call. These callbacks are actually called in the order of lowest number to highest number, but this still means higher numbers are more important since throttle set by those will override the lower. |
|
Sets the lat ratio (from -100 (one way) to 100 (the other)). This checks the input for greather than 100 and less than -100 and pulls it to within that range. |
|
Sets the parameters.
|
|
Set ratios. This checks the inputs and pulls them into the valid range. |
|
Sets the rot ratio (from -100 (full right) to 100 (full left). This checks the input for greather than 100 and less than -100 and pulls it to within that range. |
|
Sets the throttle ratio (from 0 (stopped) to 100 (full throttle). This checks the input for greather than 100 and less than 0 and pulls it to within that range. |
|
Sets the trans ratio (from -100 (full backwards) to 100 (full forwards). This checks the input for greather than 100 and less than -100 and pulls it to within that range. |