Resetting cliff event status fails

I’m testing the cliff detector, and seem to have a problem when attempting to reset the cliff event flag after a cliff event.

I have a slightly raised (~1.5cm) platform on which I place the robot, then drive it towards the edge. The runstop correctly activates when the sensors go over the edge.

The instructions at Robot Sensors - Stretch Documentation indicate that the only way to reset this runstop is with

import stretch_body.robot
r=stretch_body.robot.Robot()
r.startup()
r.pimu.cliff_event_reset()

However, doing this appears to have no effect. I have tried this both with the driving being controlled by the xbox controller (/usr/bin/hello_robot_xbox_teleop.sh), and with the roslaunched driver running and using the keyboard teleop to drive the robot. I suspect that makes no difference to the resets.

When I try resetting I shut down the xbox teleop or ros driver.

I can see that the cliff event is no longer active, as checking the pimu’s at_cliff variable shows

r.pimu.status["at_cliff"]
[False, False, False, False]

I also tried using the runstop_event_reset function, but that also does nothing.

Is there something else I need to do to release the runstop after a cliff event?

I believe the issue is that you are missing a push_command call. This will cause your cliff_event_reset() call to get pushed down to the Pimu controller.

Does this work?

import stretch_body.robot
r=stretch_body.robot.Robot()
r.startup()
r.pimu.cliff_event_reset()
r.pimu.push_command()

Thanks - this was indeed the problem. To fully reset the cliff event it’s necessary to push both a cliff_event_reset and a runstop_event_reset.