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

ros2 launch using IncludeLaunchDescription and remapping topics [closed]

asked 2022-01-25 12:30:48 -0500

jeremya gravatar image

To re-use other packages in the ROS2 ecosystem, it's often advantageous to directly re-use the launch files provided with a package by using IncludeLaunchDescription. Often the launch files from other included packages provide launch arguments to overwrite parameters, node names, namespaces, and sometimes topics. What if they don't? Is there another programmatic way to overwrite these values without the use of launch args?

In particular I'm curious about topics. I want to use IncludeLaunchDescription to reuse a launch file from another package but I also would like to remap some topics to match my topic scheme (already defined by use of many bags, other node's expectations, etc.). It seems the only option now is to copy the provided launch into my package and rework it to support my topic, param, node, and namespace names. Is there another way that promotes reuse in a more flexible way?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by shonigmann
close date 2022-07-19 11:18:21.590670

1 Answer

Sort by ยป oldest newest most voted

answered 2022-01-25 13:22:53 -0500

shonigmann gravatar image

updated 2022-01-25 13:24:19 -0500

I haven't tried it out myself, but it sounds to me like a GroupAction and a SetRemap action might be what you're looking for

GroupAction lets you scope the context of different nodes / launch configurations.

SetRemap then lets you define remapping rules within that context

edit flag offensive delete link more


Yes that should be the way. I implemented it myself not so long ago so if you have troubles let us know.

tnajjar gravatar image tnajjar  ( 2022-01-25 16:27:27 -0500 )edit

Is there any more guidance around this? Some more documentation would be great. Struggling to remap a topic from another launch file (nav2) from my master bringup launch file.

jorgemia gravatar image jorgemia  ( 2022-07-18 05:00:14 -0500 )edit

The only documentation I know if is directly in the source code:

The only example I know if is in a node composition unit test:

nav2_bringup has a similar usecase, where they use PushRosNamespace within a GroupAction instead of SetRemap, but the usage is very similar, if you want a more "in the wild" example:

If you still need guidance, I think you'll need to add a bit more context on what specifically you are having issues with, and it may merit opening a new question.

shonigmann gravatar image shonigmann  ( 2022-07-18 11:22:44 -0500 )edit

Thanks @shonigmann I found an exact example of what I was trying to do here:

It follows what you mentioned in your original answer :)

Launching nav2 from another launch file and remapping the cmd_vel topic:

# launch nav 2
nav_include = GroupAction(


             PythonLaunchDescriptionSource(nav_pkg_path + '/launch/'),
             launch_arguments = {
                   'use_sim_time' : use_sim,
                   'map' : map_file_name,
                   'autostart' : 'true',
                   'slam' : do_mapping,
                   'params_file' : [configured_params]


jorgemia gravatar image jorgemia  ( 2022-07-19 06:22:52 -0500 )edit

Question Tools



Asked: 2022-01-25 12:30:48 -0500

Seen: 3,476 times

Last updated: Jan 25 '22