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

How can navigation be aborted even if goal is not reached?

asked 2011-11-08 20:20:15 -0600

Sabrina gravatar image


how can I cancel navigation with move_base and stop the robot by sending a message or a service call even if the goal sent to move_base is not reached yet?

Regards, Sabrina

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2011-11-09 04:10:47 -0600

bhaskara gravatar image

updated 2011-11-09 04:11:48 -0600

Or from the command line,

$ rostopic pub move_base/cancel actionlib_msgs/GoalID '{}'
edit flag offensive delete link more


Thank you, that was the solution I was looking for.
Sabrina gravatar image Sabrina  ( 2011-11-09 17:29:29 -0600 )edit

answered 2011-11-09 00:36:01 -0600

DimitriProsser gravatar image

The navigation stack operates using actionlib. Thus, to communicate with move_base, you must use actionlib's ActionClient to send commands and receive feedback. For simplicity, you can use the following code:

typedef actionlib::SimpleActionClient<move_base_msgs::MoveBaseAction> NavClient;

class MyClass
      NavClient nav_client_;

MyClass::MyClass() : nav_client_("move_base", true) 


For more advanced actionlib usage, you can find complete documentation on actionlib here.

edit flag offensive delete link more


Thank you for your answer. This solution seems reasonable, but I'm looking for a more convenient way where no coding is needed. That's why I voted for bhaskara's answer.
Sabrina gravatar image Sabrina  ( 2011-11-09 17:33:33 -0600 )edit

Question Tools

1 follower


Asked: 2011-11-08 20:20:15 -0600

Seen: 1,254 times

Last updated: Nov 09 '11