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

What is the difference among arg, param, and rosparam in ROS launch files?

asked 2020-12-23 14:11:00 -0500

Milan gravatar image

updated 2020-12-23 14:13:31 -0500

I have been trying to add multiple nodes as well as external launch files into a single launch file. While doing so, I came across three different ways to set variables:

  1. arg
  2. param
  3. rosparam

So, what exactly is the difference among these three? When to use which one? Are there any advantages of one over another in terms of performance, usability, flexibility, or something else?

edit retag flag offensive close merge delete

Comments

1

We're here to help, but all of the concepts you list have quite a bit of documentation on the ROS wiki (in the roslaunch XML pages). In addition there are a few ROS Answers Q&As about this as well (searching with Google works pretty well, make sure to append site:answers.ros.org to your query).

Could you tell us what you've already found yourself, what you didn't understand and what specifically you'd like to see clarified?

gvdhoorn gravatar image gvdhoorn  ( 2020-12-23 14:13:08 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
5

answered 2020-12-23 14:37:48 -0500

JackB gravatar image

updated 2020-12-23 14:41:52 -0500

As mentioned, the literature on this topic is already well developed. But in my experience learning ROS this was the most useful description for me:

  1. arg is just a variable in a xml/launch file that has no specific relation to ROS

  2. param in a launch file will load a single parameter to the parameter server

  3. rosparam in a launch file can load entire yaml files of parameters to the parameter server

And when param and rosparam are inside of a node they are essentially namespaced into that node which keeps them private.

You can find all of this information and more details here

edit flag offensive delete link more

Comments

Thanks for the answer. I have the same question as Milan. Unfortunately ROS documentation can be confusing , therefore the reason of these forums. For example in the doc of param https://wiki.ros.org/roslaunch/XML/param you find an example using rosparam so it is confusing.

Kansai gravatar image Kansai  ( 2021-04-08 02:52:32 -0500 )edit

I have re-read the docs and still I sincerely don't know when to use param and when to use rosparam.... (and arg makes it more confusing)

Kansai gravatar image Kansai  ( 2021-04-08 02:54:46 -0500 )edit

@Kansaiparam is used when you want to load a single parameter directly from a launch file and rosparam is for when you want to load and entire .yaml file of parameters. What is unclear about that?

JackB gravatar image JackB  ( 2021-04-08 08:11:11 -0500 )edit

@JackB Thanks! that was very clear

Kansai gravatar image Kansai  ( 2021-04-09 08:09:08 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2020-12-23 14:11:00 -0500

Seen: 4,205 times

Last updated: Dec 23 '20