Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gokhansolak opened this issue Aug 2, 2022 · 1 comment
Open

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

gokhansolak opened this issue Aug 2, 2022 · 1 comment

Comments

@gokhansolak
Copy link

gokhansolak commented Aug 2, 2022

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

(options, args) = parser.parse_args(args)
if options.kill_all:
if args:
parser.error("invalid arguments with kill all (-a) option")

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
Copy link
Author

Actually, it will not work in the case of killing particular nodes too. Because of the if condition here:

else:
# validate args
args = [rosgraph.names.script_resolve_name(ID, n) for n in args]
node_list = get_node_names()
unknown = [n for n in args if not n in node_list]
if unknown:
raise ROSNodeException("Unknown node(s):\n"+'\n'.join([" * %s"%n for n in unknown]))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant