Portrait of Nils Kuhn

Learning ROS 2: Swarm Controller

To learn ROS 2 hands-on, I built a small “drone show” in Gazebo: a variable number of drones can be spawned and commanded into either a circle or a line formation. The user can scale the formation size and receives feedback on how many drones have reached their target positions.

TL;DR

Demo

Drone action
Gazebo drone show: circle/line formations with adjustable scale.

System Architecture

The system is structured as a small ROS 2 network with a UI/interface node, a central controller, and one node per drone.

Diagram showing interface node, controller node, and multiple drone nodes connected by ROS 2 topics.
High-level ROS 2 node architecture and topic flow.

Message Flow (Publish / Subscribe)

  1. Interface → Controller: formation type + scale
  2. Controller → Drones: per-drone target position setpoints
  3. Drones → Controller: current positions
  4. Controller → Interface: % of drones in the correct place (action feedback)
  5. Interface: reports goal completion when 100% reached

Results & Learnings