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

Gracefully stopping robot & roslaunch

asked 2012-11-22 02:14:18 -0500

Miguel S. gravatar image

Hi!

I am writing a ROS node that takes control of the NAO, and upon receiving a Ctrl+C (or rosnode kill) signal, puts the NAO back to its original position.

In order to do that nao_driver/nao_controller.py (another ROS node) must be running in the background.

The problem crops up when I put both my node and nao_controller in the same roslaunch file. Roslaunch immediately stops nao_controller and my node never has the opportunity of stopping gracefully (ie. going back to the original position).

I've checked the wiki and roslaunch does not seem to have any support for adding node dependencies.

I reckon this must be a fairly common issue (shutdown ordering) and that there must be some guidelines and best practices that I am not following.

Can anyone help?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-11-22 03:11:37 -0500

dornhege gravatar image

updated 2012-11-22 03:14:17 -0500

The best practice is that each node should be able to properly shutdown itself. As far as I know node orderings for shutdown (and bringup) are not supported by design.

You could circumvent this by (at least in c++) removing the SIGINT handler in ros::init and then doing your own shutdown procedure. But this needs to happen in all nodes involved.

edit flag offensive delete link more

Comments

I override SIGINT; and the node gives up after a while trying to get the NAO back to its original position. I think it'd be too messy to modify all the nodes involved. Instead I will create a service call to restore NAO to its original position which will be called before (normal) shutdown. Thanks!

Miguel S. gravatar image Miguel S.  ( 2012-11-22 03:56:43 -0500 )edit

Question Tools

Stats

Asked: 2012-11-22 02:14:18 -0500

Seen: 1,421 times

Last updated: Nov 22 '12