Aria  2.8.0
ArActionJoydrive Class Reference

This action will use the joystick for input to drive the robot. More...

#include <ArActionJoydrive.h>

Inherits ArAction.

Public Member Functions

 ArActionJoydrive (const char *name="joydrive", double transVelMax=400, double turnAmountMax=15, bool stopIfNoButtonPressed=true, bool useOSCalForJoystick=true)
 Constructor. More...
 
virtual ArActionDesiredfire (ArActionDesired currentDesired)
 
virtual ArActionDesiredgetDesired (void)
 
virtual const ArActionDesiredgetDesired (void) const
 
ArJoyHandlergetJoyHandler (void)
 Gets the joyHandler.
 
bool getStopIfNoButtonPressed (void)
 Get if we'll stop if no button is pressed, otherwise just do nothing.
 
bool getUseOSCal (void)
 Gets whether OSCalibration is being used for the joystick or not. More...
 
bool joystickInited (void)
 Whether the joystick is initalized or not.
 
void setSpeeds (double transVelMax, double turnAmountMax)
 Set Speeds.
 
void setStopIfNoButtonPressed (bool stopIfNoButtonPressed)
 Set if we'll stop if no button is pressed, otherwise just do nothing.
 
void setThrottleParams (double lowSpeed, double highSpeed)
 Sets the params on the throttle (throttle unused unless you call this)
 
void setUseOSCal (bool useOSCal)
 Sets whether to use OSCalibration the joystick or not. More...
 
virtual ~ArActionJoydrive ()
 Destructor.
 
- 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 Attributes

ArActionDesired myDesired
 
double myHighThrottle
 
ArJoyHandlermyJoyHandler
 
double myLowThrottle
 
bool myPreviousUseOSCal
 
bool myStopIfNoButtonPressed
 
double myTransVelMax
 
double myTurnAmountMax
 
bool myUseOSCal
 
bool myUseThrottle
 
- 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 will use the joystick for input to drive the robot.

This class creates its own ArJoyHandler to get input from the joystick. Then it will scale the speed between 0 and the given max for velocity and turning, up and down on the joystick go forwards/backwards while right and left go right and left. You must press in one of the two joystick buttons for the class to pay attention to the joystick.

Note
The joystick does not save calibration information, so you must calibrate the joystick before each time you use it. To do this, press the button for at least a half a second while the joystick is in the middle. Then let go of the button and hold the joystick in the upper left for at least a half second and then in the lower right corner for at least a half second.
Examples:
actionGroupExample.cpp, gpsRobotTaskExample.cpp, gripperExample.cpp, gyroExample.cpp, and teleopActionsExample.cpp.

Constructor & Destructor Documentation

◆ ArActionJoydrive()

ArActionJoydrive::ArActionJoydrive ( const char *  name = "joydrive",
double  transVelMax = 400,
double  turnAmountMax = 15,
bool  stopIfNoButtonPressed = true,
bool  useOSCalForJoystick = true 
)

Constructor.

This action is for driving around the robot with a joystick, you must hold in a button on the joystick and then lean the joytsick over to have it drive.

You may need to calibrate the joystick for it to work right, for details about this see ArJoyHandler. If the Aria static class already has a joyhandler this class will use that otherwise it'll make and initialize one and use that (setting it in the Aria class)

Parameters
namethe name of this action
transVelMaxthe maximum velocity the joydrive action will go, it reachs this when the joystick is all the way forwards
turnAmountMaxthe maximum amount the joydrive action will turn, it reachs this when the joystick is all the way forwards
stopIfNoButtonPressedif this is true and there is a joystick and no button is pressed, the action will have the robot stop... otherwise it'll do nothing (letting lower priority actions fire)
useOSCalForJoystickIf true, then the existing OS calibration for the joystick will be used, otherwise our own autocalibration will be used. Default is true.
See also
ArJoyHandler::setUseOSCal()

Member Function Documentation

◆ getUseOSCal()

bool ArActionJoydrive::getUseOSCal ( void  )

Gets whether OSCalibration is being used for the joystick or not.

See also
ArJoyHandler::getUseOSCal

◆ setUseOSCal()

void ArActionJoydrive::setUseOSCal ( bool  useOSCal)

Sets whether to use OSCalibration the joystick or not.

See also
ArJoyHandler::setUseOSCal

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