How do you cancel a navigation goal? [closed]

asked 2013-03-19 12:41:47 -0600

Tadhg Fitzgerald gravatar image

updated 2014-01-28 17:15:47 -0600

ngrennan gravatar image

I'm trying to cancel a move_base goal sent by the explore node. SimpleActionClient.cancel_goal() doesnt seem to work at all, SimpleActionClient.cancel_all_goals() only works intermittently. I've included the code for my goal cancellation node below:

class cancelGoal():
    def __init__(self):
        self.node_name = "cancel_goal"

        rospy.init_node(self.node_name)

        self.explore_goal_sub = rospy.Subscriber("/move_base/goal", 
                                    MoveBaseActionGoal, self.newGoalHandler)
        self.client = actionlib.SimpleActionClient('move_base', MoveBaseAction)
        rospy.loginfo("Wating for move_base server.....")       
        self.client.wait_for_server()

    def newGoalHandler(self, new_goal):
        self.client.cancel_goal()
        self.client.cancel_all_goals() # Try both
        rospy.loginfo("Goal cancelled")
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2015-11-26 03:04:12.624658

Comments

For the highlighting: apparently a mix of tabs and leading whitespaces does not work.

felix k gravatar image felix k  ( 2013-03-19 23:50:31 -0600 )edit