Multiple SetEnvrionmentVariable override each other when launching multiple nodes
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 155
- Forks
- 182
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 6
Description
Bug report
Required Info:
- Operating System:
- Ubuntu 20.04
- Installation type:
- Binaries
- Version:
- Galactic
- DDS implementation:
- Cyclone DDS
Steps to reproduce issue
Generate multiple nodes and call SetEnvironmentVariable in the LaunchDescription:
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import SetEnvironmentVariable
def generate_launch_description():
return LaunchDescription([
SetEnvironmentVariable(name='TEST', value='0'),
Node(
package="test_0",
executable="test_0",
name="test_0_node",
output="screen",
)
])
from launch import LaunchDescription
from launch_ros.actions import Node
from launch.actions import SetEnvironmentVariable
def generate_launch_description():
return LaunchDescription([
SetEnvironmentVariable(name='TEST', value='1),
Node(
package="test_1",
executable="test_1",
name="test_1_node",
output="screen",
)
])
Launch both nodes:
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
nodes = ["test_0", "test_1"]
includes = []
for n in nodes:
includes.append(launch.actions.IncludeLaunchDescription(launch.launch_description_sources.PythonLaunchDescriptionSource(get_package_share_directory(n) + '/launch/' + n + '_launch.py')))
return launch.LaunchDescription(includes)
Expected behavior
When accessing the environmental variable in node 'test_0' it should have the value '0'.
When accessing the environmental variable in node 'test_1' it should have the value '1'.
Actual behavior
When accessing the environmental variable in node 'test_0' it has the value '1'.
When accessing the environmental variable in node 'test_1' it has the value '1'.
Additional information
Contributor 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.
Research direction
Start by reproducing the issue with the two Python launch descriptions using SetEnvironmentVariable and IncludeLaunchDescription, then inspect the corresponding launch package entry points. Done means each included node observes its own TEST value rather than the value from the last launch description.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100