我有以下 python 代码:
velocity = 0
rotation = 0
vr = velocity + (rotation/2)
vl = velocity - (rotation/2)
cmd = struct.pack(">Bhh", 145, vr, vl)
我正在处理以下错误:
File "control.py", line 125, in __init__
cmd = struct.pack(">Bhh", 145, vr, vl)
struct.error: required argument is not an integer
您正在使用格式不正确对于您传入的参数:h
格式表示存储short
,而您传递的值,即vr
and vl
, 看起来像double
s.
考虑将它们类型转换为int
或使用">Bdd"
format.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)