I have the following python code:
velocity = 0
rotation = 0
vr = velocity + (rotation/2)
vl = velocity - (rotation/2)
cmd = struct.pack(">Bhh", 145, vr, vl)
I dealing with the following error:
File "control.py", line 125, in __init__
cmd = struct.pack(">Bhh", 145, vr, vl)
struct.error: required argument is not an integer
You are using the incorrect formats for the arguments you are passing in: h
format indicates storing of short
, while the value you are passing in, i.e. vr
and vl
, look like double
s.
Consider typecasting them to int
or using ">Bdd"
format.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With