Ask Your Question
0

rosnode kill

asked 2016-06-23 04:38:51 -0600

ligang gravatar image

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.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
0

answered 2018-12-26 19:58:34 -0600

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.

edit flag offensive delete link more

Comments

More up-to-date, better answer. I marked this as an answer (and gave +1 for the previous marked answer :)

130s gravatar image130s ( 2019-11-12 19:27:24 -0600 )edit
2

answered 2016-06-23 05:03:55 -0600

lfr gravatar image

updated 2016-06-23 05:55:33 -0600

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

edit flag offensive delete link more

Comments

thank you, It's best!

ligang gravatar imageligang ( 2016-06-24 03:03:09 -0600 )edit

You're welcome

lfr gravatar imagelfr ( 2016-06-24 03:49:32 -0600 )edit
0

answered 2018-12-26 19:45:55 -0600

dsoike gravatar image

Try this:

rosnode list | grep -v rosout | xargs rosnode kill

It should kill all nodes except /rosout

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-23 04:38:51 -0600

Seen: 4,498 times

Last updated: Dec 26 '18