Open RadionL opened 8 months ago
Hi @RadionL,
this is the first user feedback. Thanks for creating the ticket here.
Seems to be a type incompatibility around the modulo operator (%
): base_rate_count
is an integer, self.message_rates[msg_class][msg_id]['rate']
is bytes. I don't have time & a working test setup here to validate this - and I don't know why I've never run into this (maybe I've always had a 0 there). The second one should also be integer.
Maybe, you can do two things:
Add a print statement before the line with modulo:
print(self.message_rates[msg_class][msg_id]['rate'])
Try to convert the bytes to an integer (if it's multi-byte, the following probably won't work - we'll need to specify endianness):
return base_rate_count % int(self.message_rates[msg_class][msg_id]['rate']) == 0
Have a nice weekend!
Hi, Converted to int and it's working. Thanks
Hi @RadionL,
great to hear! I'd be happy if you made a pull request with your change(s).
Kind regards
Hi, I'm trying run simulate ubx GPS into Ardupilot (4.4.2) after im running the script Ardupilot detects the GPS as ublox and disconnects.
thats the log from Pycharm terminal
C:\PycharmProjects\GPS\venv\Scripts\python.exe C:\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py -b 115200 -t 2 COM17 Opened serial port 'COM17' with a baudrate of 115200 and serial blocking read timeout of 0.01 seconds. Simulating I/O target #2.
Traceback (most recent call last): File "C:\Users\rudion\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py", line 1051, in
run()
File "C:\Users\rudion\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py", line 1047, in run
simulator.run()
File "C:\Users\rudion\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py", line 324, in run
if self.check_cyclic_tx(base_rate_count, msg_class=b'\x01', msg_id=b'\x06'):
File "C:\Users\rudion\Desktop\Projects\פוד\Testing\ubx-gps-simulator-main\ubx_gps_simulator.py", line 764, in check_cyclic_tx
return base_rate_count % self.message_rates[msg_class][msg_id]['rate'] == 0
TypeError: unsupported operand type(s) for %: 'int' and 'bytes'
Process finished with exit code 1