Issue
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 am 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
Solution
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.
Answered By - musically_ut
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.