ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
752 stars 911 forks source link

Cannot call rosnode kill --all from .launch file #2263

Open gokhansolak opened 2 years ago

gokhansolak commented 2 years ago

We have a launch file with the following:

`

`

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 commented 2 years ago

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