A definitive guide to launching multi-robot operations in ROS2
Disclaimer that I know this question strays from the typical ROS Answers format a fair bit. But I still think this is a better medium to have this discussion than, say, ROS Discourse.
I've looked around a fair bit, and have yet to see a single "definitive" and up-to-date discussion of the steps that you need to consider to successfully launch multiple robots in ROS2. There are a number of questions already on ROS Answers, and elsewhere, that discuss things like namespaces, frame_prefix (recently readded), GroupActions, remapping topics, gazebo plugin considerations, etc, as well as a number of examples that have been posted (e.g. by Nav2, theConstruct, and others), but I feel like they are often a bit light on the "why" aspect of what's going on. I think it would be valuable to have a single resource that includes an overview of all the aspects that need to be considered, particularly when moving from a single robot to multiple robots, and of any "best practices" that people have developed.
Some questions that I've come across that would be worth answering for new users:
- When to use namespaces vs remapping? When might you need to use both?
- When its worth using
GroupAction
- When should you use
frame_prefix
? When should you add a prefix directly in your URDF/Xacro files? - Where do you need to apply a
frame_prefix
or namespace? (Gazebo plugins, ros2_control config files, robot_state_publisher)? - What are the best ways to avoid redundant definitions of robot parameters (e.g. in config files that could be identical except for a prefix or ID parameter)?
- When should you use fully qualified vs relative names? Are there any common cases other than /tf where you would not want to use relative topic names?
- When should you use a single tf tree for all robots, and when should you use a different tf tree for each robot?
- What considerations should you take when writing an Xacro file to ensure you can easily extend from single-robot to multi-robot use cases?
- What's the best way to spawn multiple robots in Gazebo?
I'd be happy to take a stab at answering some of these items myself, but really I'd like to hear from people with more experience to glean from their working experience. If anyone has any additional questions, please comment them below and I can add them to the list. I'd also be happy to compile feedback into a single wiki or tutorial type document.
Thanks in advance!
According to p/robot_state_publisher/github-ros-robot_state_publisher, the parameter is called
frame_prefix
now. Nottf_prefix
.Noted - thanks for the correction