Korving-F / ublox

Python library for the UBX protocol
MIT License
37 stars 14 forks source link

Type Error NAV_PVT #3

Closed jasavatt closed 5 years ago

jasavatt commented 5 years ago

Getting a type error when receiving a NAV_PVT message. I enable the message with enable_message(1, 7) and then do a read().

Receiving 01 07 Traceback (most recent call last): File "", line 1, in File "/home/pi/rocketman/ublox.py", line 130, in disable_message if(self.confirmation()): File "/home/pi/rocketman/ublox.py", line 203, in confirmation answer = self.read(reset=False) File "/home/pi/rocketman/ublox.py", line 114, in read return UbxMessage(ubx_class, ubx_id, dev=self.dev, version=self._version) File "/home/pi/rocketman/ublox.py", line 231, in init message[ubx_id]() File "/home/pi/rocketman/ublox.py", line 230, in '07': lambda: self.ubx_NAV_PVT(kwargs["dev"])} File "/home/pi/rocketman/ublox.py", line 426, in ubx_NAV_PVT self.iTOW, self.year, self.month, self.day, self.hour, self.minute, self.second, self.valid, self.tAcc, self.nano, self.fixType, self.flags, self.flags2, self.numSV, self.lon, self.lat, self.height, self.hMSL, self.hAcc, self.vAcc, self.velN, self.velE, self.velD, self.gSpeed, self.headMot, self.sAcc, self.headAcc, self.pDOP, reserved11, reserved12, reserved13, reserved14, reserved15, reserved16, self.headVeh, self.magDec, self.magAcc = struct.unpack('=LH5BBLlB2BB4l2L5lLLH6BlhH', payload_cpy) TypeError: a bytes-like object is required, not 'str'

Korving-F commented 5 years ago

Thank you for the feedback. Unfortunately I don't have a lot of time but I will try to look either tonight or tomorrow to fix it. My handling of python2 vs python3 is not really thorough / I have a vague memory of pyserial returning different data types across versions. Point is: I'm not actively maintaining it but a simple check could at least make the code work for you, so Ill try to add that. ^_^ What versions are you using it with btw?

jasavatt commented 5 years ago

Thanks for responding! Trying to use this in an amateur high power rocket next week. I'm ok with python so I'm slowly working through your code to fully understand it.

Python 3.5.3, pyserial 3.4 with Ublox MAX-M8Q

Korving-F commented 5 years ago

So it seemed I did some unnecessary checks/conversions to accommodate for python3. I tested it now for v2.7.12 and v3.5.2. Could you let me know whether it works for you as well? ^_^

1 2

jasavatt commented 5 years ago

Excellent! PVT messages are now coming in. Thanks! These messages have a ton of good data.

Korving-F commented 5 years ago

Awesome! If you need support for other messages, now or in the future, let me know. Also, if it's not too much to ask, could you send pictures / an update after you've shot up the rocket? It's nice to see someone else using the code / also just curious ^_^

jasavatt commented 5 years ago

Ended up scrubbing the launch. Might happen by the end of the year but I will post some pics/vid when it happens.

Thanks again for the fix.

Korving-F commented 5 years ago

No problem, good luck and thanks for following up; it's appreciated ^_^

jasavatt commented 5 years ago

Ended up launching but was not able to review any data... The nose cone with all the electronics snapped the shock cord and went flying off into the dessert never to be seen again.

Good news is I have a student that built a Pi HAT and will be using this code to talk to a uBlox

Korving-F commented 5 years ago

That's a shame; but may future launches go better! Good luck with your student and thanks again for getting back to me; really nice hearing someone is using this. ^_^ Cheers