How to Pause S2 robot's movement and then continue?
![william chan](https://forums.parallax.com/uploads/userpics/RBTCEMRWP85K/nQFR9OII9OM33.jpg)
Hi,
If I detect an obstacle in front, I want stop the motors temporarily until the obstacle is removed and then continue again the original movement buffered commands.
The s2.stop_now() command deletes all the movement buffers.
Is there a s2.pause_now() kind of command that can continue the buffered commands?
If I detect an obstacle in front, I want stop the motors temporarily until the obstacle is removed and then continue again the original movement buffered commands.
The s2.stop_now() command deletes all the movement buffers.
Is there a s2.pause_now() kind of command that can continue the buffered commands?
Comments
I've done a fair bit of work with the S2. After looking through the S2 driver object a bit, I think I can answer your question.
There is no "official" pause_now() method available within the driver, but I think you can simulate that behavior.
Take a look at the "run_motors(command, left_distance, right_distance, timeout, max_speed, end_speed)" method in the S2 object. You can call it so that it executes immediately, but it does not wipe out the In_path variable. When you do call it, set the left and right distance variables to 0 so that the robot stops. I havent officially tested this, so let me know how it turns out.