ros_comm icon indicating copy to clipboard operation
ros_comm copied to clipboard

Cannot call rosnode kill --all from .launch file

Open gokhansolak opened this issue 2 years ago • 1 comments

We have a launch file with the following:

<node pkg="rosnode" type="rosnode" name="kill_all_nodes" args="kill -a" />

Rosnode is not found as a node due to the install issues as reported #2262. However, if we manually add the rosnode as a node, by the change suggested in that PR, it will still fail to run the kill all command. Because, roslaunch gives the node name and log file as arguments to the node, and the rosnode script does not allow any other args as in the lines below https://github.com/ros/ros_comm/blob/dd78ac8af128bb8eb992d6431bb9f994658ea6ab/tools/rosnode/src/rosnode/init.py#L675-L678

For example, when we run the above launch file, the args will be non-empty, with the contents: ['__name:=kill_all_nodes', '__log:=/blabla/.ros/log/flhais84523589nlaf/kill_all_nodes-1.log']

A solution might be removing the if condition here, but it may be needed for some other reason I don't know.

gokhansolak avatar Aug 02 '22 09:08 gokhansolak

Actually, it will not work in the case of killing particular nodes too. Because of the if condition here: https://github.com/ros/ros_comm/blob/dd78ac8af128bb8eb992d6431bb9f994658ea6ab/tools/rosnode/src/rosnode/init.py#L702-L708

gokhansolak avatar Aug 02 '22 09:08 gokhansolak