Aria: ArLaserConnector Class Reference

- Main Page
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ArLaserConnector Class Reference

`#include <ArLaserConnector.h>`

List of all members.

## Detailed Description

Connect to robot and laser based on run-time availablitily and command-line arguments.

ArLaserConnector makes a laser 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 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 ArLaserConnector, 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()). ArLaserConnector 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:

You can 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().

You can then configure ArLaserConnector for the SICK laser based on the robot connection, and command line parameters with setupLaser(). After calling setupLaser(), you must then run the laser processing thread (with ArLaser::runAsync() or ArLaser()run()) and then use ArLaserConnector::connectLaser() to connect with the laser if specifically requested on the command line using the -connectLaser option (or simply call ArLaser::blockingConnect() (or similar) to attempt a laser connection regardless of whether or not the -connectLaser option was given; use this latter technique if your program always prefers or requires use of the laser).

## Public Member Functions
bool | addLaser (ArLaser *laser, int laserNumber=1)
| Adds a laser so parsing will get it.
bool | addPlaceholderLaser (ArLaser *placeholderLaser, int laserNumber=1, bool takeOwnershipOfPlaceholder=false)
| Adds a laser for parsing but where connectLaser will be called later.
| ArLaserConnector (ArArgumentParser *parser, ArRobot *robot, ArRobotConnector *robotConnector, bool autoParseArgs=true, ArLog::LogLevel infoLogLevel=ArLog::Verbose)
| Constructor that takes argument parser.
bool | connectLaser (ArLaser *laser, int laserNumber=1, bool forceConnection=true)
| Connects the laser synchronously (will take up to a minute).
bool | connectLasers (bool continueOnFailedConnect=false, bool addConnectedLasersToRobot=true, bool addAllLasersToRobot=false, bool turnOnLasers=true, bool powerCycleLaserOnFailedConnect=true)
| Connects all the lasers the robot has that should be auto connected.
void | logOptions (void) const
| Log the options the simple connector has.
bool | parseArgs (ArArgumentParser *parser)
| Function to parse the arguments given in an arbitrary parser.
bool | parseArgs (void)
| Function to parse the arguments given in the constructor.
bool | setupLaser (ArLaser *laser, int laserNumber=1)
| Sets up a laser to be connected.
| ~ArLaserConnector (void)
| Destructor.
## Protected Member Functions
bool | internalConfigureLaser (LaserData *laserData)
void | logLaserOptions (LaserData *laserdata, bool header=true, bool metaOpts=true) const
| Logs the laser command line option help text.
bool | parseLaserArgs (ArArgumentParser *parser, LaserData *laserData)
| Parses the laser arguments.
## Protected Attributes
bool | myAutoParseArgs
ArLog::LogLevel | myInfoLogLevel
std::map< int, LaserData * > | myLasers
std::string | myLaserTypes
ArConstFunctorC< ArLaserConnector > | myLogOptionsCB
bool | myOwnParser
ArRetFunctorC< bool, ArLaserConnector > | myParseArgsCB
bool | myParsedArgs
ArArgumentParser * | myParser
ArRobot * | myRobot
ArRobotConnector * | myRobotConnector
## Classes
class | LaserData
| Class that holds information about the laser data. More...

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

- ArLaserConnector.h