ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Is parameter overrides supported in ROS2 launch?

asked 2021-04-04 13:04:37 -0600

Kenji Miyake gravatar image

Hello, I've used parameter overrides in ROS1. It's useful if we can use it in ROS2 as well.

So I'd like to know:

  1. whether it's supported or not
  2. (if not supported) is it possible to implement it using Python launch API

As for 2, I think it's possible if we can:

  • iterate all actions defined in previous contexts
  • filter action by some conditions
  • override filtered action's attribute

It's similar to what I asked in #q375384. Is it possible to do such a thing?

edit retag flag offensive close merge delete


As a workaround, I periodically update parameters like this, but I know it's not a good way...


    <include file="my_launch.launch.xml" />
    <include file="" />

from launch import LaunchDescription
from launch.actions import ExecuteProcess
def override(node, param, value):
    return ExecuteProcess(
        cmd=['watch', '-n10', 'ros2', 'param', 'set', node, param, value],
def generate_launch_description():
    return LaunchDescription([
        override('node', 'param', 'true'),
Kenji Miyake gravatar image Kenji Miyake  ( 2021-04-04 13:09:52 -0600 )edit

I'm not sure I 100% understand your question, and this may depend on your version of ROS2, but the following may be helpful:

In ROS2, parameters can be set in yaml files and can be scoped to specific nodes (e.g. from

    some_text: "abc"
    int_number: 27
    float_param: 45.2
    int_number: 45

To me, this feels like what you are looking for... You can also set generic parameters (that would apply to all nodes) by using ** instead of the node name, e.g.:

    int_number: 5

You can also set parameters directly from the commandline (see here) using ros2 param set <node name> <parameter name> <value>

shonigmann gravatar image shonigmann  ( 2021-04-05 12:25:55 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-04-05 12:09:47 -0600

hidmic gravatar image

Global parameters overrides are not supported, no. They cannot be implemented like roslaunch did, there's no parameter aggregation happening in launch (there cannot be, some actions may not be executed until some event occurs in runtime). You'd have to traverse and monkey patch your launch description before execution. Not ideal.

Doing it in runtime like you do above is probably your only option right now. Perhaps, the Node action could be changed to abide to some global configuration and ignore any locally set parameter. It's a bit controversial, but you could try to pitch it in ros2/launch_ros.

edit flag offensive delete link more


Thank you, I'll learn more and consider how to solve this problem.

Kenji Miyake gravatar image Kenji Miyake  ( 2021-04-05 23:13:37 -0600 )edit

Question Tools



Asked: 2021-04-04 13:04:37 -0600

Seen: 1,031 times

Last updated: Apr 05 '21