Connects to GPS device over a serial port or other device connection and reads data. Supports GPS devices sending standard NMEA format data (specifically the GPRMC, GPGGA, GPGSA, GPGRME, and optionally GPGSV, PGRMZ, PGRME, and HCHDG/T/M messages). If your GPS device supports several data formats or modes, select NMEA output in its configuration.
For each piece of data provided by this class, there is a flag indicating whether it was received from the GPS and set. Not all GPS models return all kinds of information, or it may be disabled in some way in a GPS's internal configuration, or the GPS may not yet have started sending the data (e.g. still acquiring satellites). Also, not all data will be received by one call to read(), and especially immediately after connecting and starting to read data, it may take a few seconds for data to be obtained. Furthermore, it may take some time for the GPS to calculate data with full accuracy.
|
Public Types |
enum | { ReadFinished = ArNMEAParser::ParseFinished,
ReadError = ArNMEAParser::ParseError,
ReadData = ArNMEAParser::ParseData,
ReadUpdated = ArNMEAParser::ParseUpdated
} |
| Flags to indicates what the read() method did. i.e. If nothing was done, then the result will be 0. To check a read() return result result to see if data was updated, use (result & ReadUpdated). To check if there was an error, use (result & ReadError). More...
|
enum | FixType {
NoFix,
BadFix,
GPSFix,
DGPSFix,
PPSFix,
RTKinFix,
FloatRTKinFix,
DeadReckFix,
ManualFix,
SimulatedFix,
UnknownFixType,
OmnistarConverging = FloatRTKinFix,
OmnistarConverged = RTKinFix
} |
| Access the last received data from the GPS. More...
|
Public Member Functions |
void | addNMEAHandler (const char *message, ArNMEAParser::Handler *handler) |
bool | blockingConnect (unsigned long connectTimeout=10000) |
virtual bool | connect (unsigned long connectTimeout=10000) |
| Check that the device connection (e.g. serial port) is open, and that data is being received from GPS.
|
double | getAltimeter () const |
double | getAltitude () const |
| Calculated from GPS.
|
double | getAltitudeError () const |
| Standard deviation of altitude error, meters.
|
unsigned short | getBeaconChannel () const |
double | getBeaconFreq () const |
| kHz
|
double | getBeaconSignalStrength () const |
| dB
|
double | getBeaconSNR () const |
| dB
|
unsigned short | getBecaonBPS () const |
| bitrate (bits per second)
|
double | getCompassHeadingMag () const |
| Heading from magnetic north.
|
double | getCompassHeadingTrue () const |
| Heading from true north.
|
const ArGPS::Data & | getCurrentDataRef () const |
ArDeviceConnection * | getDeviceConnection () const |
| Return device connection in use (or NULL if none).
|
unsigned short | getDGPSStationID () const |
ArPose | getErrorEllipse () const |
FixType | getFixType () const |
const char * | getFixTypeName () const |
double | getGarminPositionError () const |
double | getGarminVerticalPositionError () const |
| GPS device's error estimation in meters.
|
ArTime | getGPSPositionTimestamp () const |
double | getHDOP () const |
double | getInputsRMS () const |
double | getLatitude () const |
double | getLatitudeError () const |
ArPose | getLatLonError () const |
double | getLongitude () const |
double | getLongitudeError () const |
double | getMeanSNR () const |
| dB
|
int | getNumSatellitesTracked () const |
double | getPDOP () const |
double | getSpeed () const |
ArTime | getTimeReceivedPosition () const |
double | getVDOP () const |
bool | haveAltimeter () const |
bool | haveAltitude () const |
| Calculated from GPS.
|
bool | haveAltitudeError () const |
bool | haveBeaconInfo () const |
bool | haveCompassHeadingMag () const |
| Have a compass heading value relative to magnetic north.
|
bool | haveCompassHeadingTrue () const |
| Have a compass heading value relative to true north (using device's configured declination).
|
bool | haveDGPSStation () const |
bool | haveErrorEllipse () const |
bool | haveGarminPositionError () const |
bool | haveGarminVerticalPositionError () const |
bool | haveHDOP () const |
bool | haveInputsRMS () const |
bool | haveLatitude () const |
bool | haveLatLonError () const |
bool | haveLongitude () const |
bool | havePDOP () const |
bool | havePosition () const |
bool | haveSNR () const |
bool | haveSpeed () const |
bool | haveVDOP () const |
void | lock () |
void | logData () const |
| Log last received data using ArLog.
|
void | printData (bool labels=true) const |
void | printDataLabelsHeader () const |
virtual int | read (unsigned long maxTime=0) |
| Read some data from the device connection, and update stored data as complete messages are received.
|
int | readWithLock (unsigned int maxTime) |
void | removeNMEAHandler (const char *message) |
void | setCompassHeadingMag (double val) |
void | setCompassHeadingMagWithLock (double val) |
void | setCompassHeadingTrue (double val) |
void | setCompassHeadingTrueWithLock (double val) |
void | setDeviceConnection (ArDeviceConnection *deviceConn) |
| Set device connection to use.
|
void | setIgnoreChecksum (bool ignore) |
| Set whether checksum sent with NMEA messages is ignored.
|
void | unlock () |
Static Public Member Functions |
static const char * | getFixTypeName (FixType type) |
Public Attributes |
enum ArGPS:: { ... } | ReadFlags |
| Flags to indicates what the read() method did. i.e. If nothing was done, then the result will be 0. To check a read() return result result to see if data was updated, use (result & ReadUpdated). To check if there was an error, use (result & ReadError).
|
Protected Member Functions |
void | handleGPGGA (ArNMEAParser::Message msg) |
void | handleGPGSA (ArNMEAParser::Message msg) |
void | handleGPGST (ArNMEAParser::Message msg) |
void | handleGPGSV (ArNMEAParser::Message msg) |
void | handleGPMSS (ArNMEAParser::Message msg) |
void | handleGPRMC (ArNMEAParser::Message msg) |
void | handleHCHDx (ArNMEAParser::Message msg) |
void | handlePGRME (ArNMEAParser::Message msg) |
void | handlePGRMZ (ArNMEAParser::Message msg) |
virtual bool | initDevice () |
void | parseGPRMC (const ArNMEAParser::Message &msg, double &latitudeResult, double &longitudeResult, bool &qualityFlagResult, bool &gotPosition, ArTime &timeGotPositionResult, ArTime &gpsTimestampResult, bool &gotSpeedResult, double &speedResult) |
bool | readFloatFromString (std::string &str, double *target, double(*convf)(double)=NULL) const |
bool | readFloatFromStringVec (std::vector< std::string > *vec, size_t i, double *target, double(*convf)(double)=NULL) const |
bool | readTimeFromString (const std::string &s, ArTime *time) const |
bool | readUShortFromString (std::string &str, unsigned short *target, unsigned short(*convf)(unsigned short)=NULL) const |
bool | readUShortFromStringVec (std::vector< std::string > *vec, size_t i, unsigned short *target, unsigned short(*convf)(unsigned short)=NULL) const |
bool | waitForData (unsigned long timeout) |
Static Protected Member Functions |
static double | feetToMeters (double f) |
static double | gpsDegminToDegrees (double degmin) |
static double | knotsToMPS (double knots) |
static double | metersToFeet (double m) |
static double | mpsToMph (double mps) |
Protected Attributes |
ArArgumentParser * | myArgParser |
bool | myCreatedOwnDeviceCon |
Data | myData |
ArDeviceConnection * | myDevice |
ArFunctor1C< ArGPS, ArNMEAParser::Message > | myGPGGAHandler |
ArFunctor1C< ArGPS, ArNMEAParser::Message > | myGPGSAHandler |
ArFunctor1C< ArGPS, ArNMEAParser::Message > | myGPGSTHandler |
ArFunctor1C< ArGPS, ArNMEAParser::Message > | myGPGSVHandler |
ArFunctor1C< ArGPS, ArNMEAParser::Message > | myGPMSSHandler |
ArFunctor1C< ArGPS, ArNMEAParser::Message > | myGPRMCHandler |
ArFunctor1C< ArGPS, ArNMEAParser::Message > | myHCHDxHandler |
ArMutex | myMutex |
ArNMEAParser | myNMEAParser |
ArRetFunctorC< bool, ArGPS > | myParseArgsCallback |
ArFunctor1C< ArGPS, ArNMEAParser::Message > | myPGRMEHandler |
ArFunctor1C< ArGPS, ArNMEAParser::Message > | myPGRMZHandler |
unsigned short | mySNRNum |
unsigned int | mySNRSum |