#include <ArActionRatioInput.h>
Inheritance diagram for ArActionRatioInput:
Public Member Functions | |
virtual void | activate (void) |
Activate the action. | |
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) |
Deactivate the action. | |
virtual ArActionDesired * | fire (ArActionDesired currentDesired) |
Fires the action, returning what the action wants to do. | |
virtual ArActionDesired * | getDesired (void) |
Gets what this action wants to do (for display purposes). | |
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 | setParameters (double fullThrottleForwards, double fullThrottleBackwards, double rotAtFullForwards, double rotAtFullBackwards, double rotAtStopped) |
Sets the parameters. | |
void | setRatios (double transRatio, double rotRatio, double throttleRatio) |
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 |
bool | myPrinting |
double | myRotAtFullBackwards |
double | myRotAtFullForwards |
double | myRotAtStopped |
double | myRotDeadZone |
double | myRotRatio |
double | myThrottleRatio |
double | myTransDeadZone |
double | myTransRatio |
This will drive in ratios, and is really set up to mimic a joystick, with 3 ratios, translational which goes from -100 to 100 (backwards to forwards), rotation, which goes from -100 to 100 (right to left), and throttle which goes from 0 to 100 (stopped to as fast as the robot will go).
When this action is activated it resets all its input ratios to 0 (including throttle).
This will use the parameters on the throttle to control the speed, these are set relative to the robot's maxes at startup but you can override them with the configuration (after doing an addToConfig) or with setParameters.
Definition at line 53 of file ArActionRatioInput.h.
|
Constructor.
Definition at line 34 of file ArActionRatioInput.cpp. |
|
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. Definition at line 176 of file ArActionRatioInput.cpp. Referenced by ArRatioInputJoydrive::ArRatioInputJoydrive(), ArRatioInputKeydrive::ArRatioInputKeydrive(), and ArRatioInputRobotJoydrive::ArRatioInputRobotJoydrive(). |
|
Fires the action, returning what the action wants to do.
Implements ArAction. Definition at line 267 of file ArActionRatioInput.cpp. References ArRobot::getRotDecel(), ArRobot::getRotVel(), ArActionDesired::getRotVel(), ArRobot::getRotVelMax(), ArRobot::getTransDecel(), ArRobot::getTransVelMax(), ArActionDesired::getVel(), ArRobot::getVel(), ArActionDesired::reset(), ArActionDesired::setRotDecel(), ArActionDesired::setRotVel(), ArActionDesired::setTransDecel(), and ArActionDesired::setVel(). |
|
Sets the parameters.
Definition at line 158 of file ArActionRatioInput.cpp. |
|
Set ratios. This checks the inputs and pulls them into the valid range. Definition at line 94 of file ArActionRatioInput.cpp. References setRotRatio(), setThrottleRatio(), and setTransRatio(). |
|
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. Definition at line 121 of file ArActionRatioInput.cpp. Referenced by setRatios(). |
|
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. Definition at line 135 of file ArActionRatioInput.cpp. Referenced by setRatios(). |
|
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. Definition at line 107 of file ArActionRatioInput.cpp. Referenced by setRatios(). |