Aria
2.8.0
|
Legacy connector for robot and laser. More...
#include <ArSimpleConnector.h>
Public Member Functions | |
ArSimpleConnector (int *argc, char **argv) | |
Constructor that takes args from the main. | |
ArSimpleConnector (ArArgumentBuilder *arguments) | |
Constructor that takes argument builder. More... | |
ArSimpleConnector (ArArgumentParser *parser) | |
Constructor that takes argument parser. More... | |
bool | connectLaser (ArSick *laser) |
Connects the laser synchronously (will take up to a minute) More... | |
bool | connectLaserArbitrary (ArSick *laser, int laserNumber) |
Connects the laser synchronously (make sure you setMaxNumLasers) | |
bool | connectRobot (ArRobot *robot) |
Sets up the robot then connects it. More... | |
bool | connectSecondLaser (ArSick *laser) |
Connects the laser synchronously (will take up to a minute) More... | |
void | logOptions (void) const |
Log the options the simple connector has. | |
bool | parseArgs (void) |
Function to parse the arguments given in the constructor. | |
bool | parseArgs (ArArgumentParser *parser) |
Function to parse the arguments given in an arbitrary parser. More... | |
void | setMaxNumLasers (int maxNumLasers=1) |
Sets the number of possible lasers. | |
bool | setupLaser (ArSick *laser) |
Sets up the laser to be connected. More... | |
bool | setupLaserArbitrary (ArSick *laser, int laserNumber) |
Sets up a laser t obe connected (make sure you setMaxNumLasers) | |
bool | setupRobot (ArRobot *robot) |
Sets up the robot to be connected. More... | |
bool | setupSecondLaser (ArSick *laser) |
Sets up a second laser to be connected. More... | |
~ArSimpleConnector (void) | |
Destructor. | |
Protected Member Functions | |
void | finishConstructor (void) |
Finishes the stuff the constructor needs to do. | |
Protected Attributes | |
ArLaserConnector * | myLaserConnector |
bool | myOwnParser |
ArArgumentParser * | myParser |
ArRobotConnector * | myRobotConnector |
Legacy connector for robot and laser.
This is deprecated but is left in for compatibility with old code, Instead use ArRobotConnector to set up ArRobot's connection to the robot, and ArLaserConnector to set up connections with laser rangefinder devices.
ArSimpleConnector::ArSimpleConnector | ( | ArArgumentBuilder * | builder | ) |
Constructor that takes argument builder.
ArSimpleConnector::ArSimpleConnector | ( | ArArgumentParser * | parser | ) |
Constructor that takes argument parser.
bool ArSimpleConnector::connectLaser | ( | ArSick * | laser | ) |
Connects the laser synchronously (will take up to a minute)
This will setup and connect the laser if the command line switch was given to do so or simply return true if no connection was wanted.
bool ArSimpleConnector::connectRobot | ( | ArRobot * | robot | ) |
Sets up the robot then connects it.
Prepares the given ArRobot object for connection, then begins a blocking connection attempt.
If you wish to simply prepare the ArRobot object, but not begin the connection, then use setupRobot().
bool ArSimpleConnector::connectSecondLaser | ( | ArSick * | laser | ) |
Connects the laser synchronously (will take up to a minute)
This will setup and connect the laser if the command line switch was given to do so or simply return true if no connection was requested.
bool ArSimpleConnector::parseArgs | ( | ArArgumentParser * | parser | ) |
Function to parse the arguments given in an arbitrary parser.
Parse command line arguments held by the given ArArgumentParser.
The following arguments are used for the robot connection:
-robotPort
port -rp
port Use the given serial port device name for a serial port connection (e.g. COM1
, or /dev/ttyS0
if on Linux.) The default is the first serial port, or COM1, which is the typical Pioneer setup.
-remoteHost
hostname -rh
hostname Use a TCP connection to a remote computer with the given network host name instead of a serial port connection
-remoteRobotTcpPort
port -rrtp
port Use the given TCP port number if connecting to a remote robot using TCP due to -remoteHost
having been given.
-remoteIsSim
-ris
The remote TCP robot given by -remoteHost
or -rh
is actually a simulator. Use any alternative behavior intended for the simulator (e.g. tell the laser device object to request laser data from the simulator rather than trying to connect to a real laser device on the local computer)
-robotBaud
baudrate -rb
baudrate The following arguments are accepted for laser connections. A program may request support for more than one laser using setMaxNumLasers(); if multi-laser support is enabled in this way, then these arguments must have the laser index number appended. For example, "-laserPort" for laser 1 would instead by "-laserPort1", and for laser 2 it would be "-laserPort2".
Use the given port device name when connecting to a laser. For example, COM2
or on Linux, /dev/ttyS1
. The default laser port is COM2, which is the typical Pioneer laser port setup.
If true
, then the laser is mounted upside-down on the robot and the ordering of readings should be reversed.
Explicitly request that the client program connect to a laser, if it does not always do so
If true
, then the laser is powered on when the serial port is initially opened, so enable certain features when connecting such as a waiting period as the laser initializes.
Indicate the size of the laser field of view, either 180
(default) or 100
.
Configures the laser's angular resolution. If one
, then configure the laser to take a reading every degree. If half
, then configure it for a reading every 1/2 degrees.
Configures the laser's range resolution. May be 1mm for one milimiter, 1cm for ten milimeters, or 10cm for one hundred milimeters.
bool ArSimpleConnector::setupLaser | ( | ArSick * | laser | ) |
Sets up the laser to be connected.
Description of the logic for connection to the laser: If –remoteHost then the laser will a tcp connection will be opened to that remoteHost at port 8102 or –remoteLaserTcpPort if that argument is given, if this connection fails then the setup fails.
If –remoteHost wasn't provided and the robot connected to a simulator as described elsewhere then the laser is just configured to be simulated, if the robot isn't connected to a simulator it tries to open a serial connection to ArUtil::COM3 or –laserPort if that argument is given.
bool ArSimpleConnector::setupRobot | ( | ArRobot * | robot | ) |
Sets up the robot to be connected.
This method is normally used internally by connectRobot(), but you may use it if you wish.
If -remoteHost was given, then open that TCP port. If it was not given, then try to open a TCP port to the simulator on localhost. If that fails, then use a local serial port connection. Sets the given ArRobot's device connection pointer to this object. Sets up internal settings determined by command line arguments such as serial port and baud rate, etc.
After calling this function (and it returns true), then you may connect ArRobot to the robot using ArRobot::blockingConnect() (or similar).
bool ArSimpleConnector::setupSecondLaser | ( | ArSick * | laser | ) |
Sets up a second laser to be connected.
Description of the logic for connecting to a second laser: Given the fact that there are no parameters for the location of a second laser, the laser's port must be passed in to ArSimpleConnector from the main or from ArArgumentBuilder.
Similarly, a tcp connection must be explicitly defined with the –remoteLaserTcpPort2 argument.