Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ArActionRatioInput Class Reference

Takes input on how to drive a robot in a more speed independent manner. More...

#include <ArActionRatioInput.h>

Inheritance diagram for ArActionRatioInput:

ArAction List of all members.

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 ArActionDesiredfire (ArActionDesired currentDesired)
 Fires the action, returning what the action wants to do.
virtual ArActionDesiredgetDesired (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

Detailed Description

Takes input on how to drive a robot in a more speed independent manner.

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.

See also:
ArRatioInputKeydrive

ArRatioInputJoydrive

ArRatioInputRobotJoydrive

Definition at line 53 of file ArActionRatioInput.h.


Constructor & Destructor Documentation

ArActionRatioInput::ArActionRatioInput const char *  name = "RatioInput"  ) 
 

Constructor.

Parameters:
name name of the action

Definition at line 34 of file ArActionRatioInput.cpp.


Member Function Documentation

void ArActionRatioInput::addFireCallback int  priority,
ArFunctor functor
 

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().

ArActionDesired * ArActionRatioInput::fire ArActionDesired  currentDesired  )  [virtual]
 

Fires the action, returning what the action wants to do.

Parameters:
currentDesired this is what the current resolver has for its desired, this is SOLELY for the purpose of giving information to the action
Returns:
pointer to what this action wants to do, NULL if it wants to do nothing

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().

void ArActionRatioInput::setParameters double  fullThrottleForwards,
double  fullThrottleBackwards,
double  rotAtFullForwards,
double  rotAtFullBackwards,
double  rotAtStopped
 

Sets the parameters.

Parameters:
fullThrottleForwards the speed we go forwards at at full throttle (mm/sec)
fullThrottleBackwards the speed we go backwards at at full throttle (mm/sec)
rotAtFullForwards the speed we turn at at full throttle forwards
rotAtFullBackwards the speed we turn at at full throttle backwards
rotAtStopped the speed we turn at if we're stopped

Definition at line 158 of file ArActionRatioInput.cpp.

void ArActionRatioInput::setRatios double  transRatio,
double  rotRatio,
double  throttleRatio
 

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().

void ArActionRatioInput::setRotRatio double  rotRatio  ) 
 

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().

void ArActionRatioInput::setThrottleRatio double  throttleRatio  ) 
 

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().

void ArActionRatioInput::setTransRatio double  transRatio  ) 
 

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().


The documentation for this class was generated from the following files:
Generated on Wed Oct 19 12:56:42 2005 for Aria by  doxygen 1.4.0