Aria  2.8.0
ArActionGoto Class Reference

This action goes to a given ArPose very naively. More...

#include <ArActionGoto.h>

Inherits ArAction.

Public Member Functions

 ArActionGoto (const char *name="goto", ArPose goal=ArPose(0.0, 0.0, 0.0), double closeDist=100, double speed=400, double speedToTurnAt=150, double turnAmount=7)
 
void cancelGoal (void)
 Cancels the goal; this action will stop requesting movement. More...
 
virtual ArActionDesiredfire (ArActionDesired currentDesired)
 Called by the action resover; request movement towards goal if we have one. More...
 
double getCloseDist (void)
 Gets the distance which is close enough to the goal (mm)
 
virtual ArActionDesiredgetDesired (void)
 Used by the action resolvel; return current desired action. More...
 
virtual const ArActionDesiredgetDesired (void) const
 
ArPose getGoal (void)
 Gets the goal the action has.
 
double getSpeed (void)
 Gets the speed the action will travel to the goal at (mm/sec)
 
bool haveAchievedGoal (void)
 Sees if the goal has been achieved. More...
 
void setCloseDist (double closeDist)
 Set the distance which is close enough to the goal (mm);.
 
void setGoal (ArPose goal)
 Sets a new goal and sets the action to go there.
 
void setSpeed (double speed)
 Sets the speed the action will travel to the goal at (mm/sec)
 
- Public Member Functions inherited from ArAction
virtual void activate (void)
 Activate the action.
 
 ArAction (const char *name, const char *description="")
 Constructor.
 
virtual void deactivate (void)
 Deactivate the action.
 
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 Types

enum  State { STATE_NO_GOAL, STATE_ACHIEVED_GOAL, STATE_GOING_TO_GOAL }
 

Protected Attributes

double myCloseDist
 
double myCurTurnDir
 
ArActionDesired myDesired
 
double myDirectionToTurn
 
ArPose myGoal
 
ArPose myOldGoal
 
bool myPrinting
 
double mySpeed
 
double mySpeedToTurnAt
 
State myState
 
double myTurnAmount
 
bool myTurnedBack
 
- 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

This action goes to a given ArPose very naively.

This action naively drives straight towards a given ArPose. the action stops when it gets to be a certain distance (closeDist) from the goal pose. It travels at the given speed (mm/sec).

You can give it a new goal with setGoal(), clear the current goal with cancelGoal(), and see if it got there with haveAchievedGoal(). Once the goal is reached, this action stops requesting any action.

This doesn't avoid obstacles or anything, you could have an avoid routine at a higher priority to avoid on the way there... but for real and intelligent looking navigation you should use something like ARNL, or build on these actions.

Examples:
gotoActionExample.cpp.

Member Function Documentation

◆ cancelGoal()

void ArActionGoto::cancelGoal ( void  )

Cancels the goal; this action will stop requesting movement.

However, any currently requested motion (either previously requested by this action or by another action) will continue to be used. Use an ArActionStop action (activate it, or set it at a lower priority) to stop the robot.

Examples:
gotoActionExample.cpp.

◆ fire()

ArActionDesired * ArActionGoto::fire ( ArActionDesired  currentDesired)
virtual

Called by the action resover; request movement towards goal if we have one.

Parameters
currentDesiredCurrent desired action from the resolver

Implements ArAction.

◆ getDesired()

virtual ArActionDesired* ArActionGoto::getDesired ( void  )
inlinevirtual

Used by the action resolvel; return current desired action.

Reimplemented from ArAction.

◆ haveAchievedGoal()

bool ArActionGoto::haveAchievedGoal ( void  )

Sees if the goal has been achieved.

The goal is achieved when the robot's repordet position is within a certain distance (given in the constructor or in setCloseDist) from the goal pose.

Examples:
gotoActionExample.cpp.

The documentation for this class was generated from the following files: