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

Remapping topics of included launch files

asked 2020-01-22 10:34:06 -0600

JayDe gravatar image

Hi! I am trying to write a launch file where I include another launch file. Additionally, I want to remap topics that are "created" within the included launch file. I want to refrain from changing the included launch file. Here is, how I am doing this so far:

        <remap from="remapped_topic_in_rosbag"      to="rosbag_remap_outside" />
           <remap from="rostopic_remap"      to="rostopic_remap_outside" />
        <include file="/home/user/Desktop/test_remap.launch">

where test_remap.launch looks like this:

  <node pkg="rostopic" type="rostopic" name="testpub" args="pub /topic_name std_msgs/String hello">
        <remap from="topic_name"      to="rostopic_remap" />
        <node pkg="rosbag" type="play" name="rosbag_play" required="true" args="
              --bags the_bag_file >

            <remap from=topic_within_the_bag_file       to="remapped_topic_in_rosbag" />

The result is, that rostopic_remap_outside and remapped_topic_in_rosbag are published (note: not rosbag_remap_outside!). There seems to be a difference in the two remapping arguments within test_remap.launch.

Does anybody know why? What is best practice to remap topics coming from an included launch file? Thanks, JayDe

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-01-22 12:09:51 -0600

lucascoelho gravatar image

updated 2020-01-22 12:15:46 -0600

The order of a tag in a launch file is important. Fron roslaunch wiki:

Tags are evaluated serially and the last setting wins.

Try using the remap from remapped_topic_in_rosbag to rosbag_remap_outside after the include.

edit flag offensive delete link more


Hi! Unfortunately, that does not work. Also, if I place the <remap from="rostopic_remap" to="rostopic_remap_outside"/> after the include, this will also not work anymore.

JayDe gravatar image JayDe  ( 2020-01-23 01:55:08 -0600 )edit

Question Tools



Asked: 2020-01-22 10:34:06 -0600

Seen: 996 times

Last updated: Jan 22 '20