Aria
2.8.0
|
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. More...
#include <ArPTZConnector.h>
Public Types | |
typedef ArGlobalRetFunctor4< ArPTZ *, size_t, ArPTZParams, ArArgumentParser *, ArRobot * > | GlobalPTZCreateFunc |
typedef ArRetFunctor4< ArPTZ *, size_t, ArPTZParams, ArArgumentParser *, ArRobot * > | PTZCreateFunc |
Arguments passed to function are PTZ index, parameters, parser (may be null) and robot object (may be null) | |
Public Member Functions | |
ArPTZConnector (ArArgumentParser *argParser, ArRobot *robot=NULL) | |
bool | connect () |
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. More... | |
bool | connectPTZs () |
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. More... | |
ArPTZ * | findPTZ (size_t i) const |
size_t | getMaxNumPTZs () |
size_t | getNumPTZs () const |
ArPTZ * | getPTZ (size_t i=0) const |
std::vector< ArPTZ * > | getPTZs () const |
ArRobot * | getRobot () |
Return robot that PTZs are or will be attached to (may be NULL) | |
void | setMaxNumPTZs (size_t n) |
Change limit on number of PTZ devices. More... | |
~ArPTZConnector () | |
Static Public Member Functions | |
static void | registerPTZType (const std::string &typeName, ArPTZConnector::PTZCreateFunc *func) |
Register a new PTZ type. More... | |
Protected Member Functions | |
void | logOptions () const |
bool | parseArgs () |
bool | parseArgs (ArArgumentParser *parser) |
bool | parseArgsFor (ArArgumentParser *parser, int which) |
void | populateRobotParams (ArRobotParams *params) |
Protected Attributes | |
ArArgumentParser * | myArgParser |
std::vector< ArPTZParams > | myArguments |
from program command-line options (via the parseArgs() callback called by Aria::parseArgs()) | |
std::vector< ArPTZ * > | myConnectedPTZs |
ArPTZ objects created and initialized in connect(). | |
ArConstFunctorC< ArPTZConnector > | myLogOptionsCallback |
std::vector< ArPTZParams > | myParams |
copied from ArRobotParams (via myRobot), then in connect() parameters given from command line arguments (myArguments) are merged in. | |
ArRetFunctorC< bool, ArPTZConnector > | myParseArgsCallback |
ArFunctor1C< ArPTZConnector, ArRobotParams * > | myPopulateRobotParamsCB |
ArRobot * | myRobot |
Static Protected Attributes | |
static std::map< std::string, PTZCreateFunc *> | ourPTZCreateFuncs |
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:
Common PTU and Camera PTZ options: -ptzType <type> Select PTZ/PTU type. Required. Available types are: dpptu rvision sony vcc vcc4 vcc50i -ptzInverted <true|false> If true, reverse tilt and pan axes for cameras mounted upside down. Only one of the following sets of connection parameters may be given: For computer serial port connections: -ptzSerialPort <port> Serial port name. For Pioneer robot auxilliary serial port connections: -ptzRobotAuxSerialPort <1|2|3> Use specified Pioneer robot auxilliary serial port. For network connections: -ptzAddress <address> Network address or hostname for network connection. -ptzTcpPort <port> TCP port number for network connections. Parameters for multiple cameras/units may be given like: -ptz1Type, -ptz2Type, -ptz3Type, etc. Some PTZ/PTU types may accept additional type-specific options. Refer to option documentation text specific to those types.
PTZs are 0-indexed internally in this class, however, argument names, parameter names and log messages displayed to users are 1-indexed.
ArPTZConnector::~ArPTZConnector | ( | ) |
bool ArPTZConnector::connect | ( | ) |
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.
|
inline |
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.
|
inline |
|
inline |
|
inline |
|
inline |
|
static |
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.
|
inline |
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.