/usr/include/Aria/ArPTZConnector.h is in libaria-dev 2.8.0+repack-1.2.
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 166 167 168 | /*
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 ARPTZCONNECTOR_H
#define ARPTZCONNECTOR_H
#include <string>
#include <vector>
#include "ariaTypedefs.h"
#include "ariaUtil.h"
#include "ArFunctor.h"
#include "ArRobotParams.h"
#include "ariaInternal.h"
class ArArgumentParser;
class ArPTZ;
class ArRobot;
/**
* @brief Factory for creating and configuring interfaces for pan/tilt units or camera
* pan/tilt/zoom control based on robot parameter file and command-line arguments.
*
* First, create an ArPTZConnector object before
* calling Aria::parseArgs(). After connecting to the robot, call
* Aria::parseArgs() to check arguments and parameters from the parameter
* file(s). Then, call connect() to connect to all configured and enabled PTZs. To get
* access to a PTZ objects, use getPTZ(int i) and getNumPTZs(), or getPTZs().
* ArPTZ provides an interface to functions that most PTZ implementations
* (ArPTZ subclasses) implement. Some PTZ implementations have additional
* features. Use those subclasse directly to use these additional features
* (use dynamic_cast to cast an ArPTZ pointer to a subclass pointer, if
* possible.)
*
* ArPTZConnector has built in support for all the PTZ types with support
* included in the ARIA library, and other libraries or programs may register
* new types as well. (For example, the ArVideo library contains support for
* additional camera PTZ types.)
*
* The following command-line arguments are checked:
* @verbinclude ArPTZConnector_options
*
* PTZs are 0-indexed internally in this class, however, argument names,
* parameter names and log messages displayed to users are 1-indexed.
@ingroup OptionalClasses
@ingroup DeviceClasses
@since 2.7.6
*/
class ArPTZConnector {
public:
/* @arg robot In some cases the robot connection is used to communicate with
* devices via auxilliary serial connections, so this robot interface is used.
* May be NULL. */
AREXPORT ArPTZConnector(ArArgumentParser* argParser, ArRobot *robot = NULL);
AREXPORT ~ArPTZConnector();
/** For each PTZ specified in program arguments, and in robot parameters with
* PTZAutoConnect set to true, create the
* appropriate PTZ object (based on type name) and connect to it.
@return false on first error, true if all PTZ connections were successful.
*/
AREXPORT bool connect();
/** @copydoc connect() */
bool connectPTZs() { return connect(); }
/** @return number of PTZ objects that were created and connected to. */
size_t getNumPTZs() const { return myConnectedPTZs.size(); }
/** @return a specific PTZ object that was connected by connect() or
* connectPTZs(), or NULL if none exists. These are 0-indexed. */
ArPTZ* getPTZ(size_t i = 0) const
{
if(i >= myConnectedPTZs.size()) return NULL;
return myConnectedPTZs[i];
}
/** @copydoc getPTZ(size_t) */
ArPTZ* findPTZ(size_t i) const { return getPTZ(i); }
/** @return list of connected PTZs.
0-indexed. Pointers in the vector may be NULL if no parameters or command
line arguments were given for them or that PTZ was disabled. These should be
skipped when iterating on this list and not accessed.
*/
std::vector<ArPTZ*> getPTZs() const {
return myConnectedPTZs;
}
/** Arguments passed to function are PTZ index, parameters, parser (may be
* null) and robot object (may be null) */
typedef ArRetFunctor4<ArPTZ*, size_t, ArPTZParams, ArArgumentParser*, ArRobot*> PTZCreateFunc;
typedef ArGlobalRetFunctor4<ArPTZ*, size_t, ArPTZParams, ArArgumentParser*, ArRobot*> GlobalPTZCreateFunc;
/** Register a new PTZ type. Aria::init() registers PTZ types built in to
* ARIA. ArVideo::init() registers new PTZ types implemented in the ArVideo
* library. You may also add any new PTZ types you create.
*/
AREXPORT static void registerPTZType(const std::string& typeName, ArPTZConnector::PTZCreateFunc* func);
/** Change limit on number of PTZ devices.
* You must call this
* before creating an ArPTZConnector, parsing command line arguments, connecting
* to a robot or loading a parameter file, or using ArPTZconnecor to connect to
* PTZ devices.
*/
void setMaxNumPTZs(size_t n)
{
Aria::setMaxNumPTZs(n);
}
size_t getMaxNumPTZs()
{
return Aria::getMaxNumPTZs();
}
/** Return robot that PTZs are or will be attached to (may be NULL) */
ArRobot *getRobot() { return myRobot; }
protected:
bool parseArgs();
bool parseArgs(ArArgumentParser *parser);
bool parseArgsFor(ArArgumentParser *parser, int which);
AREXPORT void logOptions() const;
void populateRobotParams(ArRobotParams *params);
ArArgumentParser *myArgParser;
ArRobot *myRobot;
ArRetFunctorC<bool, ArPTZConnector> myParseArgsCallback;
ArConstFunctorC<ArPTZConnector> myLogOptionsCallback;
static std::map< std::string, PTZCreateFunc* > ourPTZCreateFuncs;
ArFunctor1C<ArPTZConnector, ArRobotParams*> myPopulateRobotParamsCB;
std::vector<ArPTZParams> myParams; ///< copied from ArRobotParams (via myRobot), then in connect() parameters given from command line arguments (myArguments) are merged in.
std::vector<ArPTZParams> myArguments; ///< from program command-line options (via the parseArgs() callback called by Aria::parseArgs())
//std::vector<ArPTZParams> myConfiguredPTZs; ///< if connecting to a PTZ, its parameters are copied here from myParams and myArguments
//static size_t ourMaxNumPTZs;
std::vector<ArPTZ*> myConnectedPTZs; ///< ArPTZ objects created and initialized in connect().
};
#endif // ifdef ARPTZCONNECTOR_H
|