Implementation Guides
Drone Show & Swarm Coordination
Choreographed light shows, formation flying, and multi-drone swarm operations. From simulation to synchronized real-world flight with 2 to 100+ drones.
Jargon Buster
Swarm vs Drone Show
Drone show: Pre-choreographed — every drone follows a scripted waypoint path with timed LED colors. Like synchronized swimming. Swarm: Reactive — drones make real-time decisions based on leader commands, neighbor positions, or sensor data. Like a flock of birds. Different problems, different software.
MAVSDK
MAVLink SDK. A high-level Python/C++ API for controlling PX4/ArduPilot drones. The standard way to send commands (takeoff, goto, land) programmatically. Simpler than raw MAVLink. One MAVSDK instance per drone.
SITL
Software-In-The-Loop. Runs the full PX4/ArduPilot firmware on your PC without hardware. Simulates physics, GPS, IMU. Essential for testing swarm code before flying real drones. One SITL instance per simulated drone.
Formation Origin
The GPS coordinate that serves as (0,0,0) for the formation. Each drone's position is defined as a NED (North-East-Down) offset from this point. Set once before the show, all drones calculate their positions from it.
Choreography / Shape File
A CSV or JSON file defining where each drone should be at each timestamp. Created in Blender, SkyBrush, or custom tools. Columns: time, drone_id, north, east, down, red, green, blue. The "sheet music" for the show.
Leader-Follower
A swarm pattern where one drone (leader) flies a path and followers maintain fixed offsets relative to it. The leader can be human-controlled or autonomous. Followers need position of leader + their offset — that's it.
HW_ID
Hardware ID. A unique integer (1, 2, 3...) assigned to each drone. It determines which row of the choreography CSV this drone follows, which MAVSDK port it connects on, and which position in the formation it takes.
SkyBrush
A Blender add-on for designing drone show choreographies. Export 3D animations as waypoint CSVs. The MDS (MAVSDK Drone Show) project can import SkyBrush output directly. Open-source alternative: write CSV by hand or use custom Python scripts.
Time Synchronization
All drones must agree on what time it is — sub-second accuracy. GPS provides this via PPS (pulse per second). Without sync, drones will be in different positions at the "same" moment. NTP over mesh works for coarse sync, GPS PPS for fine.
Collision Avoidance
In a show, the choreography guarantees safe separation. In a swarm, you need active avoidance — each drone monitors neighbor positions and adjusts path. ORCA (Optimal Reciprocal Collision Avoidance) is the standard algorithm.
Swarm Software Stacks
Choose your stack based on what you're doing: choreographed show, reactive swarm, or research.
| Stack | Type | FC Support | Stars | Best For | Link |
| Skybrush (Server + Live + Studio) | Show platform | PX4 / ArduPilot | 114+106+79 | Industry-standard open-source drone show framework. Server backend, React GCS frontend, Blender choreography addon. Active daily development. Updated Mar 2026. | Server · GCS · Blender |
| MDS (MAVSDK Drone Show) | Show + Swarm | PX4 | 274 | All-in-one drone show + smart swarm. Docker SITL, React GCS, SkyBrush import, LED control, leader-follower clustering. Free for <10 drones. | GitHub |
| DSSE (Drone Swarm Search Env) | RL Training Env | Simulated | 68 | Multi-agent RL for SAR missions. PettingZoo-based. Maritime search with dynamic probability matrices. Published JOSS + arXiv. pip install DSSE | Env · Algorithms · Paper |
| Crazyswarm2 | Research swarm | Crazyflie | 300+ | USC ACTS Lab. Gold standard for swarm research on Crazyflie nano-quads. 49+ drones. ROS2. | GitHub |
| ORCUS | Tactical swarm | ArduPilot | 27 | Autonomous kamikaze swarm — area surveillance + target engagement. YOLO detection, pixel-to-GPS, task allocation. ArduPilot SITL + ROS + Gazebo. | GitHub |
| CoFlyers | Research platform | Crazyflie / Tello | 33 | General platform for collective flying. MATLAB/Simulink + real hardware. Bio-inspired swarming behaviors. | GitHub |
| Swarm-LIO2 | Multi-robot SLAM | PX4/ArduPilot | 200+ | HKU-MARS. Multi-drone LiDAR SLAM with inter-drone loop closure. Decentralized mapping. | GitHub |
| Lumifly DroneShow | Show (indoor) | PX4 (ROS) | 0 | Indoor light shows via ROS + Gazebo. U. of Turku capstone. ROS-based swarm learning resource. | GitHub |
| 3D Drone Show Visualizer | Visualization | N/A | 0 | Three.js browser-based 3D choreography previewer. | GitHub |
| Hivemind (Shield AI) | Tactical swarm | Proprietary | N/A | Production autonomous swarm AI. V-BAT Teams. Not open-source but sets the bar. | Proprietary |
Quick Start: MDS (MAVSDK Drone Show)
The fastest path from zero to a simulated 10-drone light show. All in Docker — nothing to install except Docker itself.
# ═══ MDS SITL DEMO — 10 DRONES IN SIMULATION ═══
# 1. Clone the repo
git clone https://github.com/alireza787b/mavsdk_drone_show.git
cd mavsdk_drone_show
# 2. Install Python deps (3.11-3.13)
pip install -r requirements.txt
# 3. Run the SITL demo (starts 10 PX4 instances in Docker)
# See: docs/guides/sitl-comprehensive.md for full walkthrough
python3 multiple_sitl/multi_sitl_runner.py --num-drones 10
# 4. Start the GCS server (React dashboard)
cd gcs-server && python3 app.py
# 5. Open browser: http://localhost:5000
# You'll see 10 drones on a map, ready to fly formation
# 6. Load a shape file (CSV choreography)
# shapes_sitl/ has pre-made formations
# Or design your own in Blender + SkyBrush
# 7. Hit "Start Show" in the dashboard
# Drones take off, fly to formation positions, execute choreographyMDS SITL
Why MDS? It handles the hard parts: MAVSDK connection management per drone, time synchronization, formation origin calculation (GPS ↔ NED conversion), LED color control, failsafe behaviors, and a web dashboard. You focus on choreography design, not plumbing.
Creating Choreographies
# ═══ SHAPE CSV FORMAT (config.csv) ═══
# Each drone has its own row. Columns define position offsets from origin.
# hw_id, pos_id, x, y, z, ...
# hw_id: Hardware ID (matches physical drone)
# x: North offset (meters from formation origin)
# y: East offset (meters)
# z: altitude (positive = up)
# Example: 5-drone line formation at 10m altitude
1, 1, 0.0, 0.0, 10.0
2, 2, 0.0, 3.0, 10.0
3, 3, 0.0, 6.0, 10.0
4, 4, 0.0, 9.0, 10.0
5, 5, 0.0, 12.0, 10.0
# For animated shows, use time-stamped waypoints per drone:
# shapes/ folder contains CSV files with columns:
# timestamp, north, east, down, red, green, blueCSV Format
# ═══ GENERATE CHOREOGRAPHY WITH PYTHON ═══
import numpy as np
import csv
num_drones = 20
radius = 15 # meters
# Circle formation
with open('shapes/circle_20.csv', 'w') as f:
writer = csv.writer(f)
for i in range(num_drones):
angle = 2 * np.pi * i / num_drones
north = radius * np.cos(angle)
east = radius * np.sin(angle)
alt = 20.0
# RGB: rainbow colors around the circle
r = int(127 + 127 * np.sin(angle))
g = int(127 + 127 * np.sin(angle + 2.094))
b = int(127 + 127 * np.sin(angle + 4.189))
writer.writerow([0, north, east, -alt, r, g, b])
# For animated shows: multiple rows per drone with timestamps
# t=0: circle, t=5: expand, t=10: star, t=15: landPython
Blender + SkyBrush: For complex shows, design in Blender — animate point objects along paths, assign LED colors as material properties. Export via SkyBrush add-on to CSV. MDS imports SkyBrush output directly.
skybrush.io
Leader-Follower Swarm
MDS supports real-time smart swarm mode — one leader drone is controlled manually or via mission, followers maintain formation relative to the leader.
# ═══ MDS SMART SWARM — LEADER-FOLLOWER ═══
# smart_swarm_src/ contains the swarm logic
# Each drone runs drone_show.py which checks its role:
# - Leader: flies its own mission or is manually controlled
# - Follower: queries leader position + maintains offset
# Configuration in config.csv:
# Set 'swarm' column to group ID (1, 2, 3...)
# Set 'is_leader' to 1 for the leader of each group
# Followers maintain their (x, y, z) offset relative to leader
# Multi-group example:
# Group 1: drone 1 (leader), drones 2-4 (followers)
# Group 2: drone 5 (leader), drones 6-8 (followers)
# Groups operate independently — fly different missions
# Communication: followers poll leader position via GCS server
# Mesh radio recommended for field deployment (see Mesh Guide)Leader-Follower
Real Hardware Deployment
Simulation first, always. Run your full choreography in SITL before touching real hardware. MDS supports 100+ simulated drones. If it works in sim, it'll work in the field (minus wind and GPS errors).
# ═══ REAL HARDWARE CHECKLIST ═══
# Per-drone hardware:
# □ PX4 flight controller (Pixhawk, Orqa H7, etc.)
# □ GPS module (RTK preferred for ≤2cm accuracy)
# □ Companion computer (RPi 4/5 is sufficient for MDS)
# □ WiFi or mesh radio (all drones + GCS on same network)
# □ LED strip (WS2812B) for light shows — controlled via companion
# □ Unique HW_ID set on each companion (file or env var)
# Per-drone software:
# □ PX4 firmware (latest stable)
# □ Python 3.11+ on companion
# □ MDS installed: git clone + pip install -r requirements.txt
# □ config.csv with correct HW_ID and formation offsets
# □ shapes/ folder with choreography CSV
# GCS:
# □ Laptop running gcs-server (Flask + React dashboard)
# □ Connected to same network as all drones
# □ QGroundControl as backup (multi-vehicle view)
# Critical PX4 parameters (per drone):
# COM_RCL_EXCEPT = 4 (allow offboard without RC)
# NAV_RCL_ACT = 0 (RC loss → continue mission)
# MAV_SYS_ID = HW_ID (unique per drone)Hardware
Time Synchronization
# ═══ TIME SYNC — THE MAKE-OR-BREAK FOR SHOWS ═══
# Option 1: GPS PPS (best — sub-microsecond)
# PX4 syncs internal clock to GPS time automatically
# Companions sync via chrony or gpsd + PPS kernel module
# Option 2: NTP over mesh network (good — 1-10ms)
# GCS runs NTP server, all companions sync to it
sudo apt install chrony
# /etc/chrony/chrony.conf on GCS:
# local stratum 1
# allow 192.168.168.0/24
# On each drone companion:
# server 192.168.168.1 iburst
# Option 3: MDS built-in sync (simplest)
# MDS uses GCS server time as reference
# Each drone fetches server time at startup and offsets
# Good enough for formations. Not precise enough for tight shows.
# Rule of thumb:
# 10ms sync error = ~0.3m position error at 30 m/s
# For shows with 2m separation: NTP is fine
# For shows with 0.5m separation: need GPS PPSTime Sync
3D Show Preview
Preview your choreography in the browser before flying. The
3d-drone-show project renders formations in Three.js — load your CSV, scrub the timeline, verify spacing.
# ═══ 3D PREVIEW IN BROWSER ═══
git clone https://github.com/lucianotonet/3d-drone-show.git
cd 3d-drone-show
npm install
npm run dev
# Open http://localhost:5173
# Load your choreography CSV
# Scrub timeline, rotate view, check spacing
# Red dots = collision risk (drones closer than safety threshold)
# Alternative: MDS GCS dashboard has built-in 2D formation view
# Alternative: Blender viewport (if using SkyBrush)Preview
Indoor Swarm (ROS + Motion Capture)
Indoor shows don't have GPS. You need external position tracking (motion capture / UWB / LiDAR SLAM) fed to each drone's FC as external position.
# ═══ INDOOR SWARM WITH OPTITRACK / VICON ═══
# Motion capture system provides position of each drone at 120+ Hz
# Pipe to PX4 via MAVROS vision_pose (same as SLAM guide)
# The Lumifly approach (sumietgore/DroneShow):
# 1. ROS master on GCS PC
# 2. Each drone runs MAVROS + position relay node
# 3. Choreography node publishes target positions per drone
# 4. Position controller on each drone tracks the target
# Without motion capture — use LiDAR SLAM (see SLAM Guide):
# Each drone runs FAST-LIO2 → MAVROS → PX4 LOITER mode
# Swarm coordinator sends target positions over mesh/WiFi
# Drone-to-drone relative positioning via UWB beacons (DWM1001)
# UWB ranging for relative formation:
# Each drone has a DWM1001 module ($15)
# Measures distance to neighbors (±10cm accuracy)
# No infrastructure needed — peer-to-peer rangingIndoor
Swarm Safety
Mandatory failsafes for multi-drone operations:
• Geofence: All drones must have PX4 geofence set. If any drone leaves the fence, it RTLs or lands.
• Kill switch: GCS must have a "land all" button. MDS dashboard has this built in.
• Battery monitor: Each drone should auto-land if battery drops below threshold. Set BAT_LOW_THR in PX4.
• Link loss: If a drone loses GCS connection, it should hold position and land after timeout — NOT RTH (RTH into a formation = collision).
• Minimum separation: Choreography must maintain ≥2m between any two drones at all times. Validate in 3D previewer before flying.
• Sequential startup: Take off drones one at a time (or in small groups), not all at once.
• Manual override: Always have one operator per 5-10 drones with RC override capability.
The full swarm pipeline: Design choreography (Blender/Python/CSV) → Preview (3D visualizer) → Simulate (MDS SITL, 10-100 drones) → Deploy (companion + PX4 per drone, mesh network, GCS dashboard) → Fly. Combine with Mesh Guide for comms, TAK Guide for ground SA, SLAM Guide for indoor GPS-denied ops.
Back to Implementation Guides