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

remap & include

asked 2012-12-26 03:57:07 -0500

raywilhe gravatar image

updated 2012-12-26 03:59:08 -0500

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.

edit retag flag offensive close merge delete

Comments

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).

raywilhe gravatar image raywilhe  ( 2012-12-26 04:55:24 -0500 )edit

You can use the substitution arg elements from the XML at the bottom of @joq's tutorial.

tfoote gravatar image tfoote  ( 2012-12-26 15:53:07 -0500 )edit

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.

raywilhe gravatar image raywilhe  ( 2012-12-27 01:38:45 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2012-12-26 04:24:36 -0500

joq gravatar image

updated 2012-12-26 04:26:33 -0500

My preference is the following variant, but with individual nodes or small groups moved into separate include files. Note the use of relative topic names.

<node pkg="mypkg" type="mytype" name="myname">
 <remap from="out1" to="out2" />
</node>

This tutorial provides useful tips for organizing the launch files of large systems.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-12-26 03:57:07 -0500

Seen: 4,907 times

Last updated: Dec 26 '12