Qwiic_Ublox_Gps_Py icon indicating copy to clipboard operation
Qwiic_Ublox_Gps_Py copied to clipboard

payload length error when calling NAV ATT message

Open bnlerner opened this issue 10 months ago • 0 comments

Im seeing a ValueError raised in the ublox_gps module UbloxGps for "The payload length does not match the length implied by the message fields. Expected 32 actual 28". Any idea why this might be?

code

port = serial.Serial("/dev/ttyACM0", baudrate=38400, timeout=1)
gps = UbloxGps(port)


def run() -> None:
    try:
        while True:
            try:
                # Vehicle attitude
                if veh_att := gps.veh_attitude():
                    att_msg = messages.UbloxATTMessage.from_ublox_message(veh_att)
                    print(f"{att_msg=}\n")
                time.sleep(2)
            except (ValueError, IOError) as err:
                print(err)
    finally:
        port.close()


if __name__ == "__main__":
    run()

issue

Dec 11 10:02:13 beachbot-1 python3[6792]:   File "/home/brianlerner/.local/lib/python3.12/site-packages/ublox_gps/ublox_gps.py", line 501, in veh_attitude
Dec 11 10:02:13 beachbot-1 python3[6792]:     return self.request_standard_packet('NAV', 'ATT', wait_time = wait_time)
Dec 11 10:02:13 beachbot-1 python3[6792]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dec 11 10:02:13 beachbot-1 python3[6792]:   File "/home/brianlerner/.local/lib/python3.12/site-packages/ublox_gps/ublox_gps.py", line 324, in request_standard_packet
Dec 11 10:02:13 beachbot-1 python3[6792]:     raise err[1].with_traceback(err[2])
Dec 11 10:02:13 beachbot-1 python3[6792]:   File "/home/brianlerner/.local/lib/python3.12/site-packages/ublox_gps/ublox_gps.py", line 229, in run_packet_reader
Dec 11 10:02:13 beachbot-1 python3[6792]:     cls_name, msg_name, payload = self.parse_tool.receive_from(self.hard_port, True, True)
Dec 11 10:02:13 beachbot-1 python3[6792]:                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dec 11 10:02:13 beachbot-1 python3[6792]:   File "/home/brianlerner/.local/lib/python3.12/site-packages/ublox_gps/core.py", line 449, in receive_from
Dec 11 10:02:13 beachbot-1 python3[6792]:     return self.classes[msg_cls].parse(msg_id, buff[4:])
Dec 11 10:02:13 beachbot-1 python3[6792]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dec 11 10:02:13 beachbot-1 python3[6792]:   File "/home/brianlerner/.local/lib/python3.12/site-packages/ublox_gps/core.py", line 363, in parse
Dec 11 10:02:13 beachbot-1 python3[6792]:     name, nt = self._messages[msg_id].parse(payload)
Dec 11 10:02:13 beachbot-1 python3[6792]:                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Dec 11 10:02:13 beachbot-1 python3[6792]:   File "/home/brianlerner/.local/lib/python3.12/site-packages/ublox_gps/core.py", line 294, in parse
Dec 11 10:02:13 beachbot-1 python3[6792]:     raise ValueError('The payload length does not match the length implied by the message fields. ' +
Dec 11 10:02:13 beachbot-1 python3[6792]: ValueError: The payload length does not match the length implied by the message fields. Expected 32 actual 28

bnlerner avatar Dec 11 '24 15:12 bnlerner