Unexpected behavior for params that exist in the launch file as well as the yaml file
I have a .launch.xml
file that looks like this (modified from the ros2/demos talker example)
<launch>
<node pkg="demo_nodes_cpp" exec="talker" output="screen">
<param from="$(find-pkg-share demo_nodes_cpp)/config/temp.yaml"/>
<param name="temp_var" value="4"/>
</node>
<node pkg="demo_nodes_cpp" exec="listener" output="screen" />
</launch>
And in config/temp.yaml
it looks like this
/talker:
ros__parameters:
temp_var: 42
When I launch the node using ros2 launch demo_nodes_cpp talker_listener.launch.xml
and run ros2 param get talker temp_var
I get 42
instead of 4
. In ROS1, the launch file param used to override the yaml one. In ROS2, however, it seems that the yaml param takes precedent.
I can get around the issue by simply NOT including the param in the .yaml
and only specify it in the .launch
file / pass it into the launch file as an argument, but I just wanted to make sure this behavior is expected