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

unused args [...] for include of [...]

asked 2016-07-12 17:48:18 -0500

sciencectn gravatar image

I'm trying to pass an argument to a launch file, and I keep getting this error.

The main launch file has something like this:

<?xml version="1.0"?>
    <include file="$(find p2os_urdf)/launch/upload_pioneer3at.xml">
        <arg name="foo" value="bar"/>

The included file looks like this:

<?xml version="1.0"?>
    <param name="testing" value="$(arg foo)"/>

Yet I keep getting this error:

unused args [foo] for include of [/home/sciencectn/builds/ros/src/p2os_urdf/launch/upload_pioneer3at.xml]

I assume it means the "foo" argument was never used when it clearly is. What's going on?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-07-12 19:46:35 -0500

ahendrix gravatar image

roslaunch is very strict about argument passing; you can't use an argument ($(arg foo)) without first declaring that the launch file takes an argument (<arg name="foo"/>).

in addition, passing arguments that are not expected, or failing to pass arguments that do not have a default is an error. (very similar to passing arguments when calling a function in C++ or python)

Therefore, your included launch file should be:

<?xml version="1.0"?>
    <arg name="foo"/> <!-- declare that this launch file requires an argument -->

    <param name="testing" value="$(arg foo)"/> <!-- use the argument -->
edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-07-12 17:48:18 -0500

Seen: 15,348 times

Last updated: Jul 12 '16