我有以下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
您使用incorrect formats作为传入的参数:
h
格式表示存储short
,而传入的值,即vr
和vl
,看起来像double
s考虑将它们类型转换为
int
或使用">Bdd"
格式。相关问题 更多 >
编程相关推荐