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

`get_touch_sensors` should only return two values for Create 3 #36

Closed shamlian closed 7 months ago

shamlian commented 7 months ago

get_touch_sensors is defined in the Robot class to return four sensors, which doesn't make sense for Create 3. Someone should fix that.

See original post by @shamlian in https://github.com/iRobotEducation/irobot-edu-python-sdk/issues/35#issuecomment-1889886568

scottcandy34 commented 7 months ago

NOTE: you can shorten the touch handler any operation. The not event.condition can pulled out as such...

not event.condition and (self.touch_sensors.front_left or self.touch_sensors.front_right or self.touch_sensors.back_left or self.touch_sensors.back_right)

This will fail off the start for event.condition, not having extra checks will increase speed.

shamlian commented 7 months ago

Good point. Would you agree that the two other checks on the value of any in the elif statements just below are redundant? I think if we make it to those elifs, any is guaranteed to be False.

scottcandy34 commented 7 months ago

yes I was just looking at that too. agreed

shamlian commented 7 months ago

All right, I'll be pushing a fix to the branch for this soon.