FloLogix AI

Technology · Notes

How a drone swarm holds its shape.

Six steps, from one drone flying to a point to a formation that expands with no drone knowing the whole plan. Every equation is the one from the paper — nothing simplified away — and every step has something you can drag.

The payoff is at step five, and it is worth knowing in advance: the law that flies one drone to one point turns out to be the correction term inside the controller that flies the whole formation. Part one is not a warm-up. It is the part.

Step 1

A drone that always flies toward where it should be

Point at a spot and ask a drone to go there. The simplest honest rule is: look at how far off you are, and fly in that direction at a speed proportional to the distance. Far away, hurry. Close, ease off.

Write the error as the gap between where it should be and where it is, and the rule is one line. The gain k is the only dial: how hard the drone reacts to being wrong.

u = k·e = k(p* − p)
(4)

What comes out of this is not a straight-line dash that stops. The distance shrinks by the same fraction every second, which is an exponential — so the drone never quite arrives, and never overshoots. Raise k and the curve tightens.

p(t) = p* + (p(0) − p*)·e−kt
(5)
Drag anywhere to move the goal.
Step 2

Real drones have a top speed

The rule above says a drone a kilometre away should fly at a thousand times the speed of one a metre away. Real aircraft cannot. So cap the command — but cap the magnitude and keep the direction, or the drone starts flying somewhere other than at its goal.

u = ke  if  k‖e‖ ≤ vmax,   otherwise  vmax·e/‖e
(7)

The motion now has two acts. Flat out in a straight line while the cap binds, then the exponential from step one takes over and it settles in. The dashed line marks the handover.

Lower the cap and the dashed line moves right.
Step 3

Stop thinking about drones. Think about a shape.

Three drones in a triangle have nine numbers between them. But nobody commanding them thinks in nine numbers — they think: put the triangle there, point it that way, make it this big.

So describe the formation as a rigid body with a template of fixed offsets, and give it three properties: a centroid, an orientation, and a scale. Every drone’s position falls out.

pi = c + s·R·ri
(10)

This is the same move as a robot arm: joint angles in, gripper position out. Seven numbers describe the body; the drones follow.

Drag to move the centroid.
Step 4

How fast does each drone fly when the shape moves?

Differentiate the last equation and something tidy happens: each drone’s velocity splits into three independent contributions that simply add.

i = [ I   −si   qi ]·(ċ, ω, ṡ)
(12)

Translation passes straight through — move the shape, every drone moves the same. Rotation contributes a velocity across each drone’s offset, so outer drones swing faster. Scaling pushes each drone straight out along its own offset.

That matrix is the formation Jacobian. Switch the terms off one at a time and you are looking at its columns.

Turn off translation and rotation: every arrow points straight out from the centroid, and the outer drones’ arrows are longer. That is scaling.

Step 5

The whole thing, and where step one comes back

To expand in place, hold the centroid and the orientation still and let only the scale change — approaching its target the same exponential way a single drone approached its goal.

ṡ = λ(s* − s)
(16)

Every drone then flies outward along its own ray, at a speed proportional to how far out it sits. The shape is preserved exactly.

But the Jacobian only says where a drone should be going. Wind exists. So the real command is that prediction, plus a correction for wherever the drone actually is:

ui = ċ + ṡRri + ω × (sRri) + k(p*ipi)
(14)

Look at the yellow term. That is step one, unchanged — the same law that flew one drone to one point, now correcting one drone against a target that is itself moving. Each drone’s error still decays as e−kt, so the convergence proof from part one applies drone by drone.

Knock a drone off station below and watch: the formation carries on expanding, and step one drags the stray back.

Drag to knock drone 1 off station.
Step 6

Nobody knows the whole plan

Everything so far assumed each drone knows the formation state. Over a radio link, at range, that assumption fails.

So give each drone only its neighbours, and let it hold a private guess at the scale. Each drone nudges its guess toward its neighbours’; one leader is told the real target.

ŝ̇i = −γ Σj∈N(i)i − ŝj) + leader input
(20)

The guesses agree, and the swarm expands together — with no drone ever holding the whole picture. There is one condition, and it is the interesting one: the graph must stay connected. Cut a link and the two halves agree on different answers.

Cut the link and the two halves converge to different scales. The formation tears — which is why connectivity is a requirement, not a nicety.

What this is, and is not

This is the kinematic layer: it treats velocity as the thing you command and leaves thrust, attitude and aerodynamics to the flight controller underneath. It is the layer where formation logic lives, and it is deliberately the boring part — textbook robotics, published here in full because none of it is the hard bit.

The hard bit is everything around it: what happens when a link drops mid-manoeuvre, how an operator commands a swarm without micromanaging it, what a safe envelope means when the aircraft disagree about where they are. That work stays ours.

Every equation above is implemented in lib/kinematics.ts and covered by tests, including one that checks the Jacobian against a numerical derivative of the forward map — so the arrows you dragged are provably the derivative of the shape you dragged.