Is there a deterministic way of loading rosparams from two files using roslaunch?

asked 2021-02-23 14:50:49 -0500

Walt Johnson gravatar image

If I load two different files (config_default.yaml and config_instance.yaml) that contain common parameters (with the same key name), which parameters will take precedent? Is this behavior deterministic? Are the files loaded alphabatically such that the config_default.yaml will always load before config_instance.yaml?

My goal is to use roslaunch to load parameters from two files and always have the second file override parameters from the first file.

<launch> <node pkg="test_node" type="test_node" name="test_node" > <rosparam command="load" file="config_default.yaml" /> <rosparam command="load" file="config_instance.yaml" /> </node> </launch>

edit retag flag offensive close merge delete

Comments

I believe this is a duplicate of #q199608.

Could you please read that Q&A and then either close your own as a duplicate, or clarify what isn't clear?


Edit: I'm also slightly confused as to why you weren't able to find that Q&A, as the title is literally roslaunch order of rosparams.

gvdhoorn gravatar image gvdhoorn  ( 2021-02-23 14:55:53 -0500 )edit

#q199608 doesn't mention precedent of params load from two different yaml files. Perhaps that is implicit.

Walt Johnson gravatar image Walt Johnson  ( 2021-02-23 15:13:20 -0500 )edit

I believe that would be covered by:

So, single pass, depth-first, last setting wins. iiuc, this also holds for parameters from yaml files.

and:

From roslaunch/XML/rosparam, section 1. <rosparam> tag:

The load command is considered additive: if you declare a dictionary or namespace of parameters, those parameters will be added to any other parameters declared for that namespace. Similarly, load commands can override parameters previously declared. [..]

gvdhoorn gravatar image gvdhoorn  ( 2021-02-23 15:16:26 -0500 )edit