adafruit / Adafruit_CircuitPython_GPS

GPS parsing module for CircuitPython. Meant to parse NMEA data from serial GPS modules.
MIT License
75 stars 60 forks source link

Implement GSV and GSA parsing #54

Closed lesamouraipourpre closed 3 years ago

lesamouraipourpre commented 3 years ago

This PR aims to get GSA and GSV message parsing operational. This will hopefully close #51 and #52.

For the talkers #52: In the update() method the data_type is now split into: talker (first two characters) and sentence_type (remaining three characters) The talker is the source of the message. For now, I've only listed the GNSS sources, eg. GA (Galileo), GB (BeiDou) etc. NB: GN as a talker means the information is from more than one source. The sentence_type is the sentence type of the message. Eg. GLL (Geographic Position - Lat/Long), GSV (Satellites in View) etc. Separating these out makes it easier to add extra talkers and sentence_types later if needed.

For GSA and GSV #51: This has been reworked with the aim of handling messages from multiple sources, for example I receive sentences from GPS and GLONASS. Unlike some sentence_types, I've never received GN (multi-source information) messages for GSA and GSV, they are always from a single satellite network. The satellite information that is stored in the self.sats dictionary has been modified to have a key based on the source of the information, eg. GP17 for GPS satellite 17, GL78 for GLONNASS satellite etc. The value stored is now a 5-value tuple: (Key/Satellite ID, Elevation, Azimuth, SNR, Timestamp) The timestamp is the time.monotonic() that the information was received. This will be used to delete any entries which are older than 30 seconds.

Hardware tested: I have the Adafruit Mini GPS PA1010D - UART and I2C - STEMMA QT

Example Code: There is an example in examples/gps_satellitefix.py

This is listed as draft because it needs more testing, preferably with different GPS chips. I would appreciate if others are able to run this and see what breaks. Also, any feedback on whether the changes made are appropriate or need further work are greatly appreciated.

lesamouraipourpre commented 3 years ago

I've switched this from Draft as I have a list of further improvements that I intend to work on for GPS.

tannewt commented 3 years ago

What device did you test this code on? Was it running Blinka or CircuitPython? I see the example has f-strings and I want to makes sure this was tested on CircuitPython.

lesamouraipourpre commented 3 years ago

It as developed on a Raspberry Pi 3, but tested on a PyPortal Pynt and an Unexpected Maker FeatherS2 both running CP 6.2 beta.

tannewt commented 3 years ago

Ok, great! Thank you!