Aria  2.8.0
ArActionRatioInput Class Reference

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

#include <ArActionRatioInput.h>

Inherits ArAction.

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. More...
 
void addToConfig (ArConfig *config, const char *section)
 Adds to a section in a config.
 
 ArActionRatioInput (const char *name="RatioInput")
 Constructor. More...
 
virtual void deactivate (void)
 
virtual ArActionDesiredfire (ArActionDesired currentDesired)
 
virtual ArActionDesiredgetDesired (void)
 
virtual const ArActionDesiredgetDesired (void) const
 
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)) More...
 
void setParameters (double fullThrottleForwards, double fullThrottleBackwards, double rotAtFullForwards, double rotAtFullBackwards, double rotAtStopped, double latAtFullForwards=0, double latAtFullBackwards=0, double latAtStopped=0)
 Sets the parameters. More...
 
void setRatios (double transRatio, double rotRatio, double throttleRatio, double latRatio=0)
 Set ratios. More...
 
void setRotRatio (double rotRatio)
 Sets the rot ratio (from -100 (full right) to 100 (full left) More...
 
void setThrottleRatio (double throttleRatio)
 Sets the throttle ratio (from 0 (stopped) to 100 (full throttle) More...
 
void setTransRatio (double transRatio)
 Sets the trans ratio (from -100 (full backwards) to 100 (full forwards) More...
 
virtual ~ArActionRatioInput ()
 Destructor.
 
- Public Member Functions inherited from ArAction
 ArAction (const char *name, const char *description="")
 Constructor.
 
virtual const ArArggetArg (int number) const
 Gets the numbered argument. More...
 
virtual ArArggetArg (int number)
 Gets the numbered argument.
 
virtual const char * getDescription (void) const
 Gets the long description of the action.
 
virtual const char * getName (void) const
 Gets the name of the action.
 
virtual int getNumArgs (void) const
 Find the number of arguments this action takes.
 
ArRobotgetRobot () const
 Get the robot we are controlling, which was set by setRobot()
 
virtual bool isActive (void) const
 Returns whether the action is active or not.
 
virtual void log (bool verbose=true) const
 Log information about this action using ArLog.
 
virtual void setRobot (ArRobot *robot)
 Sets the robot this action is driving. More...
 
virtual ~ArAction ()
 Desructor.
 

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
 
- Protected Attributes inherited from ArAction
std::map< int, ArArgmyArgumentMap
 
std::string myDescription
 
bool myIsActive
 
std::string myName
 
int myNumArgs
 
ArRobotmyRobot
 The robot we are controlling, set by the action resolver using setRobot()
 

Additional Inherited Members

- Static Public Member Functions inherited from ArAction
static bool getDefaultActivationState (void)
 Gets the default activation state for all ArActions.
 
static void setDefaultActivationState (bool defaultActivationState)
 Sets the default activation state for all ArActions.
 
- Protected Member Functions inherited from ArAction
void setNextArgument (ArArg const &arg)
 Sets the argument type for the next argument (must only be used in a constructor!)
 
- Static Protected Attributes inherited from ArAction
static bool ourDefaultActivationState = true
 

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

Constructor & Destructor Documentation

◆ ArActionRatioInput()

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

Constructor.

Parameters
namename of the action

Member Function Documentation

◆ addFireCallback()

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.

◆ setLatRatio()

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.

◆ setParameters()

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
fullThrottleForwardsthe speed we go forwards at at full throttle (mm/sec)
fullThrottleBackwardsthe speed we go backwards at at full throttle (mm/sec)
rotAtFullForwardsthe speed we turn at at full throttle forwards
rotAtFullBackwardsthe speed we turn at at full throttle backwards
rotAtStoppedthe speed we turn at if there is no forward/backward motion
rotAtFullForwardsthe speed we turn at at full throttle forwards
latAtFullForwardsthe lateral speed we go at at full throttle (mm/sec) (if robot supports lateral motion)
latAtFullBackwardsthe lateral speed we go at at full throttle (mm/sec) (if robot supports lateral motion)
latAtStoppedthe lateral speed we go at if stopped.

◆ setRatios()

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.

◆ setRotRatio()

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.

◆ setThrottleRatio()

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.

◆ setTransRatio()

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: