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

When to use param and rosparam on launch file?

asked 2012-07-04 03:06:03 -0600

sam gravatar image

For param example:

 <launch>
   <!-- send table urdf to param server -->
   <param name="table_description" command="$(find      xacro)/xacro.py $(find gazebo_worlds)/objects/table.urdf.xacro" />

   <!-- push table_description to factory and spawn robot in      gazebo -->
   <node name="spawn_table" pkg="gazebo" type="spawn_model"      args="-urdf -param table_description -z 0.01 -model table_model"      respawn="false" output="screen" />
 </launch>

For rosparam example:

 <launch>
   <node name="fake_localizaton" type="fake_localization"      pkg="fake_localization">
     <rosparam>
       odom_frame_id: odom_combined
       base_frame_id: base_footprint
     </rosparam>
   </node>
 </launch>

What's their difference?

What's the case of using them?

Thank you~

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
33

answered 2012-07-04 03:56:32 -0600

mjcarroll gravatar image

I believe that the main difference is that <param> may be used to set a single command on the ROS parameter server, while <rosparam> can be used to evaluate groups of parameters.

So, in the cases above, <param> is setting a single parameter, and that parameter is an entire URDF file. The <rosparam> tag is reading in the rosparam yaml format from within the launch file.

The value set by the <param> tag may only be a string, int, bool, or double, which may be set through the xml attribute value, or by reading in from a text file, bin file, or the output of a command line command.

The value set by the <rosparam> tag is most commonly a batch of related parameters, read in from a YAML file (or from the output of rosparam dump). You can think of it as a programmatic way to access the functionality of rosparam from a launch file. A good example of this in practice is the move_base related nodes, where there are many, many parameters to be set, it's less cumbersome to just use the YAML format.

For more information on all of these topics, I would consult the following:

edit flag offensive delete link more

Comments

1

This information has been added here: http://www.ros.org/wiki/ROS/Patterns/Parameterization#Static_Parameters (feel free to edit)

jbohren gravatar image jbohren  ( 2013-07-02 18:06:39 -0600 )edit

Question Tools

3 followers

Stats

Asked: 2012-07-04 03:06:03 -0600

Seen: 40,061 times

Last updated: Jul 04 '12