Shop OBEX P1 Docs P2 Docs Learn Events
How to Pause S2 robot's movement and then continue? — Parallax Forums

How to Pause S2 robot's movement and then continue?

william chanwilliam chan Posts: 1,326
edited 2011-03-31 11:58 in Robotics
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?

Comments

  • Daniel HarrisDaniel Harris Posts: 207
    edited 2011-03-31 11:58
    Hello William,

    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.
Sign In or Register to comment.