Aria  2.8.0
ArGPSConnector Class Reference

Factory for creating GPS interface object (for any kind of GPS supported by ARIA) based on robot parameter file and command-line arguments. More...

#include <ArGPSConnector.h>

Public Types

enum  GPSType {
  Standard, Novatel, Trimble, Invalid,
  NovatelSPAN, Simulator
}
 Device type identifiers. More...
 

Public Member Functions

 ArGPSConnector (ArArgumentParser *argParser)
 
ArGPScreate (ArRobot *robot=NULL)
 Create a new GPS object (may be an ArGPS subclass based on device type) and a device connection for that GPS. More...
 
ArGPScreateGPS (ArRobot *robot=NULL)
 Create a new GPS object (may be an ArGPS subclass based on device type) and a device connection for that GPS. More...
 
GPSType getGPSType () const
 
bool parseArgs ()
 Gets command line arguments.
 

Protected Member Functions

GPSType deviceTypeFromString (const char *str)
 
void logOptions ()
 Log argument option information.
 

Protected Attributes

ArArgumentParsermyArgParser
 
int myBaud
 
ArDeviceConnectionmyDeviceCon
 
GPSType myDeviceType
 
ArFunctorC< ArGPSConnectormyLogArgsCallback
 
ArRetFunctorC< bool, ArGPSConnectormyParseArgsCallback
 
const char * myPort
 
const char * myTCPHost
 
int myTCPPort
 

Detailed Description

Factory for creating GPS interface object (for any kind of GPS supported by ARIA) based on robot parameter file and command-line arguments.

First, create an ArGPSConnector object before calling Aria::parseArgs(). After connecting to the robot, call Aria::parseArgs(). Then, call createGPS() to create the GPS object.

ArGPSConnector can connect to a Novatel GPS ("novatel" type), Trimble AgGPS ("trimble" type), or any GPS supporting the NMEA standard protocol ("standard" type), if that GPS does not need any special commands to initialize.

Note
The device connection object created by ArGPSConnector is destroyed when ArGPSConnector is destroyed. Therefore, you must not destroy an ArGPSConnector while its associated ArGPS is in use.

The following command-line arguments are checked:

GPS options:
-gpsType <standard|novatel|novatelspan|trimble|sim>	Select GPS device type (default: standard)
-gpsPort <gpsSerialPort>	Use the given serial port (default: /dev/ttyS1)
-gpsBaud <gpsSerialBaudRate>	Use the given serial Baud rate (default: 9600)
-remoteGpsTcpHost <host>	Use a TCP connection instead of serial, and connect to remote host <host>
-remoteGpsTcpPort <host>	Use the given port number for TCP connection, if using TCP. (default 8103)

Only one GPS device may be configured and connected to by this object.

Examples:
gpsExample.cpp, and gpsRobotTaskExample.cpp.

Member Enumeration Documentation

◆ GPSType

Device type identifiers.

Enumerator
Standard 

For a standard NMEA GPS device (no extra initialization or interpretation needed) accessible using ArGPS.

Novatel 

For a Novatel device accessible using ArNovatelGPS.

Trimble 

For a Trimble device accessible using ArTrimbleGPS.

Invalid 

Not set or invalid.

NovatelSPAN 

Novatel SPAN.

Since
Aria 2.7.2
Simulator 

Simulated (program must set dummy positions)

Since
Aria 2.7.6

Member Function Documentation

◆ create()

ArGPS* ArGPSConnector::create ( ArRobot robot = NULL)
inline

Create a new GPS object (may be an ArGPS subclass based on device type) and a device connection for that GPS.

Use ArGPS::blockingConnect() to open the connection.

Parameters
robotIf not NULL, obtain default values for GPS type, port and baud from this robot's parameters (given in parameter file), for any of these not set from command-line arguments in parseArgs().
Returns
NULL if there was an error creating a GPS object or an error creating and opening its device connection. Otherwise, return the new GPS object.

◆ createGPS()

ArGPS * ArGPSConnector::createGPS ( ArRobot robot = NULL)

Create a new GPS object (may be an ArGPS subclass based on device type) and a device connection for that GPS.

Use ArGPS::blockingConnect() to open the connection.

Parameters
robotIf not NULL, obtain default values for GPS type, port and baud from this robot's parameters (given in parameter file), for any of these not set from command-line arguments in parseArgs().
Returns
NULL if there was an error creating a GPS object or an error creating and opening its device connection. Otherwise, return the new GPS object.
Examples:
gpsExample.cpp, and gpsRobotTaskExample.cpp.

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