[Solved] Pause waypoint

Any example on how to pause a current goal movement and resuming it later?
like pressing a button to stop and pressing a button to resume again. (i know that there are 2 button on husarion that can be use for this)
i seen a few examples but not quite sure of the implementation.

Hi angtzewern,

Unfortunately move_base does not support straightforward “pause” function.
The first workaround could be to cancel navigation goal and later set it again the same way as new destination.
Second method could be to disable the motors, this could be the easiest method with hardware buttons available.


by disabling them motor do you mean by setting it into a loop and keep on sending 0 to the cmd_vel?
and keep on sending until the button is pressed to allow the move_base to control it again?
or is there a function to disable motors in husarion?

You could disable motors by modifying the twist_callback function:

void twistCallback(const geometry_msgs::Twist &twist)
        rosbot.setSpeed(0, 0);
    } else {
	rosbot.setSpeed(twist.linear.x, twist.angular.z);

This will stop motors while button is pressed.
If you want to stop motors until second button is pressed, you will need to use setOnPressHandler().


This is working
but i dont really get the setonpresshandler()
the handler and userdata parameter is a blur for me.

I already get what it means for the handler and userdata. Thank you!
This function only works when it is reading data from cmd_vel? If there is no data reading and i press it, it is not going to work?

The solution that I posted is based on /cmd_vel callback, thus it will work only when a message is received.

To stop robot immediately, add also rosbot.setSpeed(0, 0); in button press handler.


I tested this on other agv and seem to notice that after awhile of pausing the motor it will initiate rotate recovery and might potentially cancel the goal after a few attempts.

Does this mean the second method is not much of a permanent solution but rather a quick hack to stop the agv?

The second method is interfacing only the CORE2 board and motors.
This way move_base is not aware that motors are stopped by the user, thus it will act as if there happened an error in drive system.