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

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

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

Milan gravatar image

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

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



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

1 Answer

Sort by » oldest newest most voted

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

JackB gravatar image

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

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


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 you find an example using rosparam so it is confusing.

Kansai gravatar image Kansai  ( 2021-04-08 02:52:32 -0600 )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 -0600 )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 -0600 )edit

@JackB Thanks! that was very clear

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

Question Tools

1 follower


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

Seen: 3,786 times

Last updated: Dec 23 '20