Ask Your Question
0

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

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

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

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?

<launch>
   <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" />
   </node>

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

1 Answer

Sort by » oldest newest most voted
1

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

jacobperron gravatar image

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

Try:

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

See the migration guide for launch

edit flag offensive delete link more

Comments

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

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

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 -0600 )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 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

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

Seen: 326 times

Last updated: Oct 20 '20