iRobot Create 不返回传感器数据
我正在尝试从 iRobot Create 传输传感器数据。当我尝试时出现元组超出范围错误 bot.stream_sensors(somenumber) 和 bot.poll_sensors(somenumbers)。每当我输入 bot.sensors 时,我只会得到一个空数组 {}。我什至尝试在推入碰撞传感器时发送 bot.sensors,但仍然得到一个空数组。我通过串行端口连接到机器人,我身边有一个串行到 USB 转换器。尝试获取传感器数据之前的唯一代码是 导入开放接口 bot = openinterface.CreateBot(com_port="/dev/ttyUSB0", mode="full")
有谁知道如何解决这个问题?其他地方都只使用stream_sensors(6),它似乎工作得很好。
PS 我不久前发布了一个与此主题类似的问题,但没有人回复。不想发送垃圾邮件,但现在我有一个更明确的问题以及明显的问题是什么,所以我想我会再试一次。
I am trying to stream sensor data from the iRobot Create. I get tuple out of range errors when I try
bot.stream_sensors(somenumber) and bot.poll_sensors(somenumbers). Whenever I input bot.sensors, I just get an empty array {}. I have even tried sending bot.sensors while pushing in on the bump sensor, still getting an empty array. I am connected to the bot through the Serial port with a serial-to-usb converter on my side. The only code before trying to get the sensor data is
import openinterface
bot = openinterface.CreateBot(com_port="/dev/ttyUSB0", mode="full")
Does anyone have an idea of how to solve this issue? Everywhere else just uses stream_sensors(6) and it seems to work fine.
P.S. I posted a question similar to this topic not too long ago, but no one responded. Not trying to spam, but now I have a more clear question and what the apparent-problem is so I thought I would try again.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我从这个网站下载了openinterface.py:包括一些示例程序。我建议您退后一步,尝试示例代码,尝试找到其他更复杂的示例代码,并在继续使用真正的代码之前先尝试一下。您可能在某个地方遗漏了一个步骤。
I downloaded openinterface.py from this site: which included some sample programs. I'd suggest you take a step back, try the sample code, try to find other, more sophisticated, sample code and play with that first before moving on to your real code. You may be missing a step somewhere.
我可能有点晚回答这个问题,但仅供参考。通过使用直接控制 iRobot 大大简化
Pyrobot。
I may be a bit late to answer this, but for reference purposes. Directly controlling the iRobot is simplified greatly by using
Pyrobot.