
To the best of knowledge, ROS graph isolation in ROS1 relies on namespaces. So if you've consistently used relative names, you should be able to <include/> an entire launch file hierarchy from within a <group/>, which allows you to set a namespace (see http://wiki.ros.org/roslaunch/XML/group). If you haven't, or if you rely on code that doesn't (e.g. tf2 is likely hitting /tf and /tf_static), you can explicitly <remap/> within each group (see http://wiki.ros.org/roslaunch/XML/remap). Some node in the root namespace can then target any topic using fully qualified names.
Originally posted by hidmic with karma: 121 on 2021-03-30
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by os on 2021-03-31:
Is there a way to this globally without edit each launch file? In my project, I have multiple lanch and I try to find out if there is an easy way to do this?
Can the remapping/group adding be done dynamically?
Comment by gvdhoorn on 2021-03-31:
Dynamic remapping is not supported in ROS 1. There are plans for ROS 2. But I believe you're not necessarily asking for remapping at runtime, only remapping without editing files.
Remapping launch files can be done external to the .launch file, by adding an ns attribute to the include element.
Comment by os on 2021-03-31:
@gvdhoorn So in order to avoid editing all my .launch files, I need to create a new launch that will load the others, and in that primary launch add the ns attribute?
Comment by hidmic on 2021-03-31:
That's about right. Moreover, if the same launch files are deployed to different robots, launch arguments and/or $(env) substitutions are a simple way to parameterize and reuse the same top-level .launch.