[Twisted-Python] An alternative Twisted GPS protocol implementation

Laurens Van Houtven lvh at laurensvh.be
Sun Jul 19 13:37:19 MDT 2009


Hi everyone :-)


I'm writing a GPS-based app and I was kind of unhappy with the
existing GPS implementation. It probably works, but it has two
problems that you might care about if you're using it:

1. it's interface isn't very friendly
(twisted.protocols.gps.nmea.NMEAReceiver.decode_fix has _fourteen_
positional arguments, which are essentially raw sentence data -- this
reminds me of MFC too much for me to stay in my comfort zone)
2. it doesn't seem to have any unit tests, so behavior is up in the air a little

Also, if you want to to extend it (admittedly not very likely with a
rusty protocol like NMEA), well, the current implementation is kind of
terse.

Anyway, I've been working on a friendlier interface for a few days
now, and if people like it, it might be a candidate for inclusion in
Twisted itself. This would mean deprecating twisted.protocols.gps in
favor of the shiny new twisted.protocols.positioning. I was originally
going to make it a Twisted community project, but glyph expressed
interest in putting it in Twisted itself instead.

It does nice conversions like parse the timestamps into Python
time/date/datetime objects and automatically adding sign information
for coordinates, stuff like that. Also, it provides a much nicer
interface to the information, so you can use code like:

point.position.latitude
point.position.longitude.inDegreesMinutesSeconds
point.altitude
point.altitude.aboveMeanSeaLevel.inFeet
point.heading.trueHeading

Et cetera. Use of this interface is optional, there's also straight
dict access (which is roughly like the current API except with a
dictionary instead of positional arguments).

Right now it only supports NMEA. The old system supported Rockwell as
well. What I'd like to hear from you (you mostly being potential users
of this piece of code): do you care about Rockwell (aka Zodiac)
support? If you're just using twisted.protocols.gps now, I'm
interested in hearing from you as well of course :-)

SiRF support for now is probably out of the question. It's a whole
different ball game. Parsing it is *hard* (it's much more complicated
than just a binary representation of the same data).

Replies welcome, alternatively you can usually catch me at this email
address or as lvh on freenode (in the usual suspects: #python,
#twisted...)

Thanks for-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Use GnuPG with Firefox : http://getfiregpg.org (Version: 0.7.6)

iEYEARECAAYFAkpjdcMACgkQT5v5zGkvKT5EpwCeLhrOe1tHXuJQKc78jAQ+ALQA
s5IAn3vn5kVEZ++eUGuRb3zsxynQPCR4
=7Cyx
-----END PGP SIGNATURE-----
reading,
Laurens




More information about the Twisted-Python mailing list