/usr/include/Aria/ArRobotConnector.h is in libaria-dev 2.8.0+repack-1.2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | /*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009, 2010 MobileRobots Inc.
Copyright (C) 2011, 2012, 2013 Adept Technology
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you wish to redistribute ARIA under different terms, contact
Adept MobileRobots for information about a commercial version of ARIA at
robots@mobilerobots.com or
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
#ifndef ARROBOTCONNECTOR_H
#define ARROBOTCONNECTOR_H
#include "ariaTypedefs.h"
#include "ArSerialConnection.h"
#include "ArTcpConnection.h"
#include "ArArgumentBuilder.h"
#include "ArArgumentParser.h"
#include "ariaUtil.h"
class ArRobot;
class ArSonarConnector;
class ArBatteryConnector;
//class ArLCDConnector;
/** Connect to robot or simulator based on program command line parameters.
ArRobotConnector makes a robot connection either through a TCP
port (for the simulator or for robots with Ethernet-serial bridge
devices instead of onboard computers), or through a direct serial
port connection. Normally, it first attempts a TCP connection on
@a localhost port 8101, to use a simulator if running. If the simulator
is not running, then it normally then connects using the serial port
(the first serial port, COM1, by default). Various other connection
parameters are configurable through command-line arguments.
When you create your ArRobotConnector, pass it command line parameters via
either the argc and argv variables from main(), or pass it an
ArArgumentBuilder or ArArgumentParser object. (ArArgumentBuilder
is able to obtain command line parameters from a Windows program
that uses WinMain() instead of main()).
ArRobotConnector registers a callback with the global Aria class. Use
Aria::parseArgs() to parse all command line parameters to the program, and
Aria::logOptions() to print out information about all registered command-line parameters.
The following command-line arguments are checked:
@verbinclude ArRobotConnector_options
You can then prepare an ArRobot object for connection (with various connection
options configured via the command line parameters) and initiate the connection
attempt by that object by calling connectRobot().
After it's connected, you must then begin the robot processing cycle by calling
ArRobot::runAsync() or ArRobot::run().
@sa ArLaserConnector
@sa ArRobot
@since 2.7.0
@ingroup ImportantClasses
@ingroup DeviceClasses
**/
class ArRobotConnector
{
public:
/// Constructor that takes argument parser
AREXPORT ArRobotConnector(ArArgumentParser *parser, ArRobot *robot,
bool autoParseArgs = true, bool connectAllComponents = true);
/// Destructor
AREXPORT ~ArRobotConnector(void);
/// Sets up the given robot to be connected
AREXPORT bool setupRobot(void);
/// Sets up an arbitrary robot to be connected
AREXPORT bool setupRobot(ArRobot *robot);
/// Sets up the robot then connects it
AREXPORT bool connectRobot(void);
/// Sets up the robot then connects it
AREXPORT bool connectRobot(ArRobot *robot);
/// Function to parse the arguments given in the constructor
AREXPORT bool parseArgs(void);
/// Function to parse the arguments given in an arbitrary parser
AREXPORT bool parseArgs(ArArgumentParser *parser);
/// Log the options the simple connector has
AREXPORT void logOptions(void) const;
/// Gets the remote host, if one was used, or NULL if it wasn't
AREXPORT const char *getRemoteHost(void) const;
/// Gets if the remote connection is a sim
AREXPORT bool getRemoteIsSim(void) const;
/// Call for forcing the remote to be a sim (mostly for internal use)
AREXPORT void setRemoteIsSim(bool remoteIsSim);
/// Gets the robot this connector is using (mostly for backwards compatibility stuff)
AREXPORT ArRobot *getRobot(void);
protected:
// the robot we've set up (so we can find its params)
ArRobot *myRobot;
// if we're using the sim or not
bool myUsingSim;
// if we're connecting via tcp (not to the sim), what remote host
const char *myRemoteHost;
// robot port, if there isn't one this'll be NULL, which will just
// be the default of ArUtil::COM1
const char *myRobotPort;
// baud for the serial
int myRobotBaud;
// robot tcp port if we're doing a remote host (defaults to 8101)
int myRemoteRobotTcpPort;
// whether we're connecting to a remote sim or not (so we don't try
// to open a port for the laser)
bool myRemoteIsSim;
// force a sim to not look like a sim (for laser debugging mostly)
bool myRemoteIsNotSim;
// variables to hold if we're logging or not
bool myRobotLogPacketsReceived;
bool myRobotLogPacketsSent;
bool myRobotLogMovementReceived;
bool myRobotLogMovementSent;
bool myRobotLogVelocitiesReceived;
bool myRobotLogActions;
// if we're auto parsing the arguments when setupRobot or
// connectRobot are called
bool myAutoParseArgs;
// If we've parsed the args already or not
bool myHaveParsedArgs;
// If true, create additional connectors such as sonar, battery, lcd.
bool myConnectAllComponents;
// our parser
ArArgumentParser *myParser;
bool myOwnParser;
// a few device connections to use to connect to the robot
ArTcpConnection myRobotTcpConn;
ArSerialConnection myRobotSerConn;
ArRetFunctorC<bool, ArRobotConnector> myParseArgsCB;
ArConstFunctorC<ArRobotConnector> myLogOptionsCB;
// ArLCDConnector *myLCDConnector;
ArBatteryConnector *myBatteryConnector;
ArSonarConnector *mySonarConnector;
};
#endif
|