remap & include
I'm having some issues trying to reorganize my launch files. I am trying to move from a single file that contains a node with lots of remaps & params to splitting up everything over multiple files. Reorganizing the setting of params has worked as expected (I can set them in multiple files when needed). Trying to do split up the remap's has been frustrating. The following examples show what has worked & what has not:
<!-- Example #1: Remap within node (this works): -->
<node pkg="mypkg" type="mytype" name="myname">
<remap from="/myname/out1" to="/myname/out2" />
</node>
<!-- Example #2: Remap before node (this works): -->
<remap from="/myname/out1" to="/myname/out2" />
<node pkg="mypkg" type="mytype" name="myname" />
<!-- Example #3: Include file within node (does not work): -->
<node pkg="mypkg" type="mytype" name="myname">
<include file="$(find mypkg)/launch/fileContainingRemap.xml" />
</node>
<!-- Example #4: Include file before node (does not work) -->
<include file="$(find mypkg)/launch/fileContainingRemap.xml" />
<node pkg="mypkg" type="mytype" name="myname" />
<!-- Where fileContainingRemap.xml contains something like this: -->
<launch>
<remap from="/myname/out1" to="/myname/out2" />
</launch>
#3 doesn't work because you can't include files within a node. The only reason I can think of that #4 doesn't work is because the remaps are discarded when they haven't been matched when the parser hits </launch> at the end of fileContainingRemap.xml.
If there existed a "dumb include" functionality that would solve my problem. However, it seems like I have to wrap any file contents with <launch></launch> which causes things to go out of scope.
Any help is appreciated.
joq: I appreciate the advice, but your recommendation doesn't allow me to spread the remaps over multiple files (which is what I am trying to do). Your solution is very similar to my #1 (which is my current solution).
You can use the substitution arg elements from the XML at the bottom of @joq's tutorial.
Thanks for the advice. I am currently using substitution args and they are very helpful. My plan is to use them for selecting which files to include (based upon robot/hostname/project/simulation/etc). If I could do example #3 above (include files within a node tag), then my plan would work.