ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Roslaunch complains of unused args when <arg> is inside <group>

asked 2020-10-28 06:17:26 -0500

alcedine gravatar image

updated 2020-10-28 10:28:36 -0500

I have the following "inner" launch file:

<launch>
    <group>
        <arg name="foo_topic" />
        <node name="foo" pkg="rostopic" type="rostopic" args="hz $(arg foo_topic)" />
    </group>
</launch>

And the following "outer" launch file:

<launch>
    <include file="inner.launch">
        <arg name="foo_topic" value="/tf" />
    </include>
</launch>

Roslaunch refuses to launch the outer file, complaining the foo_topic is unused:

RLException: unused args [foo_topic] for include of [inner.launch]
The traceback for the exception was written to the log file

Why does roslaunch not detect the <arg> tag inside <group>? Is there something I can do to make this pattern work?

Declaring the argument outside of the group will not do, as I ultimately want to use <group if="$(arg enable_group)"> to toggle the group (and its required arguments).

edit retag flag offensive close merge delete

Comments

@alcedine any follow up on this?

JackB gravatar image JackB  ( 2020-11-28 10:23:17 -0500 )edit

Unfortunately, I have not found any documentation that explains what is going on here. The wiki page for <arg> states, "An arg declaration is specific to a single launch file", which reads as if the <arg> being inside the <group> should be fine (there is no change of file, after all), but apparently this is not so. The wiki page for <group> does not indicate it to be an <arg> barrier, either.

I could find out by trawling the source code, but as of yet have not been able to justify the time investment.

alcedine gravatar image alcedine  ( 2020-11-28 13:01:26 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-10-28 10:38:56 -0500

JackB gravatar image

I am not an expert on scope in launch files, but I imagine that in inner.launch you need to define the arg outside of the group.

There are probably many reason for this, but I think the main one is, that an external user cannot know exactly what if statements will or will not be triggered. There knowledge (or lack there of) should not be required to pass arguments to the launch file.

No matter what, all args should be possible to pass to a launch file, and they should be given suitable default values in case they are not passed values. I don't think there is much expense to putting the arg outside of the group, and just letting it go unused if the conditional evaluates to false.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2020-10-28 06:17:26 -0500

Seen: 1,284 times

Last updated: Oct 28 '20