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

shutdown alll nodes

asked 2018-05-28 06:21:00 -0500

ashwath1993 gravatar image


I want to shutdown all nodes from within a ros node. ros::shutdown() kills the current node but does not kill the other nodes.

I know that all nodes can be killed using the terminal and through the launch file. But I test if a certain condition is met and only in such a circumstance I want all the nodes to shutdown.


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-05-28 06:32:38 -0500

NEngelhard gravatar image

If all your nodes are launched by a single launch file, you could make your checking node required and let it stop itself to take down the whole launch file. If you have several launch files, have a required node in each launch and connect the killer nodes with bonds.

edit flag offensive delete link more


Thanks a lot! I didn't know of this parameter.

ashwath1993 gravatar image ashwath1993  ( 2018-05-28 06:57:16 -0500 )edit

answered 2018-05-28 06:25:21 -0500

jayess gravatar image

Please see #q218412

edit flag offensive delete link more


Hi, the rosnode.kill_nodes and the API is for the python variant. I am not able to find the C++ equivalent.

ashwath1993 gravatar image ashwath1993  ( 2018-05-28 06:32:07 -0500 )edit

@NEngelhard's method is the next way that I was going to suggest.

jayess gravatar image jayess  ( 2018-05-28 06:44:20 -0500 )edit

Question Tools

1 follower


Asked: 2018-05-28 06:21:00 -0500

Seen: 829 times

Last updated: May 28 '18