semuconsulting / PyGPSClient

Python Graphical GPS Client Application supporting NMEA, UBX, RTCM3, NTRIP & SPARTN Protocols
BSD 3-Clause "New" or "Revised" License
493 stars 98 forks source link

Incorrect PUBX03 elev/azim handling in Sky View #138

Closed semuadmin closed 2 months ago

semuadmin commented 3 months ago

PyGPSClient Bug Report Template

NB: Please raise any general queries in the pygpsclient Discussions Channels in the first instance.

Describe the bug

(Reported via email by Matti Öhman)

The Satellite (Sky) view oscillates between two different states when both GPGSV and PUBX03 (UBX03) are enabled:

This seems bad: image1

... while this looks OK: image2

The parsed data seems to be valid, so the problem is probably in the _process_UBX03() funcion (nmea_handler.py).

The function makes a dictionary of tuples: gsvdict[key] = ( gnss, svid, getattr(data, f"azi{i+1:02}"), getattr(data, f"ele{i+1:02}"), str(getattr(data, f"cno{i+1:02}")), now, )

Later it moves the tuples around: for key in gsv_dict: self.gsv_log[key] = gsv_dict[key]

... and unpacks the tuples back into variables: for key in self.gsv_log: gnssId, svid, elev, azim, snr, lastupdate = self.gsv_log[key]

The 3rd and 4th fields are swapped, i.e. the elevation and azimuth have switched places!

It might be useful to have an assert statement to check that a satellite's elevation never exceeds 90 degrees.

semuadmin commented 3 months ago

probably also need to tweak SVID numbering for the PUBX03 message, which is not consistent with other NMEA or UBX SV messages for all constellations (e.g. Galileo).