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

Revision history [back]

click to hide/show revision 1
initial version

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.

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 as follows:

#!/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

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 as follows:

#!/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 I hope it helps you,
lfr

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 as follows: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

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 )
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