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

private params in launch file

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

CodingPeon gravatar image

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

Hi

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="drone.py">             
     <param name="local_name_leaked" value="leaked"/>          
 </node>                                

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

Here are what rosparam list returned for A and B

/A/local_name_leaked
/A/num_drones       
/B/local_name       
/B/local_name_leaked
/B/num_drones

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

I'm using Jade.

Thanks

===========================

Update 1

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

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

<launch>                                                        

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

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

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

</launch>

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

PARAMETERS                      
 * /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:

PARAMETERS                       
 * /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

Comments

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 -0500 )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 -0500 )edit
1

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

1 Answer

Sort by ยป oldest newest most voted
1

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

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

Comments

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

Question Tools

1 follower

Stats

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

Seen: 2,484 times

Last updated: Feb 24 '18