Closed scottcandy34 closed 7 months ago
If you'd like to fork the repo and then put in a PR targeting pre_0.5.2, I would likely approve it; alternatively, I can add "adding my own implementation" to my list of things to do. Let me know what you'd prefer.
I can do that
does the root have different sensor count or is it the same?
Root has a single cliff sensor in the front center of the robot. I think if I were to write this, I would model the code after the touch sensors (since Create 3 has two while Root has four). If you don't feel comfortable, or if you just want to PR this to support the Create 3 robot only, I can work on abstracting it to both robots, later.
That's what I thought from reading the Bluetooth documentation. I can model it after the touch sensors not an issue. But since there is not a center sensor for the create3 what should be the common ground name? just like the touch sensors share the front ones. Otherwise ill just make it front_left
for common
Ah, fair -- you're right, maybe I did a bad job with that abstraction. I think in this case, perfection is the enemy of good enough, and reusing that one arbitrarily is fine. I could also see the approach of adding a front
member that is used only for Root, and then having a common get_is_cliffed()
that returns true if any of the members are true, but a per-class get_cliff_sensors
that returns a list of the proper values. This is a case of "do as I say, not as I do," clearly; I did not do that for the touch sensors. Probably, I should create an issue for the maintainer of the repo about that.
Ok, apparently I don't get a choice for it. So it will be left that is common. This should be verified on a root. I doubled checked on the create3 and that works as intended. The pull request is here https://github.com/iRobotEducation/irobot-edu-python-sdk/pull/37
Realized there should be some examples so here LOL https://github.com/iRobotEducation/irobot-edu-python-sdk/pull/39
I have found that the cliff sensors event has not been updated yet for the robot found here https://github.com/iRobotEducation/root-robot-ble-protocol?tab=readme-ov-file#device-20---cliff-sensor although it doesn't cover for the create3 I figured it out by reading the packets and implemented it below.
https://github.com/iRobotEducation/irobot-edu-python-sdk/blob/1a81d6f533937498bee43621b2c10fb2e6f81d1a/irobot_edu_sdk/robot.py#L267-L272
I have done an override class to implement it
I only did a simple implementation of this. Can this be added to the create3.py, not sure what the sensors are for the root. I saw that it was left to do still. I did this back in January of 2023, so I thought I would share this. Here is the link to the issue that got fixed where I also shared some of this code. https://github.com/iRobotEducation/irobot-edu-python-sdk/issues/12