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

Remapping topics of included launch files

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

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:

<launch>
    <group>
        <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">
        </include>
     </group>  
</launch>

where test_remap.launch looks like this:

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

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

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
0

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

lucascoelho gravatar image

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

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

Comments

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

Question Tools

2 followers

Stats

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

Seen: 1,054 times

Last updated: Jan 22 '20