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

Error in _process_UBX03() function when handling satellite elevation and azimuth #136

Closed semuadmin closed 3 months ago

semuadmin commented 3 months ago

PyGPSClient Bug Report Template

(Reported via email by Matti Öhman)

one more thing: 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.

Additional context

Add any other context about the problem here.