Software Gpsd

GPSd - The GPS Daemon

Software Homepage: http://gpsd.berlios.de/

GPSd is a service daemon that monitors one or more GPSes attached to a host computer through serial or USB ports, making all data on the location/course/velocity of the sensors available to be queried on TCP port 2947 of the host computer. With GPSd, multiple GPS client applications (such as navigational and wardriving software) can share access to GPSes without contention or loss of data. Also, GPSd responds to queries with a format that is substantially easier to parse than the NMEA 0183 emitted by most GPSes. The GPSd distribution includes a linkable C service library, a C++ wrapper class, and a Python module that developers of gpsd-aware applications can use to encapsulate all communication with GPSd.

The UI Rise project needs to collect GPS data, and the GPSd software simplifies this by providing a consistent way for many different applications to access that data. For example, our RoadNav software is configured to connect to the GPSd server to collect data on the position of our vehicles. Our data collection script uses a PERL library that interfaces with GPSd to collect data.

Since GPSd is so important, it is configured to automatically start with the router. End users will not need to play with GPSd since everything is self-contained. The rest of this page is for use by developers in the UI Rise project.

For UI VAST Developers

Use with NTP

gpsd can provide reference clock information to ntpd, to keep the system clock synchronized to the time provided by the GPS receiver. This facility is only available when the daemon is started from root. If you're going to use gpsd you probably want to run it -n mode so the clock will be updated even when no clients are active.

Unfortunately we were not able to get NTPd working with GPSd as a time source. Instead we have a script that periodically connects to GPSd and listens for time data. It then takes this and sets the system time with it. It is likely to have errors of about 1-2 seconds when setting the clock, but it should work well enough for our project. By setting the clock every 2 minutes or so with this script, we should be able to maintain stable time keeping. There may be tests in the future to determine timing offsets and drifts under various conditions.

Another problem has arisen from being unable to use GPSd as a time source. Despite having a script that can pull the time from the GPS data, it is not considered a valid time source for most NTP clients/servers which require such functionality to happen inside of that NTP client/server. As a result, the NTP Stratum (distance from a time source) is high and Windows refuses to sync time from the server. We need to find another solution to this to enable all network clients to have the correct, or at least same, time settings.

GPSd Commands:

It is possible to open a TCP/IP connection to GPSd with an application such as Telnet and issue commands and receive a response. Below are some useful commands to use while connected to GPSd. These were found while the WRT54G was connected to Magellan GPS.

  • I , B GPS interface information
    • GPSD,I=Generic NMEA
    • GPSD,B=9600 8 N 1
  • D Date/Time of last position update
    • GPSD,D=2007-09-12T01:15:01.44Z
  • P Last known position
    • GPSD,P=46.726385 -117.007707
  • O Output a line (see sample data format, not comma deliminated)
    • GPSD,O=GSV 1189560076.43 0.005 46.726402 -117.007717 ? 65.60 0.00 0.0000 0.000 ? ? ? ?
  • R Toggles Readout (?) variable. Basically floods the screen with the following data (unknown format):

GPSD,R=1
$PMGNST,05.40,3,T,738,10.0,-00913,00*42
$GPGLL,4643.5848,N,11700.4640,W,012436.466,A*25
$GPGGA,012436.47,4643.5848,N,11700.4640,W,1,05,5.6,00806,M,,,,*3F
$GPRMC,012436.47,A,4643.5848,N,11700.4640,W,00.0,000.0,120907,16,E*5A
$GPGSA,A,3,17,20,04,28,02,,,,,,,,07.2,05.6,04.4*0C
$GPGSV,3,1,10,04,64,108,47,12,49,303,,02,48,181,36,09,47,238,*78
$GPGSV,3,2,10,17,30,068,54,05,28,303,,30,11,303,,20,10,038,49*7A
$GPGSV,3,3,10,14,06,318,,28,03,121,36,122,31,213,,135,34,202,*7C
$PMGNST,05.40,3,T,738,10.0,-00913,00*42
$GPGLL,4643.5848,N,11700.4640,W,012437.440,A*20
$GPGGA,012437.44,4643.5848,N,11700.4640,W,1,05,5.7,00806,M,,,,*3C
$GPRMC,012437.44,A,4643.5848,N,11700.4640,W,00.0,000.0,120907,16,E*58
$GPGSA,A,3,17,20,04,28,02,,,,,,,,07.2,05.7,04.5*0C
$GPGSV,3,1,10,04,64,108,47,12,49,303,,02,48,181,36,09,47,238,*78
$GPGSV,3,2,10,17,30,068,54,05,28,303,,30,11,303,,20,10,038,49*7A
$GPGSV,3,3,10,14,06,318,,28,03,121,36,122,31,213,,135,34,202,*7C

GPSd can be called on the router with:

root@red:/# gpsd -N -S 2947 /dev/tts/1

Sample Data:

More GPSd information can be found at the following link: