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

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

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

Sabrina gravatar image

Hi,

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
3

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

bhaskara gravatar image

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

Or from the command line,

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

Comments

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

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

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
{
  private:
      NavClient nav_client_;
  ...
}

MyClass::MyClass() : nav_client_("move_base", true) 
{
  ...
}

MyClass::cancelNavigation()
{
  nav_client_.cancelAllGoals();
}

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

edit flag offensive delete link more

Comments

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 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 1,272 times

Last updated: Nov 09 '11