iRobotEducation / irobot-edu-python-sdk

Python SDK for iRobot Edu robots (Root or Create 3)
BSD 3-Clause "New" or "Revised" License
16 stars 6 forks source link

Only 6 proximity sensor readings #20

Closed Zipdox2 closed 1 year ago

Zipdox2 commented 1 year ago

The iRobot 3 documentation says that there's 7 proximity sensors but get_ir_proximity only returns 6 readings.

shamlian commented 1 year ago

What version of SDK, and what version of robot firmware are you using? This had been a bug but was fixed some time ago. You can see in create3.py that seven values should be returned. Can you give an example of your code and the output?

If you are not sure of the version of your installed SDK and you had previously installed it with pip, you can 'pip install --upgrade irobot-edu-sdk' and ensure you are on 0.3.0.

Zipdox2 commented 1 year ago

I'm using the web playground. How do you update the firmware?

shamlian commented 1 year ago

You're right -- somehow we had a regression in the web playground. Let me see if I can fix it.

Zipdox2 commented 1 year ago

This line only unpacks 6 numbers.

shamlian commented 1 year ago

Actually -- I take that back -- the SDK is fine. The problem is that the examples need updating.

Try using get_packed_ir_proximity instead of get_ir_proximity. The trouble is that there are two getters in the BLE protocol, and we are using the old one in the example.

Zipdox2 commented 1 year ago

get_packed_ir_proximity times out and returns None

shamlian commented 1 year ago

OK, now, back to the first question -- what version of robot firmware are you running? try print('Version:', await robot.get_version_string())

shamlian commented 1 year ago

If the version is less than G.3 (G.0.x, G.1.x, or G.2.x), you need to update your firmware. I'd recommend G.4.5; see the directions here: https://edu.irobot.com/create3-setup .

Zipdox2 commented 1 year ago

With updated firmware and running Python locally it works with get_packed_ir_proximity. Thank you for the fast response.

shamlian commented 1 year ago

Great! Should work on web now, too. Please re-open this ticket if not! I also spawned a couple other issues (#21 , #22 ) to hopefully make this easier for the next user. Feel free to pop into those if you have any suggestions for the implementation.

Zipdox2 commented 1 year ago

It's already pushed to the web? Just clear my browser cache?

I'm a student btw, I probably won't be using these robots anytime soon after today.

shamlian commented 1 year ago

There was nothing to change on the web; it's as simple as calling the packed function instead of the original one you had used, as long as the robot is up to date. No worries. In the future we will likely elect to change the examples (see #22 ) to point to the newer function.