Home▸AI & Machine Learning▸Drone Swarm Formation Control — Distributed Consensus (2D)

Drone Swarm Formation Control — Distributed Consensus (2D)

A 2D drone swarm that holds a real formation shape using a distributed consensus control law over a limited-range communication graph, plus a repulsive potential field for obstacle avoidance — distinct from generic boids flocking.

AI & Machine Learning2DAdvanced60 FPS📱 Mobile-adapted⇄ 3D version
2d-drone-swarm-coordination ↗ Open standalone

This 2D companion to the 3D drone swarm visualization implements a genuine formation-keeping mechanism instead of formation morphing: a distributed consensus control law drives every drone toward a fixed target offset from a moving virtual leader, using only local communication with neighbours inside a limited comm radius — one drone is pinned directly to the leader's goal, and the rest converge purely by averaging formation error with whoever they can currently reach on the communication graph. A separate repulsive potential field handles obstacle avoidance on top of the consensus law. Switch between wedge, circle, diamond and line formations, shrink the comm radius to watch the graph fragment and the shape degrade, or scatter the swarm to see the control law pull it back into formation from disorder.

⚙ Under the hood

A 2D companion to the 3D drone swarm visualizer that implements real formation-keeping instead of formation morphing: a distributed consensus control law drives each drone to a fixed offset from a moving virtual leader using only a limited-range communication graph, plus a separate repulsive potential field for obstacle avoidance -- distinct from generic boids flocking, which this is not.

drone swarmformation controldistributed consensusmulti-agent systemspotential fieldobstacle avoidancerobotics

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)