raspberry pi与kinect有错误

时间:2017-08-16 12:00:59

标签: python raspberry-pi kinect

我在Raspberry Pi上使用Kinect时遇到问题。 当我使用libfreenect运行我的程序时,我有一个错误来运行程序,然后我再次执行更多,然后更多,突然系统工作,我的kinect唤醒并运行我的程序。 请帮忙。我的错误是:

send_cmd: Input control transfer failed (18)
freenect_fetch_reg_const_shift: send_cmd read 18 bytes (expected 8)
freenect_camera_init(): Failed to fetch const shift for device
Error: Invalid index [0]
Error: Can't open device. 1.) is it plugged in? 2.) Read the README
Traceback (most recent call last):
  File "9605019hsn2.py", line 64, in <module>
    depth = getDepthMap()
  File "9605019hsn2.py", line 42, in getDepthMap
    depth, timestamp = freenect.sync_get_depth()
TypeError: 'NoneType' object is not iterable

1 个答案:

答案 0 :(得分:0)

显然,freenect.sync_get_depth()会返回None,当您尝试将其存储到depth, timestamp时,它会失败,因为None不可迭代。

重构此代码,并进行正确的错误处理:

d = freenect.sync_get_depth()
if d is not None:
    depth, timestamp = d
else:
    error()