ArAction Class Reference

#include <ArAction.h>

Inheritance diagram for ArAction:

ArActionAvoidFront ArActionAvoidSide ArActionBumpers ArActionColorFollow ArActionConstantVelocity ArActionDeceleratingLimiter ArActionDriveDistance ArActionGoto ArActionGotoStraight ArActionInput ArActionIRs ArActionJoydrive ArActionKeydrive ArActionLimiterBackwards ArActionLimiterForwards ArActionLimiterTableSensor ArActionMovementParameters ArActionRatioInput ArActionRobotJoydrive ArActionStallRecover ArActionStop ArActionTriangleDriveTo ArActionTurn List of all members.

Detailed Description

Base class for actions.

actions Actions are objects queried for desired behavior by ArActionResolver to determine robot movement commands.

To implement an action object, define a subclass of ArAction, and implement the fire() method. You may also override setRobot() to obtain information from ArRobot, but you must also call ArAction::setRobot() so that the ArRobot pointer is stored by ArAction.

Several predefined action objects are also included in ARIA, they are listed here as ArActions's subclasses.

If an action is not active (it has been deactivated), then it will be ignored by the action resolver. Actions may be grouped using ArActionGroup, and activated/deactivated as a group. For example, ArMode, and ArServerMode (from ArNetworking), activate/deactivate action groups when switching modes.

See also:
actions description in the ARIA overview.

ArActionGroup

ArResolver

ArRobot


Public Member Functions

virtual void activate (void)
 Activate the action.
 ArAction (const char *name, const char *description="")
 Constructor.
virtual void deactivate (void)
 Deactivate the action.
virtual ArActionDesiredfire (ArActionDesired currentDesired)=0
 Fires the action, returning what the action wants to do.
virtual ArArggetArg (int number)
 Gets the numbered argument.
virtual const ArArggetArg (int number) const
virtual const char * getDescription (void) const
 Gets the long description of the action.
virtual const ArActionDesiredgetDesired (void) const
 Gets what this action wants to do (for display purposes).
virtual ArActionDesiredgetDesired (void)
 Gets what this action wants to do (for display purposes).
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.
virtual ~ArAction ()
 Desructor.

Static Public Member Functions

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

void setNextArgument (ArArg const &arg)
 Sets the argument type for the next argument (must only be used in a constructor!).

Protected Attributes

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

Static Protected Attributes

static bool ourDefaultActivationState


Member Function Documentation

virtual ArActionDesired* ArAction::fire ( ArActionDesired  currentDesired  )  [pure virtual]

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

Parameters:
currentDesired this is the tentative result, based on the resolver's processing of previous, higher-priority actions. This is only for the purpose of giving information to the action, changing it has no effect.
Returns:
pointer to what this action wants to do, NULL if it wants to do nothing. Common practice is to keep an ArActionDesired object in your action subclass, and return a pointer to that object. This avoids the need to create new objects during each invocation (which could never be deleted). Clear your stored ArActionDesired before modifying it with ArActionDesired::reset().

Implemented in ArActionGoto.

virtual const ArArg* ArAction::getArg ( int  number  )  const [virtual]

Gets the numbered argument

Java and Python Wrappers: Not available


The documentation for this class was generated from the following file:
Generated on Thu Aug 6 09:39:34 2009 for Aria by  doxygen 1.5.1