Aria
2.8.0
|
Base class for actions. More...
#include <ArAction.h>
Inherited by ActionGo, ActionTurn, ArActionAvoidFront, ArActionAvoidSide, ArActionBumpers, ArActionColorFollow, ArActionConstantVelocity, ArActionDeceleratingLimiter, ArActionDriveDistance, ArActionGoto, ArActionGotoStraight, ArActionInput, ArActionIRs, ArActionJoydrive, ArActionKeydrive, ArActionLimiterBackwards, ArActionLimiterForwards, ArActionLimiterRot, ArActionLimiterTableSensor, ArActionMovementParameters, ArActionMovementParametersDebugging, ArActionRatioInput, ArActionRobotJoydrive, ArActionStallRecover, ArActionStop, ArActionTriangleDriveTo, ArActionTurn, Chase, and JoydriveAction.
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 ArActionDesired * | fire (ArActionDesired currentDesired)=0 |
Fires the action, returning what the action wants to do. More... | |
virtual const ArArg * | getArg (int number) const |
Gets the numbered argument. More... | |
virtual ArArg * | getArg (int number) |
Gets the numbered argument. | |
virtual const char * | getDescription (void) const |
Gets the long description of the action. | |
virtual ArActionDesired * | getDesired (void) |
Gets what this action wants to do (for display purposes) | |
virtual const ArActionDesired * | getDesired (void) const |
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. | |
ArRobot * | getRobot () 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. | |
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, ArArg > | myArgumentMap |
std::string | myDescription |
bool | myIsActive |
std::string | myName |
int | myNumArgs |
ArRobot * | myRobot |
The robot we are controlling, set by the action resolver using setRobot() | |
Static Protected Attributes | |
static bool | ourDefaultActivationState = true |
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.
|
pure virtual |
Fires the action, returning what the action wants to do.
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. |
Implemented in ArActionGoto.
|
virtual |
Gets the numbered argument.
Java and Python Wrappers: Not available
|
virtual |
Sets the robot this action is driving.
Java and Python Wrappers: If you override this method in a Java or Python subclass, use setActionRobotObj(ArRobot) instead of trying to call super.setRobot() or ArAction.setRobot(). (SWIG's subclassing "directors" feature cannot properly direct the call to the parent class, an infinite recursion results instead.)