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

What are the roles of <param> tags within the <node> tags in launch file?

asked 2018-03-29 05:13:12 -0500

stefanvan gravatar image

Hi everyone, I wanna know what the roles of tags within the <node> tags are. Let's take a common example:

  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"> 
    <param name="publish_frequency" type="double" value="30.0"/> 
  </node>

Please explain to me. Any answer is appreciated.

edit retag flag offensive close merge delete

Comments

Have you checked the wiki ?

Delb gravatar image Delb  ( 2018-03-29 06:50:19 -0500 )edit

Yes, I did check the wiki. But I still can't comprehend the concepts of the naming rules about parameters in ros, so that I am disable to understand what the <param> tags within the <node> tags mean.

stefanvan gravatar image stefanvan  ( 2018-03-29 22:08:31 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-03-30 02:11:48 -0500

Delb gravatar image

I think this would help you understand what's behind the param tag.

To use your example with the robot_state_publisher node you can use the param tag because here line 58 you define a variable that can be set whitin the launch file using the param tag and if you don't define it you still have a default value. And you can see that there are two others parameters than can be set so this is possible too :

<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
    <param name="publish_frequency" type="double" value="30.0" />
    <param name="use_tf_static" type="bool" value="false" />
    <param name="ignore_timestamp" type="bool" value="true" />
</node>
edit flag offensive delete link more

Comments

Thank you so much for your answer, so the <param> tags within <node> tags are like the formal parameters of a function in programming language, am I correct?

stefanvan gravatar image stefanvan  ( 2018-03-30 03:39:18 -0500 )edit
1

You can say that but it's more like if you values in differents nodes you need to adapt for your application, instead of changing the source code of each node you will change those parameters in your launch file. It allows you to see all your parameters used for each node in the same file.

Delb gravatar image Delb  ( 2018-03-30 03:59:34 -0500 )edit
1

But be aware that you have to define this in the source code, with the same example if there wasn't this line in the code :

n_tilde.param("publish_frequency", publish_freq, 50.0);

You wouldn't be able to use <param name="publish_frequency" type="double" value="30.0" />

Delb gravatar image Delb  ( 2018-03-30 04:02:17 -0500 )edit
1

Additionnaly there is an <arg> tag within the launch tag allowing you to pass arguments in command when executing a roslaunch. For example you might have seen this :

roslaunch urdf_tutorial display.launch model:='$(find urdf_tutorial)/urdf/01-myfirst.urdf'

The model part is an argument.

Delb gravatar image Delb  ( 2018-03-30 04:06:09 -0500 )edit

Thank you for your guidance.

<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -model cambot -param robot_description"/>

I also like to know what this args attribute stands for.

stefanvan gravatar image stefanvan  ( 2018-03-30 04:13:28 -0500 )edit
1

You should always check the wiki (the tag reference part) it's all detailled for each tag. The args is the same thing as my previous comment but instead of typing it in the terminal you define the arguments directly in the launch file.

Delb gravatar image Delb  ( 2018-03-30 04:19:56 -0500 )edit

I've read the page you provided, but it does not seem to solve my question. It just gives an example of <node name="add_two_ints_client" pkg="beginner_tutorials" type="add_two_ints_client" args="$(arg a) $(arg b)" />, but without explanation.

stefanvan gravatar image stefanvan  ( 2018-03-30 05:07:22 -0500 )edit

Then I try to read this page, it simply gives a statement of args attribute() without further explanation. Here is the explanation of this page about args:

args="arg1 arg2 arg3"(optional)

Pass arguments to node.
stefanvan gravatar image stefanvan  ( 2018-03-30 05:10:53 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-03-29 05:13:12 -0500

Seen: 189 times

Last updated: Mar 30 '18