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

private params in launch file

asked 2018-02-21 00:14:35 -0600

CodingPeon gravatar image

updated 2018-02-24 15:12:16 -0600


From what understand about launch file, <param> defined in <node> are private to that <node>. But the behaviour of my launch file doesn't look right to me. Here is the content of the launch file:

<arg name="num" default="2"/>                                 
<param name="~num_drones" value="$(arg num)"/>                

 <node name="A" pkg="drone_core" type="">             
     <param name="local_name_leaked" value="leaked"/>          

 <node name="B" pkg="drone_simulator" type="">   
     <param name="local_name" value="debug"/>                  

Here are what rosparam list returned for A and B


So my question is, why would "local_name_leaked" show up under /B namespace?

I'm using Jade.



Update 1

I've narrowed down the cause. I'm reposting the full launch file for clairty

<?xml version="1.0" encoding="utf-8"?>                          


    <param name="~num_drones" value="2"/>                       
    <!--param name="num_drones_local" value="2"/-->             

    <node name="A" pkg="drone_core" type="">           
        <param name="local_name_leaked" value="leaked" />       

    <node name="B" pkg="drone_simulator" type=""> 
      <param name="local_name" value="debug"/>                  


With this <param name="~num_drones" value="2"/>, I get:

 * /A/local_name_leaked: leaked 
 * /A/num_drones: 2             
 * /B/local_name: debug         
 * /B/local_name_leaked: leaked 
 * /B/num_drones: 2                   
 * /rosdistro: jade             
 * /rosversion: 1.11.21

With this <param name="num_drones_local" value="2"/> I get:

 * /A/local_name_leaked: leaked  
 * /B/local_name: debug          
 * /num_drones_local: 2          
 * /rosdistro: jade              
 * /rosversion: 1.11.21

Notice one has "~num_drones", one has "num_drones". I was assuming <param name="~num_drones" value="2"/> would create private param in any sub sequence declaration of <node> block. But is that allowed? It seems to do that, but also cause any parameter declared inside <node> block to "leak" to sub sequence <node> blocks.

edit retag flag offensive close merge delete


Are you sure these parameters are being set by your launch file? Parameters persist on the roscore, so these might be left over from a previous launch file. Some nodes also set parameters, so it's possible that node B is setting this parameter.

ahendrix gravatar image ahendrix  ( 2018-02-21 00:22:53 -0600 )edit

roslaunch will print all of the parameters that it will set at startup; you should be able to see it setting (or not setting) this parameter as part of its output.

ahendrix gravatar image ahendrix  ( 2018-02-21 00:24:08 -0600 )edit

Because of character limits in reply box, I've updated the original post with my findings

CodingPeon gravatar image CodingPeon  ( 2018-02-22 12:06:13 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-02-22 17:39:37 -0600

ahendrix gravatar image

The roslaunch docs for the <param> tag clearly state that this should be possible, so this looks like a bug in roslaunch.

You've provided a great sample that reproduces this already; can you create a ticket on the ros_comm issue tracket?

edit flag offensive delete link more


CodingPeon gravatar image CodingPeon  ( 2018-02-24 15:15:04 -0600 )edit

Question Tools

1 follower


Asked: 2018-02-21 00:14:35 -0600

Seen: 2,459 times

Last updated: Feb 24 '18