rosnode kill
I want to kill all nodes in one command. Now ,we can use rosnode kill 1 step by step to end all the node .
but i want to use one command to kill all node.
I want to kill all nodes in one command. Now ,we can use rosnode kill 1 step by step to end all the node .
but i want to use one command to kill all node.
Seems the answer is out-dated.
In kinetic, you could simply kill all node with
rosnode kill -a
or
rosnode kill --all
And actually you kill roscore, you will not kill all nodes. the nodes will keep exchanging msgs but we cannot access the topics any more.
I don't know if it is what you want to do but if you kill the roscore, you kill at the same time all nodes.
But if you want to kill all nodes without killing the roscore, you can create your own script like this:
#!/usr/bin/env python
import os
nodes = os.popen("rosnode list").readlines()
for i in range(len(nodes)):
nodes[i] = nodes[i].replace("\n","")
for node in nodes:
os.system("rosnode kill "+ node)
I have written this script in python. I tested it, it works properly. You can modify it as you wish.
I want to notice that the node /rosout will relaunch itself automatically after being killed by this script.
I hope it helps you,
lfr
Try this:
rosnode list | grep -v rosout | xargs rosnode kill
It should kill all nodes except /rosout
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2016-06-23 04:38:51 -0500
Seen: 18,195 times
Last updated: Dec 26 '18
Weird rqt_graph when running turtlesim
How to kill rosnode via Qt gui? (QProcess). Node hungs.
Proper way to shutdown /rosout (roscore).
rosnode ERROR: Unable to communicate with Master
roslaunch doesn't terminate on pressing Ctrl-C when changing ROS param in a loop
Node naming and running. rospy.init_node() and .launch file nodes.
Two processes communicating directly on a system remote to Roscore
Rqt command line interface - killing plugins and switching perspectives