ros2 / launch

Tools for launching multiple processes and for writing tests involving multiple processes.
Apache License 2.0
126 stars 141 forks source link

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

Closed h-ohta closed 2 years ago

h-ohta commented 2 years ago

Bug report ?

Required Info:

Steps to reproduce issue

include1.launch.xml

include2.launch.xml


- Run `outside.launch.xml`

#### Expected behavior

```bash
$ 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

h-ohta commented 2 years ago

@clalancette Could you confirm this? Thank you.

hidmic commented 2 years ago

@h-ohta include actions don't scope (almost no action does), only group actions do. https://github.com/ros2/launch/issues/618 is somewhat related.

h-ohta commented 2 years ago

@hidmic Thank you for your response! I understand that this issue is correct behavior and I have to use <group> to scope any actions. Could you close If you don't have any problems?