-
Notifications
You must be signed in to change notification settings - Fork 60
Implement GSV and GSA parsing #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Enable GSV (satellites in view) parsing. Rewrote the GSA and GSV parsing to handle each satellite system (talker) separately. - self.sats now uses keys based upon the talker and satellite number, eg. GL67 for GLONASS #67, GP7 for GPS #7 - When the end message of a GSV sequence is received, eg. 3 of 3, all previous records in self.sats matching that talker are removed before adding the updated ones. - self.sat_prns stores the last satellite IDs that were used for a fix and returned in the most recent GSA sentence. They will be from only one Satellite system and should have a record in self.sats .
to when it was received. The data stored in self.sats dictionary is: key is TTNN where TT = the talker name, eg. GL for GLONASS NN = the number of the satellite, currently a 1 or 2 digit number value is a 5 entry list (V0, V1, V2, V3, V4) V0 = satellite number TTNN as used for the key V1 = satellite elevation in degrees V2 = satellite azimuth in degrees V3 = satellite signal to noise ratio in dB, or None V4 = timestamp, time.monotonic(), of last GSV message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test but the code looks good! I like that you split the talker out. I didn't know that was the format. :-) Thanks!
I've switched this from Draft as I have a list of further improvements that I intend to work on for GPS. |
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. |
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. |
Ok, great! Thank you! |
Updating https://github.com/adafruit/Adafruit_CircuitPython_DS18X20 to 1.3.4 from 1.3.3: > Merge pull request adafruit/Adafruit_CircuitPython_DS18X20#21 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_EPD to 2.8.0 from 2.7.2: > Merge pull request adafruit/Adafruit_CircuitPython_EPD#45 from makermelissa/master Updating https://github.com/adafruit/Adafruit_CircuitPython_GPS to 3.7.0 from 3.6.8: > Merge pull request adafruit/Adafruit_CircuitPython_GPS#54 from lesamouraipourpre/parse-gsa-and-gsv Updating https://github.com/adafruit/Adafruit_CircuitPython_RGB_Display to 3.10.6 from 3.10.5: > Merge pull request adafruit/Adafruit_CircuitPython_RGB_Display#90 from makermelissa/master Updating https://github.com/adafruit/Adafruit_CircuitPython_SSD1306 to 2.11.0 from 2.10.2: > Merge pull request adafruit/Adafruit_CircuitPython_SSD1306#57 from adamcandy/add-page-addressing-mode Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Button to 1.5.2 from 1.5.1: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Button#27 from FoamyGuy/resizeable_button Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.15.0 from 2.14.0: > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#111 from FoamyGuy/wrap_by_pixels Updating https://github.com/adafruit/Adafruit_CircuitPython_LED_Animation to 2.5.3 from 2.5.2: > Merge pull request adafruit/Adafruit_CircuitPython_LED_Animation#75 from adafruit/REUSE > Hardcoded Black and REUSE versions > Added pre-commit-config file > Added pre-commit and SPDX copyright Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 5.0.3 from 5.0.2: > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#65 from brentru/update-cpython-example
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) andsentence_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
talker
s andsentence_type
s 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_type
s, 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.