General purpose testing and demo program, using ArMode classes to provide keyboard control of various robot functions.demo uses ArMode subclasses from ARIA. These modes provide keyboard control of various aspects and accessories of the robot, and can be re-used in your programs if you wish.
The ArMode classes are defined in ArModes.cpp.
"demo" is a useful program for testing out the operation of the robot for diagnostic or demonstration purposes. Other example programs focus on individual areas.
#include "Aria.h"
int main(int argc, char** argv)
{
{
{
ArLog::log(
ArLog::Terse,
"Could not connect to robot, will not have parameter file so options displayed later may not include everything");
}
else
{
}
}
{
}
{
return 1;
}
printf("You may press escape to exit\n");
false,
false,
true
))
{
printf("Could not connect to lasers... exiting\n");
}
ArTCM2 *compass = compassConnector.
create(&robot);
compass = NULL;
}
else
ArModeTCM2 tcm2(&robot,
"tcm2",
'm',
'M', compass);
ArModeIO io(&robot, "io", 'i', 'I');
ArModeCommand command(&robot, "command", 'd', 'D');
ArModePosition position(&robot, "position", 'p', 'P', &gyro);
ArModeBumps bumps(&robot, "bumps", 'b', 'B');
ArModeLaser laser(&robot, "laser", 'l', 'L');
return 0;
}
bool connectRobot(void)
Sets up the robot then connects it.
Definition: ArRobotConnector.cpp:405
Mode for requesting config packet.
Definition: ArModes.h:492
Use this class to create an instance of a TCM2 subclass and connect to the device based on program co...
Definition: ArTCM2.h:228
virtual void activate(void)
Activates all the actions in this group.
Definition: ArActionGroup.cpp:84
Mode for displaying the sonar.
Definition: ArModes.h:245
const ArRobotConfigPacketReader * getOrigRobotConfig(void) const
Gets the original robot config packet information.
Definition: ArRobot.cpp:2592
void loadDefaultArguments(int positon=1)
Adds args from default files and environmental variables.
Definition: ArArgumentParser.cpp:736
Perform actions when keyboard keys are pressed.
Definition: ArKeyHandler.h:65
Use onboard gyro to improve the heading in an ArRobot object's pose value.
Definition: ArAnalogGyro.h:95
@ Terse
Use terse logging.
Definition: ArLog.h:61
virtual bool blockingConnect(unsigned long connectTimeout=5000)
If a connection/initialization procedure is required, perform it, wait until data is recieved from th...
Definition: ArTCM2.cpp:64
Mode for following a color blob using ACTS.
Definition: ArModes.h:385
Interface to the PNI TCM 2, TCM 2.5, and TCM 2.6 3-axis compass (magnetometer) that can sense absolut...
Definition: ArTCM2.h:63
bool getHasGripper(void) const
Gets the gripper value (whether or not the robot has a gripper)
Definition: ArRobotConfigPacketReader.h:88
bool comInt(unsigned char command, short int argument)
Sends a command to the robot with an int for argument.
Definition: ArRobot.cpp:5634
Connect to robot or simulator based on program command line parameters.
Definition: ArRobotConnector.h:80
bool isConnected(void) const
Questions whether the robot is connected or not.
Definition: ArRobot.h:133
static void setKeyHandler(ArKeyHandler *keyHandler)
Sets the key handler, so that other classes can find it using getKeyHandler()
Definition: Aria.cpp:624
void addRangeDevice(ArRangeDevice *device)
Adds a rangeDevice to the robot's list of them, and set the ArRangeDevice object's robot pointer to t...
Definition: ArRobot.cpp:5757
static void exit(int exitCode=0)
Shutdown all Aria processes/threads, call exit callbacks, and exit the program.
Definition: Aria.cpp:367
static void log(LogLevel level, const char *str,...)
Log a message, with formatting and variable number of arguments.
Definition: ArLog.cpp:93
Mode for following a color blob using ACTS.
Definition: ArModes.h:462
Create laser interface objects (for any kind of laser supported by ARIA) and connect to lasers based ...
Definition: ArLaserConnector.h:80
static void init(SigHandleMethod method=SIGHANDLE_THREAD, bool initSockets=true, bool sigHandleExitNotShutdown=true)
Initialize Aria global data struture and perform OS-specific initialization, including adding OS sign...
Definition: Aria.cpp:128
bool checkHelpAndWarnUnparsed(unsigned int numArgsOkay=0)
Checks for the help strings and warns about unparsed arguments.
Definition: ArArgumentParser.cpp:843
Central class for communicating with and operating the robot.
Definition: ArRobot.h:82
Parse and store program command-line arguments for use by other ARIA classes.
Definition: ArArgumentParser.h:64
static void logOptions(void)
Logs all the options for the program (Calls all the callbacks added with addLogOptionsCB())
Definition: Aria.cpp:794
Mode for wandering around.
Definition: ArModes.h:84
Keep track of recent sonar readings from a robot as an ArRangeDevice.
Definition: ArSonarDevice.h:51
Mode for teleoping the robot with joystick + keyboard.
Definition: ArModes.h:46
void runAsync(bool stopRunIfNotConnected, bool runNonThreadedPacketReader=false)
Starts the instance to do processing in its own new thread.
Definition: ArRobot.cpp:301
int unlock()
Unlock the robot instance.
Definition: ArRobot.h:1272
Mode for controlling the gripper.
Definition: ArModes.h:100
static bool parseArgs(void)
Parses the arguments for the program (calls all the callbacks added with addParseArgsCB())
Definition: Aria.cpp:759
static void sleep(unsigned int ms)
Sleep for the given number of milliseconds.
Definition: ariaUtil.cpp:151
bool connectLasers(bool continueOnFailedConnect=false, bool addConnectedLasersToRobot=true, bool addAllLasersToRobot=false, bool turnOnLasers=true, bool powerCycleLaserOnFailedConnect=true, int *failedOnLaser=NULL)
Connects all the lasers the robot has that should be auto connected.
Definition: ArLaserConnector.cpp:1213
Mode for teleoping the robot with joystick + keyboard.
Definition: ArModes.h:65
@ Normal
Use normal logging.
Definition: ArLog.h:62
Mode for controlling the camera.
Definition: ArModes.h:139
int lock()
Lock the robot instance.
Definition: ArRobot.h:1268
void attachKeyHandler(ArKeyHandler *keyHandler, bool exitOnEscape=true, bool useExitNotShutdown=true)
Attachs a key handler.
Definition: ArRobot.cpp:6641
@ ENABLE
int, enable (1) or disable (0) motors
Definition: ArCommands.h:43
WaitState waitForRunExit(unsigned int msecs=0)
Suspend calling thread until the ArRobot run loop has exited.
Definition: ArRobot.cpp:2923