XML: Allow setting environment variables to promote include reuse
Maintainers usually reply within 1 day
@christophebedard is already working on this.
Since May 1, 2025.
Assessment
This issue has not been assessed yet.
Description
Description
I frequently write meta-package launch files that re-use launch files, but I want to set environment variables in the included node(s). You can't do that.
Motivation
When using FastDDS, for certain situations, we like to change environment variables for our XML profiles to use a different profile. This is useful when we do things like data replay.
Design / Implementation Considerations
N/A
Additional Information
Here is a rough idea of what I would like to do, where you have a standard "base" package launch file .
base.launch.xml
<?xml version="1.0"?>
<launch>
<arg name="config_file" default="$(find-pkg-share base)/config/MyCustomConfig.json"/>
<node pkg="base" exec="BaseNode" output="screen">
<param name="config_file" type="str" value="$(var config_file)"/>
</node>
</launch>
Then, a meta_package launch file that runs the BaseNode from above, but also sets some environment variables for it.
meta_package.launch.xml
<launch>
<include file="$(find-pkg-share base)/launch/base.launch.xml">
<arg name="config_file" value="$(var visnav_config_file)"/>
<env name="FASTRTPS_DEFAULT_PROFILES_FILE" value="$(find-pkg-share meta_package)/config/fastdds.xml"/>
<env name="RMW_FASTRTPS_USE_QOS_FROM_XML" value="1"/>
</include>
</launch>
Currently, if you want to set an environment variable, you have to set it in the OS environment, rather than just applying just to the node of interest.
Instead of including a file, if include had more granularity, to say, include a node by name, then perhaps we can apply the environment variable that way.
To solve this problem today, we make heavy use of docker containers, one per node, but this requires a rebuild every time we change the node.
- Dominant language
- Python
- Stars
- 156
- Forks
- 200
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ros2/launch
-
Use a relative target for the `latest` log symlink so it survives different absolute mount paths (host/Docker)Possibly taken @Old-Ding claimed this 139 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ros2/launch#978 · 1 reaction ·
Maintainers usually reply within 1 day
-
Add OpaqueFunction to list at docs.ros.orgMay be free again A pull request for this issue was closed without being merged. Openbug help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ros2/launch#826 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
[launch_testing] pytest>8.1 dropped the legacy "path" argument from its internal hooks on humblePossibly taken A pull request linked to this issue is open or already merged. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 55/100
ros2/launch#979 · 6 comments ·
Maintainers usually reply within 1 day
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
hive size:simple
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
backend enhancement priority:P3
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
geolens-io/geolens#4161 ·
Maintainers usually reply within 1 day