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

ArActionRatioInput Class Reference

#include <ArActionRatioInput.h>

Inheritance diagram for ArActionRatioInput:

ArAction List of all members.

Detailed Description

Action that requests motion based on abstract ratios provided by diferent input sources.

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

See also:
ArRatioInputKeydrive

ArRatioInputJoydrive

ArRatioInputRobotJoydrive


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 ArActionDesiredfire (ArActionDesired currentDesired)
virtual const ArActionDesiredgetDesired (void) const
virtual ArActionDesiredgetDesired (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 & Destructor Documentation

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

Constructor.

Parameters:
name name of the action


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.

void ArActionRatioInput::setLatRatio double  latRatio  ) 
 

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.

void ArActionRatioInput::setParameters double  fullThrottleForwards,
double  fullThrottleBackwards,
double  rotAtFullForwards,
double  rotAtFullBackwards,
double  rotAtStopped,
double  latAtFullForwards = 0,
double  latAtFullBackwards = 0,
double  latAtStopped = 0
 

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 there is no forward/backward motion
rotAtFullForwards the speed we turn at at full throttle forwards
latAtFullForwards the lateral speed we go at at full throttle (mm/sec) (if robot supports lateral motion)
latAtFullBackwards the lateral speed we go at at full throttle (mm/sec) (if robot supports lateral motion)
latAtStopped the lateral speed we go at if stopped.

void ArActionRatioInput::setRatios double  transRatio,
double  rotRatio,
double  throttleRatio,
double  latRatio = 0
 

Set ratios.

This checks the inputs and pulls them into the valid range.

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.

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.

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.


The documentation for this class was generated from the following files:
Generated on Thu Jan 7 10:34:40 2010 for Aria by  doxygen 1.4.2