Multi-robot coverage & formation control · ROS 2 ·

Three robots, one map

A central coordinator divides an area between three robots so that every square metre is covered once, with no zone swept twice. Then the same fleet drives as a single V-shaped formation, followers holding their slots behind a leader to within a few centimetres.

robot1 · leader robot2 robot3
MiddlewareROS 2 Jazzy
SimulatorGazebo Harmonic
The keyFleet coordinator
NavigationNav2 × 3
RobotsTurtleBot3 Waffle
RViz map of the arena divided into six zones. Red, green and blue robots each sweep their own zone; finished areas are shaded, and Nav2 costmap inflation glows around each robot
Mid-mission in RViz. Each robot owns its zone (outlined in its colour), covered ground is shaded, and the glow around each robot is its Nav2 costmap.
Z0 · Motivation

Why one robot isn't enough

Cleaning, inspection, mapping and agriculture all come down to the same job: visit every part of an area. One robot does it slowly. Three robots can do it in roughly a third of the time, but only if they don't waste effort sweeping the same ground or get in each other's way.

Fleets also need to move together. Escorting, carrying a load between robots or patrolling in a pattern means holding a fixed shape while moving.

The project builds both behaviours on the same three robots:

  • Collaborative coverage. A central coordinator divides the map into zones and hands them out while the mission runs, so the fleet covers the whole area without duplicated work.
  • Leader-follower formation. Two followers track the leader's pose through TF2 and hold their slots in a V, steering with their own velocity commands.

Everything runs in simulation, built so the same launch files can run on real robots.

Z1 · Components

The stack

LayerToolRole
MiddlewareUbuntu 24.04, ROS 2 JazzyCommunication between every node
SimulatorGazebo HarmonicArena, physics, lidar and wheel odometry
NavigationNav2, one stack per robotLocalization, path planning and path following
CoordinationCustom fleet nodesZone planning and assignment, formation control, fleet health
AvoidanceCustom Nav2 costmap layerMakes each robot treat the others as obstacles
RobotsTurtleBot3 Waffle ×3Differential-drive base with a 360° lidar

Nav2 already knows how to drive one robot from A to B. What it doesn't know is that there are two other robots, where they're going, or what work is left. The coordination layer adds that knowledge.

Z2 · Simulation

One world, three robots

The arena is a 10 × 8 m room with crates, pillars, a bench and a dividing wall. A single description file generates both the Gazebo world and the matching occupancy map, so the map the robots plan on always matches the world they drive in.

Each robot gets its own namespace (/robot1, /robot2, /robot3). Its sensors, velocity commands and complete Nav2 stack live under that namespace, so the three never hear each other's topics. Positions go the other way: all three share one transform tree, with every frame prefixed by its robot's name. Any node can then ask where robot2 is relative to robot1, which formation control depends on.

Gazebo Sim window showing the walled arena in 3D with brown crates, blue pillars and three small robots lined up at the near wall
The arena in Gazebo, robots at their start positions.
Top-down camera view of the arena: grey walls, tan crates, blue pillars, and three robots marked with red, green and blue discs
The same arena from a simulated overhead camera. The coloured discs mark each robot.
Z3 · Architecture

How it fits together

The coordinator sits above three independent navigation stacks. It never steers a wheel itself. It decides where each robot should go next and lets that robot's Nav2 work out how to get there.

The split keeps each part simple. Nav2 handles obstacles, localization and path following for its own robot. The coordinator only has to reason about the fleet as a whole.

Z4 · Coverage

Dividing the map

The coordinator turns the map into a grid of cells, each about the width of one sweep. It then splits the free space into six zones of equal area. There are deliberately more zones than robots, so the plan can change while the mission runs.

Inside each zone it lays out back-and-forth lanes, the pattern a lawnmower follows. The work is handed out in three steps:

  • A fair start. The first three zones are matched to the three robots so the total travel to reach them is as small as possible.
  • Pull, don't push. When a robot finishes its zone, it takes the nearest zone nobody owns yet.
  • Sharing the last of the work. When no free zones remain, an idle robot takes half of the remaining lanes from the robot with the most work left.

Every zone has exactly one owner at a time, and the coordinator keeps a live record of which cells have been covered. A robot skips any lane another robot has already swept. If a robot stops responding, its unfinished work goes back into the pool for the others.

Top-down map of six zones. Zones Z1, Z3 and Z0 are outlined in red, green and blue and assigned to robot1, robot2 and robot3; Z2, Z4 and Z5 are marked free. Thin lines show the planned sweep lanes
24 s in. Three zones are assigned and three are still free. Thin lines are each robot's planned lanes.
The same map with all six zones marked done and shaded in the colour of the robot that covered them; coverage reads 100 percent
Mission complete: 146 of 146 cells covered. Shading shows which robot swept each area.

The finished map shows the dynamic assignment at work. robot1 (red) started in the north-west zone and later took the north-east one. robot2 (green) finished its first zone and moved on to the south-east, and robot3 (blue) took over the remaining south-centre zone.

Assigning zones as the mission runs beats a fixed plan. A robot held up by an obstacle doesn't hold up the fleet, because the others take the remaining work.

Z5 · Formation

Driving as one

For the formation mission, robot1 becomes the leader and drives a 14 m route through the arena with Nav2, including a U-turn at the far end. robot2 and robot3 hold slots 0.8 m behind and 0.7 m to either side, forming a V.

