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

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

Closed
h-ohta opened this issue Jun 16, 2022 · 3 comments
Closed

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

h-ohta opened this issue Jun 16, 2022 · 3 comments

Comments

@h-ohta
Copy link

h-ohta commented Jun 16, 2022

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

@h-ohta h-ohta changed the title $(arg) are overwritten when including multiple launch files $(arg) is overwritten when including multiple launch files Jun 21, 2022
@h-ohta
Copy link
Author

h-ohta commented Jun 21, 2022

@clalancette Could you confirm this? Thank you.

@hidmic
Copy link
Contributor

hidmic commented Jun 22, 2022

@h-ohta include actions don't scope (almost no action does), only group actions do. #618 is somewhat related.

@h-ohta
Copy link
Author

h-ohta commented Jun 23, 2022

@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?

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

3 participants