Skip to content

$(arg) is overwritten when including multiple launch files #620

@h-ohta

Description

@h-ohta

Bug report ?

Required Info:

  • Operating System:
    • Ubuntu20.04
  • Installation type:
    • galactic binaries
  • Version or commit hash:
    • up to date
  • DDS implementation:
    • irrelevant
  • Client library (if applicable):
    • irrelevant

Steps to reproduce issue

  • Create three files
# outside.launch.xml

<launch>
    <include file="inside1.launch.xml"></include>
    <include file="inside2.launch.xml"></include>
</launch>

#include1.launch.xml

<launch>
    <arg name="test_arg" default="1"/>
    <log message="include1 has $(var test_arg)"/>
</launch>

#include2.launch.xml

<launch>
    <arg name="test_arg" default="2"/>
    <log message="include2 has $(var test_arg)"/>
</launch>
  • Run outside.launch.xml

Expected behavior

$ ros2 launch outside.launch.xml 
[INFO] [launch]: All log files can be found below /home/hrkota/.ros/log/2022-06-16-14-28-00-475031-npc2103034-543336
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [launch.user]: include1 has 1
[INFO] [launch.user]: include2 has 2

Actual behavior

$ ros2 launch outside.launch.xml 
[INFO] [launch]: All log files can be found below /home/hrkota/.ros/log/2022-06-16-14-28-00-475031-npc2103034-543336
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [launch.user]: include1 has 1
[INFO] [launch.user]: include2 has 1

Additional information

Now, I can avoid this problem by using <group> tag.

# outside.launch.xml

<launch>
    <group>
        <include file="inside1.launch.xml"></include>
    </group>

    <group>
        <include file="inside2.launch.xml"></include>
    </group>
</launch>

# result

$ ros2 launch outside.launch.xml 
[INFO] [launch]: All log files can be found below /home/hrkota/.ros/log/2022-06-16-14-30-35-485185-npc2103034-543607
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [launch.user]: include1 has 1
[INFO] [launch.user]: include2 has 2

Is it bug or correct behavior?
I can't get some information about it.


Feature request

Feature description

Implementation considerations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions