ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to implement stop, pause and play capability in ROS MoveIt!

asked 2018-10-22 11:56:28 -0500


I am working on a robotic arm, in which we are planning implement play, pause and stop functionalities along with ROS MoveIt!.

For example, we can plan a trajectory in Rviz and when we execute the trajectory, there should be a provision to stop, pause and play the executing trajectory.

Anyone have ideas to implement this concept for ROS MoveIt!? It will be great if you can suggest an idea without modifying the MoveIt! and trajectory controller code.


edit retag flag offensive close merge delete



You will have to modify the trajectory controller code, I can't see a way around that. If you added pause and play services you could use the RQT GUI to send those commands to the controller while the trajectory was being followed. Are you planning to do this on a real robot or simulation?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-10-22 12:22:48 -0500 )edit


Thanks for the reply. I am planning to use this in simulation and real robot too.


Lentin Joseph gravatar image Lentin Joseph  ( 2018-10-22 13:48:19 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-10-25 02:55:32 -0500


Instead of modifying the controller code, I have implemented a simple logic in order to perform the play, pause logic in MoveIt!.

I have implemented a set of functions to do it.

The executefunction(), pause() and play(), control_bit = false

In play(): Set the control_bit = false In pause(): Set the control_bit=true, and movegroup.stop() to stop the current trajectory

In executefunction():

The logic is, when we activate the play and pause using a ROS service, it will set a control flag and change the direction of the execution. If the control bit false, it will call the movegroup.execute() function, if we call the pause function, the movegrup.stop() will be called, and set the control_flag as true. If the control_flag is true, it will clear all the targets using movegroup.clearPoseTargets(). then it will switch to infinite while and check the value of control bit to be false. If it false, it will execute the last joint values again, and call the executefunction() to execute the same.


edit flag offensive delete link more


Hi! I'm trying to implement the same behaviour for a robot arm using moveit. I managed to make the robot stop, using the funcion move_group.stop(), and then to replan and execute to reach the goal position. The issue is that the robot has to replan, each time it stops, from its current position to the goal state. This works pretty well, but I'd like the robot to follow the same trajectory it had planned before the stop, from the point where it stopped. Does your solution guarantee this behaviour?

Sgorba77 gravatar image Sgorba77  ( 2019-05-24 10:12:11 -0500 )edit

If you use the plan function, you can, in theory, drop all already reached waypoints from the planned trajectory and continue the move.

machinekoder gravatar image machinekoder  ( 2019-08-02 06:21:34 -0500 )edit

Hi @Sgorba77, I would like to know how did you implement the replanning of last goal?

Dhara gravatar image Dhara  ( 2022-08-24 07:15:19 -0500 )edit

Question Tools



Asked: 2018-10-22 11:56:28 -0500

Seen: 1,047 times

Last updated: Oct 25 '18