ros2 / launch

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

Parameter from YAML file cannot be overridden #505

Closed felixdivo closed 3 years ago

felixdivo commented 3 years ago

Bug report

Required Info:

Steps to reproduce issue

  1. Create example_launch.py:
#!/usr/bin/env python3

from launch import LaunchDescription
from launch_ros.actions import Node

def generate_launch_description() -> LaunchDescription:
    return LaunchDescription(
        [
            Node(
                package="turtlesim",
                executable="turtlesim_node",
                name="turtlesim_node",
                parameters=[
                    {"background_b": 200},  # should have no effect
                    "parameters.yaml",  # should override the default value
                    {"background_b": 200},  # should override the value 5 from the previous line
                ],
            ),
        ]
    )
  1. Create parameters.yaml:
turtlesim_node:
  ros__parameters:

    background_b: 5
  1. Start with ros2 launch example_launch.py.

  2. Check the param in another terminal: ros2 param get turtlesim_node background_b.

Expected behavior

Output Integer value is: 200.

Actual behavior

Output Integer value is: 5.

Additional information

The documentation states that parameters declared later shall override prior ones.

felixdivo commented 3 years ago

I just realized that this is probably the wrong repo. Re-opened here: https://github.com/ros2/launch_ros/issues/233