Override params in loaded from yaml in ROS2 launch.py

asked 2021-07-26 11:33:28 -0500

jeremya gravatar image

updated 2021-07-26 17:20:20 -0500

In ROS2 Launch (using python), the Node class takes a parameters argument which can be a YAML file or a dictionary of params (key/value pair). What I would like to do is set a YAML for the defaults and then use launch to override only certain params from that YAML. I realize I can set defaults in the code but I may want different defaults for different situations using the same code so the YAML file works best in that scenario. However sometimes I wish to make small adjustments at launch without disrupting the set of defaults.

Update: AutowareAuto has some examples but my experiments show that it only works when you apply to all nodes (e.g. /**:)

I also found some support in Nav2 but the issue there is that it's part of the nav2_common package but isn't broken out of the Nav2 repo as an independent package/repo. Perhaps that could be ported to launch_ros to provide this override functionality to the core of ROS2.

edit retag flag offensive close merge delete


I often find myself in a similar situation and have been using RewrittenYaml from nav2_common for these kinds of overrides. While this works well for most parameters, it currently lacks support for array data types like an array of strings (e.g. list of costmap plugins to load). This is really something I would like to see in launch_ros too.

Phgo gravatar image Phgo  ( 2021-11-02 08:03:28 -0500 )edit