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

roslaunch ros2 equivalent to 'rosparam command="load"'

asked 2020-09-29 12:39:06 -0500

updated 2020-09-29 13:33:05 -0500

What is the ros2 equivalent to '<rosparam cmd="load" ..=""/>'?

Looks like there are three possible cases:

  • loading parameters in the root of the parameter server
  • loading parameters privately into a node
  • loading parameters in a "group namespace"

For example, how would you translate the following ROS1 roslaunch file that contains these three cases?

   <rosparam command="load" file="$(find mypackage)/config/config.yaml" />

   <node pkg="mypackage" name="mynode" type="mynode">
        <rosparam command="load" file="$(find mypackage)/config/node_config.yaml" />

  <group ns="myns"/>
        <rosparam command="load" file="$(find mypackage)/config/node_config.yaml" />
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2020-10-05 11:39:06 -0500

jacobperron gravatar image

updated 2020-10-20 12:38:41 -0500


<param from="$(find-pkg-share mypackage)/path/to/params.yaml" />

See the migration guide for launch

edit flag offensive delete link more


It is weird. You are right about the migration guide. But I am still getting a python launch error. This is my example:

<node pkg="mypkg" exec="mynode" name="mypkg">
    <param from="$(find mypkg)/config/mynode_config.yaml"/>

It is interesting, if I use the rosparam xml tag (instead of param) it does not fail (no matter if I use the attribute "from" or "file"), but parameter values do not seem to load. I also double checked that there the configuration file is in install/share/mypkg/config/mynode_config.yaml.

So by the moment I don't know what it is happening.

Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2020-10-07 14:22:42 -0500 )edit

I think in many scenarios "unknown" tags like <rosparam> are silently ignored; hence parameter values not loading.

Can you share the Python error that you see? Note, the find substitution has been replaced by find-pkg-share, I guess that is responsible for the error.

jacobperron gravatar image jacobperron  ( 2020-10-07 16:00:30 -0500 )edit

answered 2023-04-28 13:39:56 -0500

130s gravatar image

OP didn't ask so, but Python format version of answer might be FAQ, so I post here.

Galactic onward, dumping a set of Parameters defined in a .yaml via launch is possible by launch_ros.parameter_descriptions.ParameterFile. Galactic's migration describes it well ( but posting an example too:

import launch
import launch_ros.parameter_descriptions
import launch_ros.actions

def generate_launch_description():
    return launch.LaunchDescription([
edit flag offensive delete link more

Question Tools



Asked: 2020-09-29 12:39:06 -0500

Seen: 1,662 times

Last updated: Apr 28 '23