The boat needs to know where it is so it needs access to location information. Our yacht has a chartplotter and autopilot which produce NMEA data so when installed, the Raspberry Pi can read NMEA data via a serial port. However, for development and for other projects we need our own GPS data source.
Paul Mount''s blog was helpful in getting started but for my purposes, the gpsd suite, whilst a wonderful piece of work, is both overkill and trouble-making. gpsd is very smart and finds the most efficient way of communication with the receiver and so it switches to the SIRF binary mode. For simple position reading in Python, it is simple enough to use Python's serial module and decode the required sentences, but It is tricky to switch back to the factory setting of NMEA if gpsd has been run first.
I also got distracted by the BU-353 installation manual In fact, the receiver appears as a serial device for which the Raspberry PI already has a driver. So all that was necessary was to
For this receiver, the sentences are:
To use the position in the talking boat, I need to have a GPS object which contains the latest position (date/time, latitude, longitude and altitude) and velocity (course,speed) data. Almost all data is in the RMC sentence except altitude (which although not generally useful in a yacht is needed in other other applications, for example for correcting observed barometric pressure) and the number of satellites and HDOP (Horizontal Dilution of Precision) for accuracy so GGA sentences are needed as well.
You may have to install the python serial module if it hasn't been already installed sudo apt-get install python-serial
This basic script updates a Position object with a frequency of 1 Hz. In this test environment, the postion is printed but in the yacht application, the Position object is pickled so it is available to any process which needs location data.
Watching the ouput here in my study, the latitude and longitude accuracy is quite good but altitude varies considerably despite seeing at least 8 satellites.