Ask Your Question
0

rosnode kill in launch file

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

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
2

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

gvdhoorn gravatar image

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

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

Comments

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 imagehaito ( 2019-09-24 08:27:43 -0600 )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 imagegvdhoorn ( 2019-09-24 09:11:50 -0600 )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"?>
<launch>
    <!-- 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"/>
        <rosparam>
haito gravatar imagehaito ( 2019-09-24 10:38:36 -0600 )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

Stats

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

Seen: 272 times

Last updated: Jun 01 '18