Four drones, each with an assigned target slot in a desired formation, navigate from their start positions to the formation while respecting a minimum-separation constraint with each peer. The controller is distributed: every drone runs an attractive-to-slot term plus a peer-repulsion term and clips at a max-speed bound. The page demonstrates two formations the controller solves cleanly (rotated square, horizontal line) and one it does not (cross-swap), making the limitation of distributed peer-repulsion explicit.
For each drone i with position p_i and target slot t_i, the desired velocity is
v_i = k_target · (t_i − p_i) / max(‖t_i − p_i‖, 0.5)
+ Σ over peers j ≠ i with d_ij < r_repel
k_repel · ( 1/d_ij − 1/r_repel ) · (p_i − p_j) / d_ij
, clipped to ‖v_i‖ ≤ v_max
Implementation: k_target = 1.2, k_repel = 4.0, r_repel = 0.8 m, v_max = 0.6 m/s, integrated by forward Euler at dt = 0.1 s. The attractive term is normalised so that drones do not over-shoot when far from their slot; the repulsive term has the same 1/d² shape as the single-agent potential field on the previous page.
Same starting square, three target formations of increasing difficulty. Each panel shows initial positions (faded circles), trajectories (faded lines coloured by drone identity), final positions (diamonds), and target slots (X markers).
| Target formation | Outcome | Steps | Min separation |
|---|---|---|---|
| rotated square | success | 51 | 2.89 m |
| horizontal line | success | 110 | 0.89 m |
| cross-swap | deadlock | 400 (cap) | 0.65 m |
Cross-swap, where each drone is assigned the slot diagonally opposite its start, is the canonical failure case for distributed-controller formation. Each drone wants to head toward the centre of the swarm, but every other drone repels them on the way, so the four drones converge toward the centre and stall. The repulsive forces sum to zero only when all four are equidistant from the geometric centre, which is a different configuration from the desired formation.
Minimum pairwise distance between drones, plotted over the simulation. The horizontal-line formation passes close to the safety threshold around step 50 as the four drones rearrange themselves; the cross-swap saturates near the threshold and stays there. The rotated-square case has nothing to negotiate. The assignment is collision-free at every moment.