Ask Your Question

rosnode kill in launch file

asked 2018-06-01 01:30:15 -0500

Markus gravatar image

Hey there,

I would like to kill a specific rosnode by its name through calling a launch file

Anyone knows how this is possible?

Best, Markus

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-06-01 01:38:34 -0500

gvdhoorn gravatar image

updated 2018-06-01 01:39:10 -0500

Anyone knows how this is possible?

Like so?

<node name="<some_name>" pkg="rosnode" type="rosnode" args="kill /<name_of_your_node>" />

Identical to how you would start any other ROS program in a launch file (such as rosbag, static_transform_publisher, etc).

edit flag offensive delete link more


this doesn't work for me. seems like there is no rosnode run file in the rosnode pkg. I have to resort to using a bash script to do the killing

haito gravatar image haito  ( 2019-09-24 08:27:43 -0500 )edit

seems like there is no rosnode run file in the rosnode pkg

Do I understand you correctly that you did a rosls rosnode and didn't see any binaries there? If so, that is normal and expected.

The node line shown in the answer should work. If it doesn't, just stating "it doesn't work" for you is not enough to try and figure out what is going wrong.

gvdhoorn gravatar image gvdhoorn  ( 2019-09-24 09:11:50 -0500 )edit

Sorry for not being clear, I got this error:

ERROR: cannot launch node of type [rosnode/rosnode]: can't locate node [rosnode] in package [rosnode]

and the part of my launch file with the node line is:

<?xml version="1.0"?>
    <!-- kill default pointcloud_to_laserscan node -->
    <node name="node_killer" pkg="rosnode" type="rosnode" args="kill /pointcloud_to_laserscan" />
    <!-- run pointcloud_to_laserscan node with virtual obs -->
    <node pkg="pointcloud_to_laserscan_virtual_obs" type="pointcloud_to_laserscan_virtual_obs_node" name="pointcloud_to_laserscan_virtual_obs">
        <remap from="cloud_in" to="/pointcloud_unified"/>
        <remap from="scan" to="/scan"/>
haito gravatar image haito  ( 2019-09-24 10:38:36 -0500 )edit

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


Asked: 2018-06-01 01:30:15 -0500

Seen: 820 times

Last updated: Jun 01 '18