GPS Class Reference

Interface with a GPS unit (tested with Garmin Geko 301) using NMEA 0183. More...

#include <Devices/GPS.H>

Inheritance diagram for GPS:
Inheritance graph
[legend]
Collaboration diagram for GPS:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GPS (OptionManager &mgr, const std::string &descrName="GPS", const std::string &tagName="GPS")
 Constructor.
void setListener (rutz::shared_ptr< GPSlistener > &listener)
 setup a listener that will be called each time new data is received
virtual ~GPS ()
 destructor
bool getData (GPSdata &data)
 Get current data from the GPS unit.
void run ()
 Running thread.

Protected Member Functions

void start2 ()
 get started
void stop1 ()
 This is called from within stop() before the subcomponents stop.

Protected Attributes

nub::soft_ref< SerialitsSerial
 get stopped

Detailed Description

Interface with a GPS unit (tested with Garmin Geko 301) using NMEA 0183.

This is a multi-threaded class which continuously polls the unit for data and updates an internal copy of a GPSdata struct. Users can get the most up-to-date data at any time using getData(), or can setup a GPSlistener that will be called each time new data is available. Note that communication with the GPS unit operates at 4800 bauds, so the actual rate of data refresh is quite low (2s) and querying for data more often than once every two seconds is useless.

The Geko 301 has a true compass and altimeter/barometer. These need to be queried separately from the standard GPS summary query. This driver achieves that.

The Geko 301 is stated to support the following NMEA 0183 sentences: GPGGA, GPGLL, GPGSA, GPGSV, GPRMB, GPRMC, GPTRE, GPVTG, GPWPL, GPBOD, PGRME, PGRMM, PGRMZ, PSLIB. Not all of the sentences may be used by this driver, however (in particular, waypoint functionality can be more easily achieved in the main C++ code than in the GPS unit).

Here is a typical sequence emitted by the Geko 301 when set in NMEA output mode:

$GPRMC,082158,A,3403.4155,N,11815.0936,W,0.0,13.9,211104,13.5,E,A*05 $GPRMB,A,,,,,,,,,,,,A,A*0B $GPGGA,082158,3403.4155,N,11815.0936,W,1,08,1.1,127.6,M,-31.8,M,,*7A $GPGSA,A,3,01,03,,14,15,18,19,21,22,,,,2.2,1.1,1.9*3B $GPGSV,3,1,10,01,27,216,36,03,40,254,41,09,19,058,00,14,75,207,39*7B $GPGSV,3,2,10,15,74,090,42,18,35,058,42,19,34,296,37,21,27,123,43*72 $GPGSV,3,3,10,22,60,020,35,25,02,184,00*72 $GPGLL,3403.4155,N,11815.0936,W,082158,A,A*52 $GPBOD,,T,,M,,*47 $PGRME,4.5,M,6.7,M,8.0,M*26 $PGRMZ,424,f*06 $HCHDG,92.6,,,13.5,E*23 $GPRTE,1,1,c,*37

Definition at line 138 of file GPS.H.


Constructor & Destructor Documentation

GPS::GPS ( OptionManager mgr,
const std::string descrName = "GPS",
const std::string tagName = "GPS" 
)

Constructor.

You can set which serial device to use by setting the ModelParameter GPSDevName

Definition at line 93 of file GPS.C.

References ModelComponent::addSubComponent(), and itsSerial.

GPS::~GPS (  )  [virtual]

destructor

Definition at line 114 of file GPS.C.


Member Function Documentation

bool GPS::getData ( GPSdata data  ) 

Get current data from the GPS unit.

returns true if returned data comes from a completed new GPS fix compared to last time we were called. Note that some of the data may still differ even if the return value is false, if we have partially received and parsed new data from a new fix.

Definition at line 136 of file GPS.C.

void GPS::run (  ) 
void GPS::setListener ( rutz::shared_ptr< GPSlistener > &  listener  ) 

setup a listener that will be called each time new data is received

Definition at line 110 of file GPS.C.

void GPS::start2 (  )  [protected, virtual]

get started

Reimplemented from ModelComponent.

Definition at line 120 of file GPS.C.

void GPS::stop1 (  )  [protected, virtual]

This is called from within stop() before the subcomponents stop.

Reimplemented from ModelComponent.

Definition at line 129 of file GPS.C.


Member Data Documentation

get stopped

our serial port

Definition at line 166 of file GPS.H.

Referenced by GPS(), and run().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:22:01 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3