Gypsy

From Wildsong
Jump to navigationJump to search


"Gypsy" is a D-Bus based daemon that listens to GPS receivers and makes their data available to applications.

This page contains notes on getting gypsy going; the program looks like it might be useful but its docs are sparse. (What else is new?)

One alternative is gpsd but I've already tried it and found it wanting. Gypsy looks like it leverages the D-Bus and has a small footprint. It's small enough that I think I can understand and extend it without a lot of pounding my head on the wall.

Also I am interesting in D-Bus and thought I might learn more by examining gypsy.

Getting started

Build and install

I downloaded the sources from the svn server. I did not have any problems getting gypsy to build on an Ubuntu 8.04 system.

The "make install" step puts files into /usr/local; the daemon goes into "/usr/local/libexec/gypsy-daemon".

Permissions

The daemon will silently fail unless you give it permissions via the dbus system. The "make install" step puts a copy of the file Gypsy.conf in /usr/local/etc/dbus-1/system.d where no one will ever look at it.

cd /etc/dbus-1/system.d
ln -s /usr/local/etc/dbus-1/system.d/Gypsy.conf 

D-Bus integration

cd /usr/share/dbus-1/services
ln -s /usr/local/share/dbus-1/services/org.freedesktop.Gypsy.service 

Startup

There is a sample startup script in examples, but it was broken. I created one using avahi-daemon as a sample. Finally restarted dbus which in turn starts gypsy for me.

/etc/init,d/dbus restart

Testing

There is a sample client in the src/ directory but I can't see anyway to build it. There are also clients in the examples/ directory.

I tested the connection with the simple-gps-gypsy client program.

./simple-gps-gypsy /dev/ttyACM0

1226369112: 44.545395, -123.262840 (75.800003m)
1226369113: 0.009000, -1.000000, -1.000000m/s
1226369113: 0.009000, -1.000000, -0.100006m/s
1226369113: 44.545395, -123.262840 (75.699997m)
1226369114: 0.005000, -1.000000, -0.100006m/s
1226369115: 44.545399, -123.262840 (75.699997m)
1226369115: 0.004000, -1.000000, -0.100006m/s

The way the clients work is by subscribing to events from the server; in this case, the events are "position changed" and "course changed" messages. My GPS antenna is on a shelf in my office right now so it's not exciting but it does let me know that gypsy is working.

As a further test I can run a second copy of the sample program in a separate window and confirm it's able to get updates at the same time. Swell!

I can also use the generic 'dbus-monitor' command like this:

% dbus-monitor --system "type='signal',sender='org.freedesktop.Gypsy',interface='org.freedesktop.Gypsy.Position'"
signal sender=:1.5 -> dest=(null destination) path=/org/freedesktop/Gypsy/ttyACM0; interface=org.freedesktop.Gypsy.Position; member=PositionChanged
  int32 7
  int32 1226383910
  double 44.5454
  double -123.263
  double 87.9


I was surprised that I did not have to tell the daemon how to listen to the GPS device(s). Instead the client tells it to start listening, passing in a device string (or bluetooth id). I guess this is okay -- with D-bus the assumption is that the client and server are running on the same machine. I would have expected more abstraction here.

On the other hand, this means that gypsy is not consuming CPU resources parsing NMEA data when no application is listening so perhaps it's a good thing.

What can I do with it?

GypsyControl -- connect to GPS, start parsing data

GypsyDevice -- get GPS status,

GypsyCourse -- bearing, speed, climb rate

GypsyPosition -- lat, lon, altitude

GypsySatellite -- satellites visible, in use, etc

Ideas for applying it

Ideas for extending it

GPS Simulator - pass a filename to Gypsy instead of a device name and (if the file contains NMEA data) gypsy will replay the data.

Garmin, UBlox and Trimble parsers

Raw NMEA data format - pass through the NMEA data directly to the client.

Serial port emulator client - pass the data to a ptty port so that program that can only listen on a serial port can still function.

GPS control - allow client to pass configuration changes through to the GPS receiver.

DGPS - allow connection of a DGPS data stream.

Resources

http://folks.o-hand.com/iain/gypsy/