How to override a parameter in an anonymous node?
I created an Operator Control Unit (OCU) that works with heterogeneous robots. During exercises, several operators (each at one computer) launch the OCU with different parameters depending on the robots that they control. Therefore, each instance must use an anonymous node name.
So far, I have several launch files that all contain all parameters. I'm trying to organize them better to have a set of default parameters and values, and specific launch files would only change some values and define extra parameters when required.
My first idea was to create a base launch file that all other launch files would include. The problem that I observe is that the original parameter name is /ocu_long_anon_name/foo
but the override is only /foo
.
I looked at these two pages, but I cannot find information about this special case (anonymous overrides): http://ros.org/wiki/roslaunch/Tutorials/Roslaunch%20tips%20for%20larger%20projects and http://ros.org/wiki/roslaunch/XML.
I tried the following:
There is first a base launch file:
<!-- ocu_base.launch -->
<launch>
<node name="$(anon ocu)" pkg="ocu" type="OCU" output="screen">
<param name="foo" value="not bar"/>
</node>
</launch>
And this:
<!-- ocu_ugv.launch -->
<launch>
<!-- Launches the OCU with default parameters -->
<include file="$(find ocu)/launchers/ocu_base.launch">
<param name="fooEMBEDDED" value="bar"/>
</include>
<param name="fooNORMAL" value="bar"/>
<param name="$(anon ocu)/fooANON" value="bar"/>
</launch>
The results are the following:
fooEMBEDDED
does not appear as a parameter at all
fooNORMAL
comes out as /fooNormal
fooANON
comes out as /ocu_different_long_anon_name/fooANON
So in the end, my original parameter is not overridden. :-(
The roslaunch documentation says that calling $(anon ocu)
multiple times would yield the same result, but now I'm doing it from different launch files, and I get different anonymous names.
I'm not sure if I'm not doing it properly, or if it's even possible with roslaunch
. Could arguments help in this situation? I don't need a specific solution, but rather one that makes it easy to create and maintain many launch files with many parameters.