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

Node shutdown

asked 2016-12-22 09:28:43 -0500

g.bardaro gravatar image


I'm working on a node with an internal state machine. The node has to run the main loop in the "running" state, then after using Ctrl+C (or sending a rosnode kill) switch into a "closing" state do some stuff (maybe ROS related, like publishing on a topic) and then shutdown completely. In synthesis, I need to break the main loop without using ros::shutdown().

Currently I'm using an implementation similar to the one suggested here:

Is this one still the best (and probably only) approach? Or there is a way to "split" the shutdown procedure?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-12-22 18:51:54 -0500

tfoote gravatar image Is still the best approach.

edit flag offensive delete link more


I see, thank you.

Is there any future plan on extending the shutdown procedure and give to the developers more control over it?

g.bardaro gravatar image g.bardaro  ( 2016-12-23 03:04:58 -0500 )edit

answered 2016-12-23 00:25:37 -0500

Akhilesh gravatar image

updated 2016-12-23 00:27:28 -0500

Hi g.bardaro, check the 2nd answer on It worked for me.

edit flag offensive delete link more


Thank you for the suggestion, but what I'm trying to do is different.

g.bardaro gravatar image g.bardaro  ( 2016-12-23 03:01:47 -0500 )edit

Question Tools



Asked: 2016-12-22 09:28:03 -0500

Seen: 2,884 times

Last updated: Dec 23 '16