The followers don't get navigation goals. Many times per second, each one:

  • reads the leader's pose and its own from the shared transform tree (TF2),
  • works out where its slot is now and how the slot is moving as the leader drives and turns,
  • steers a point just ahead of itself onto the slot, which works far better than aiming the robot's centre, and
  • publishes a velocity command in its own namespace. The command still passes through Nav2's speed smoothing and collision monitor, so the safety layers stay in place.

Before the march, the robots assemble into the V and turn to face the same way. If a follower drops behind during a turn, the leader slows down until it catches up.

RViz view of the three robots driving in a V formation across the arena, with the leader's planned route drawn as a red line and costmap inflation around each robot
The formation in RViz. The red line is the leader's route.
Overhead camera view: the red leader robot ahead, with the green and blue followers behind it on either side in a V
The same moment from the overhead camera: leader ahead, followers in their slots.
Z6 · Safety

Keeping apart

Nav2 avoids obstacles it can see on its lidar. A TurtleBot3's lidar is mounted on top of the robot, though, and its scan plane passes just over the body of another TurtleBot3. The robots can't see each other.

To fix that, the project adds a custom Nav2 costmap layer, written in C++. Each robot's costmap receives the live positions of the other two and marks them as solid obstacles. Nav2's standard inflation layer then adds a safety margin around them. Planners route around other robots just as they route around a pillar, and the marks move with the robots every update.

Sensors only see what's in their field of view. When the fleet already knows where its robots are, sharing that knowledge is more reliable than hoping each sensor sees the others.

Z7 · Results

The results

An end-to-end runner starts both missions, records every pose and takes a snapshot at each stage. It only reports success if every check passes. The final run:

100%area covered
146/146 cells in 269 s
2.5 cmmean formation error
13.7 cm worst case
0failed navigation goals
across both missions
Two plots of robot paths. Left, coverage: red, green and blue back-and-forth sweep lines filling the arena with little overlap. Right, formation: three parallel paths running east, turning together through a U-turn and returning west
Every path driven. Left: coverage, with each robot sweeping its own lanes. Right: the formation keeping three parallel tracks through the U-turn.
Line chart of each follower's distance from its formation slot over about 130 seconds. Both stay under 6 cm almost everywhere, peaking near 13 cm for robot2 during the U-turn
Distance from each follower to its slot during the march. The rise between 50 s and 85 s is the U-turn, where robot2 is on the tight inside of the curve.
Z8 · Next

Toward hardware

The simulation was built to carry over to real robots. The real-robot launch files reuse the same navigation and fleet nodes with simulation time turned off. Each TurtleBot3 runs its drivers under the same namespace and frame names as its simulated twin, and a base station runs the shared map, the coordinator and the formation controller. Real-world testing on physical robots is the next step.

HOME · Summary

Key takeaways

Multi-robot fundamentals

  • Namespaces keep robots apart. A shared transform tree lets them know where each other are.
  • A fleet needs one place that owns the plan.
  • Every piece of work should have exactly one owner at a time.

Coordination

  • More zones than robots makes dynamic assignment possible.
  • Let idle robots pull work instead of pushing a fixed plan.
  • Plan for robots dropping out from the start.

Control and safety

  • Steering a point just ahead of the robot makes formation tracking simple and stable.
  • Custom controllers should still go through the existing safety layers.
  • Shared fleet knowledge can fill gaps in what each sensor sees.

Where it goes next

  • Deployment on physical TurtleBot3s.
  • Larger fleets and mapping unknown areas.
  • Formations that change shape around obstacles.
? · Questions

Frequently asked questions

How do multiple robots cover an area without overlapping?

A central fleet coordinator divides the free space into six equal-area zones, more zones than robots. Each zone has exactly one owner at a time, the coordinator keeps a live record of covered cells, and a robot skips any lane another robot has already swept.

How are coverage zones assigned to the robots?

The first three zones are matched to the three robots to minimise total travel. When a robot finishes, it pulls the nearest unowned zone. When no free zones remain, an idle robot takes half of the remaining lanes from the robot with the most work left. If a robot stops responding, its unfinished work goes back into the pool.

How does leader-follower formation control work in ROS 2?

The followers get no navigation goals. Many times per second each one reads the leader's pose and its own from the shared TF2 transform tree, computes where its slot is and how it is moving, steers a point just ahead of itself onto the slot, and publishes a velocity command that still passes through Nav2's velocity smoother and collision monitor.

How do you run several Nav2 stacks in one simulation?

Each robot gets its own namespace (/robot1, /robot2, /robot3) with its own sensors, velocity commands and complete Nav2 stack, while all three share one transform tree with frames prefixed by the robot name, so any node can ask where one robot is relative to another.

Why can't TurtleBot3 robots see each other on lidar, and how is that fixed?

The TurtleBot3 lidar scan plane passes just over the body of another TurtleBot3. A custom Nav2 costmap layer written in C++ marks the live positions of the other robots as obstacles, and the standard inflation layer adds a safety margin around them.

What results did the simulation achieve?

100% of the area covered (146 of 146 cells in 269 s), a mean formation error of 2.5 cm with a 13.7 cm worst case during the U-turn, and zero failed navigation goals across both missions.