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

Revision history [back]

Hello,

Take a look at http://wiki.ros.org/rospy/Overview/Initialization%20and%20Shutdown

The part 2.2 :

Registering shutdown hooks

rospy.on_shutdown(h)

    Register handler to be called when rospy process begins shutdown. h is a function that takes no arguments. 

def myhook():
  print "shutdown time!"

rospy.on_shutdown(myhook)

You should be able to call your function self.__move_base_action.cancel_all_goals() in this shutdown hook, that's called before the node is closed.