Early termination or pause of actions while maintaining robot states

Hey, I’m wondering how to advancedly terminate the running action of Stretch-3 while maintaining its current state. For example, Stretch is currently manipulating something, but I need to stop the action before it’s completed due to some visual detections, then jump into handling modules to call other stretch functions, finally resume the previous action. I think two primary factors are “the gripper state should not be changed” and “stretch can run other functions”, so it’s different from runstop, how can I solve this problem? Thanks a lot!

supp: I think it’s not the question how to simultaneously run multiple commands, it’s more like that I give up or pause current action and switch to another action seamlessly

Hi @dongping, can you provide a bit more detail about the software stack you’re using? If you’re planning on building on Stretch’s ROS2 SDK, I’d recommend checking out ROS2’s support for “actions”. Actions are long running behaviors that can be interrupted and resumed. They’re also built directly into ROS2, so it’s easy to find tutorials covering how to write them in Python, C++, and other languages.

I’m using StretchClient in stretch_ros2_bridge package now. I want to make pause in following codes:

from stretch_ros2_bridge.remote import StretchClient
...
...
robot = StretchClient()
robot.switch_to_navigation_mode()
robot.move_to_nav_posture()

robot.nav.move_base_to(xyt_goal, blocking=False)

If stretch is running move_base_to action (manipulation as well), how can I actively pause or early terminate current action before it’s completed without changing any state, runstop will change the gripper state.

Try this

robot.nav.move_base_to(robot.nav.get_base_pose(), blocking = False)

This forces the robot to stop at where it is.

2 Likes

Thanks so much! This helps