Simulation and trajectory-conflict checking
UAT 464 Drone Light Show and Aerial Formation Display Technology
Lesson
By the end of this module you will be able to
- Compare the levels of simulation (design-software preview, kinematic, closed-loop dynamics, ground test, rehearsal flight) and state what each can and cannot confirm
- Simulate trajectory tracking of one vehicle to estimate the per-axis tracking error as a function of wind
- Calculate the minimum separation required from body size, tracking error, a risk target and a vertical factor for downwash
- Calculate the closest approach of every pair of drones exactly over a move (not just at sample points) and use a lower bound to screen out safe pairs
- Choose a formation spacing that passes, and explain why a random experiment cannot prove a very low risk
Why this matters
A real show flies once a night, but in a computer it can fly a thousand times. Designers therefore place their confidence in simulation. But simulations are not all the same. One that checks whether paths cross is a different matter from one that checks how well a drone’s controller follows a path, and neither is a rehearsal flight. A person who does not know what each kind of simulation can confirm sends 300 drones into the sky with confidence that has no basis. This module therefore sorts the levels of simulation first, then goes deep on the most important question for a show, trajectory-conflict checking: proving with numbers that no pair of drones comes closer than a safe distance at any moment of the show.
All numbers belong to the “Lotus in the Lake” case, continuing from Modules 1 to 3, and are assumed for learning. The module does not prove that a real show is safe. It shows how to build each kind of evidence and how far each kind reaches. The theory of decentralised collision avoidance for multi-UAV systems in general is in UAT 461, and the controller of a single vehicle is in UAT 461. The Python code can be downloaded from /downloads/uat-464/.
Levels of simulation
Simulation has several levels. Each answers a different question, and the data handed between them must agree on coordinate system, time and units. The documentation of Skybrush Studio states that the design software checks the safety of the animation in real time at frame level and offers a flight-validation report for the whole show near the end; its checks cover minimum distance between drones, the altitude range and speed limits (CollMot Robotics, n.d.). The same documentation warns that the distance measured is between centres and that the software does not know the physical size of the drones. The table summarises the five levels used in this course.
| Level | Question answered | Example tools | What it cannot confirm |
|---|---|---|---|
| 1 Check in the design software | At which frame are drones too close or too fast? | Skybrush Studio (Safety Check) | Between frames, body size, dynamics |
| 2 Kinematics in our own program | Closest approach of every pair over a move, under the limits | Python (this module) | How the real controller responds |
| 3 Closed-loop dynamics | How well the controller tracks, how error grows with wind | SITL such as ArduPilot SITL, PX4 with Gazebo (PX4 Autopilot, n.d.-a), Crazyswarm2 | Real sensors and radio |
| 4 Ground test | Does the real hardware obey commands and does the link work? | Hardware in the loop (HITL; PX4 Autopilot, n.d.-b), drones with propellers removed | Real flight in wind and real GNSS |
| 5 Rehearsal flight | Does the whole system work in real conditions? | Flights with data logging | Events rarer than the number of rehearsals |
The simulation tools knowledge unit of this project advises separating the roles of the planner, the physics and the controller, and recording the model version, time step and firmware version every time so that others can repeat the experiment (for example Crazyswarm2 and ArduPilot SITL for closed-loop simulation; IMRCLab, n.d.; ArduPilot Dev Team, n.d.). Level 3 matters most for getting the tracking error we need in the next section, because it is the number from which all the spacing starts.
Example 1 Simulating trajectory tracking to estimate per-axis error at different wind speeds
One drone follows the quintic trajectory of Module 2 for 60 m in 18.75 s, holds for 10 s, then returns. The controller is PD plus feed-forward (kp = 4, kd = 3.6), the actuator responds with a first-order lag (time constant 0.12 s), the RTK position measurement has 1.2 cm of noise, and wind gusts act as a disturbance acceleration whose standard deviation is 0.08 m/s² per m/s of wind (everything here is an assumed model). Simulate at winds of 0 to 8 m/s, 10 runs per wind, measure the RMS tracking error, fit a straight line in wind, and choose a design value.
import numpy as np
# Simulate trajectory tracking: a one-axis position loop following a 60 m move out and back under gusty wind (model and all values assumed)
def smooth(u):
u = np.clip(u, 0.0, 1.0)
return 10 * u**3 - 15 * u**4 + 6 * u**5, 30 * u**2 - 60 * u**3 + 30 * u**4, 60 * u - 180 * u**2 + 120 * u**3
def reference(t, d=60.0, T=18.75, t1=5.0, t2=28.75):
"""reference position, velocity, acceleration: out d metres (from t1), hold, back (from t2)"""
if t < t2:
s, v, a = smooth((t - t1) / T); inside = 0.0 <= (t - t1) / T <= 1.0
return d * s, (d * v / T if inside else 0.0), (d * a / T**2 if inside else 0.0)
s, v, a = smooth((t - t2) / T); inside = 0.0 <= (t - t2) / T <= 1.0
return d * (1 - s), -(d * v / T if inside else 0.0), -(d * a / T**2 if inside else 0.0)
def run(wind, seed, kp=4.0, kd=3.6, tau=0.12, sig_gnss=0.012, c_gust=0.08, dt=0.02, t_end=57.5):
rng = np.random.default_rng(seed)
p = v = a = gust = 0.0
err = []
for k in range(int(t_end / dt)):
pr, vr, ar = reference(k * dt)
a_cmd = kp * (pr - (p + rng.normal(0, sig_gnss))) + kd * (vr - v) + ar # PD plus feed-forward
a += (a_cmd - a) * dt / tau # actuator lag (first order)
gust += -gust * dt / 3.0 + c_gust * wind * np.sqrt(2 * dt / 3.0) * rng.normal() # gusts as a disturbance acceleration
v += (a + gust) * dt
p += v * dt
err.append(p - pr)
return np.array(err)
winds = np.array([0.0, 2.0, 4.0, 6.0, 8.0]) # m/s, wind at show height
sig = []
for w in winds:
e = np.concatenate([run(w, s) for s in range(10)])
sig.append(np.sqrt(np.mean(e ** 2)))
print(f"wind {w:3.0f} m/s: tracking error RMS {sig[-1]:.3f} m, worst {np.abs(e).max():.3f} m")
slope, icpt = np.polyfit(winds, sig, 1)
print(f"fit: sigma(w) = {icpt:.3f} + {slope:.4f} w (m per axis, w in m/s)")
sigma_design = 0.10 # design value, rounded up from the simulation
print(f"sigma = {sigma_design:.2f} m is reached at about {(sigma_design - icpt) / slope:.1f} m/s of wind at show height")
wind 0 m/s: tracking error RMS 0.065 m, worst 0.132 m
wind 2 m/s: tracking error RMS 0.071 m, worst 0.196 m
wind 4 m/s: tracking error RMS 0.093 m, worst 0.286 m
wind 6 m/s: tracking error RMS 0.124 m, worst 0.430 m
wind 8 m/s: tracking error RMS 0.158 m, worst 0.574 m
fit: sigma(w) = 0.055 + 0.0119 w (m per axis, w in m/s)
sigma = 0.10 m is reached at about 3.8 m/s of wind at show height
The per-axis tracking error rises from 0.065 m in calm air to 0.093 m at 4 m/s and 0.158 m at 8 m/s. The worst error over all runs is about three times the RMS (0.286 m at 4 m/s). The fitted line is , and the design value m corresponds to a wind of about 3.8 m/s at show height. The 0.10 m is therefore a value rounded up from the simulation and tied to a wind condition, not a constant of nature. A caution: this is a very simple one-axis model. A real team must measure with SITL running the real firmware, confirm it from rehearsal logs, and use the measured value instead. This number returns in Module 5 when the wind criterion is set.
The minimum separation required
A safe spacing is not a number chosen by feel. It must come from the size of the airframe and the real uncertainty of position. Two drones collide when the distance between their centres is less than the overall body size (the diameter including the prop guard). Each drone’s real position differs from the planned one by a tracking error with standard deviation per axis. If the errors of the two drones are independent (the worst case we deliberately adopt for safety), the relative error per axis is , and the magnitude of the three-dimensional relative error follows a chi distribution with 3 degrees of freedom (if each axis is normal and equal). If the accepted collision risk for the whole show is at most and pairs really come close, the acceptable risk per pair is (a union-bound approximation). The required separation is
where is the inverse cumulative distribution of the chi distribution with 3 degrees of freedom. The error allowance is the second term, which grows with .
Rotor downwash makes the vertical separation larger than the horizontal one. A drone flying directly under another can lose stability. The research of Preiss et al. (2017) models this with an ellipsoid stretched vertically, which for the nano-quadrotors (Crazyflie) used in that work sets radii of 0.12 m horizontally and 0.3 m vertically, a ratio of 2.5. That number is not a value for show drones. A team must measure the vertical factor of its own model. In this lesson we assume and measure distance with the vertical axis stretched, with , so that drones directly below each other must be apart.
Example 2 Minimum separation from a risk target
The overall body size with prop guard is m, the tracking error is m per axis (the design value from Example 1), the accepted collision risk for the whole show is , and 1,000 pairs come close (assumed). Calculate the required separation, see how it changes for of 0.05, 0.15 and 0.25 m, and compute the vertical distance when .
import numpy as np
from scipy.stats import chi
# Required separation: body size plus an allowance for errors, computed from a risk target (assumed values)
d_body = 0.70 # m, drone diameter including the prop guard
sigma = sigma_design # m per axis, design value from Example 1
p_show, n_close = 1e-3, 1000 # accepted collision risk for the whole show and the number of close pairs
p_pair = p_show / n_close
sigma_rel = np.sqrt(2) * sigma # relative error of two independent drones
k = chi.ppf(1 - p_pair, 3) # multiplier from the chi distribution with 3 degrees of freedom (3D error)
allow = k * sigma_rel
s_req = d_body + allow
print(f"risk per pair {p_pair:.1e}: multiplier {k:.3f} sigma, allowance {allow:.3f} m, required separation {s_req:.3f} m")
for sg in (0.05, 0.10, 0.15, 0.25):
print(f"tracking sigma {sg:.2f} m -> required separation {d_body + chi.ppf(1 - p_pair, 3) * np.sqrt(2) * sg:.2f} m")
# downwash: stretch the vertical axis by a factor c (assumed; measure it on the model in use)
c_vert = 1.5
print(f"vertical separation needed directly above another drone: {c_vert * s_req:.2f} m (horizontal {s_req:.2f} m)")
# compare the study with Crazyflie nano-quadrotors: ellipsoid radii 0.12 m horizontal and 0.3 m vertical
print(f"ratio in the cited study: {0.3 / 0.12:.1f} (nano-quadrotors, not show drones)")
risk per pair 1.0e-06: multiplier 5.538 sigma, allowance 0.783 m, required separation 1.483 m
tracking sigma 0.05 m -> required separation 1.09 m
tracking sigma 0.10 m -> required separation 1.48 m
tracking sigma 0.15 m -> required separation 1.87 m
tracking sigma 0.25 m -> required separation 2.66 m
vertical separation needed directly above another drone: 2.22 m (horizontal 1.48 m)
ratio in the cited study: 2.5 (nano-quadrotors, not show drones)
The risk per pair is , the chi multiplier is 5.538 times , and the error allowance is 0.783 m, so the required separation is m, rounded to 1.48 m in the next examples. For of 0.05, 0.15 and 0.25 m the requirement becomes 1.09, 1.87 and 2.66 m, which shows that the tracking error is the main driver of spacing, and the reason to make the controller accurate before squeezing the picture. A drone directly below another must be 2.22 m away (). Note that 1.48 m is less than the 2.0 m starting value of Module 1, but in the vertical direction more than 2.0 m is needed, so pictures in which drones stack vertically may be a problem.
Closest approach of every pair over the move
The check often done in practice is to measure the distance between drones at the start and the end frame of a transition, which is not enough: two drones that start apart and end apart can collide in the middle. The trajectories knowledge unit of this project gives the example of two drones swapping places on a straight line, 2 m apart at both ends yet colliding at the midpoint, and warns that checking only the first and last frames can miss close approaches between frames. If the minimum distance changes a great deal when the sampling interval is reduced, the original time resolution is not enough, and a sampled check must not be presented as a guarantee of separation over the whole interval.
The right method uses a fact from Module 2. If all drones use the same time function, the relative position vector of two drones is with running from 0 to 1, a straight line. The closest approach then has a closed form, and , with no time sampling at all, and it does not depend on which polynomial is used. There is also a much cheaper lower bound. From the triangle inequality, the closest approach within an interval is at least . If the bound is already above the required distance, the pair passes without the detailed calculation. Checking every pair of 300 drones means pairs, which a computer does in a fraction of a second.
Example 3 Sampled checking versus exact checking
Start with the two-drone swap on a line in 2 s (2 m apart at both ends): compute the distance at the ends and the true closest approach with the lower bound. Then build a 300-drone test scene: a change from a horizontal 20 × 15 grid with 3 m pitch at 60 m height to a picture of 5 vertical rings (96, 78, 60, 40 and 26 drones) with 2.0 m spacing along the rings in s, with drone number going to point . Check exactly how many pairs come closer than 1.48 m, and check by sampling every 18.75, 6.25, 1.0 and 0.25 s to see how many pairs are caught.
import numpy as np
from scipy.optimize import linear_sum_assignment
# Closest approach of every pair over a move: two drones first, then 300 (synthetic)
def closest_all(a, b, c=1.0):
"""closest approach of every pair when all drones move on straight lines with one time law; c stretches the vertical axis"""
k = np.array([1.0, 1.0, 1.0 / c])
a, b = a * k, b * k
r0 = a[:, None] - a[None]
dr = (b[:, None] - b[None]) - r0
den = (dr ** 2).sum(-1)
u = np.clip(-(r0 * dr).sum(-1) / np.where(den == 0, 1, den), 0, 1)
d = np.linalg.norm(r0 + u[..., None] * dr, axis=-1)
return d[np.triu_indices(len(a), 1)]
# two drones swap places on a line over 2 s (synthetic)
A0, A1 = np.array([[-1.0, 0, 0]]), np.array([[1.0, 0, 0]])
B0, B1 = np.array([[1.0, 0, 0]]), np.array([[-1.0, 0, 0]])
ends = np.linalg.norm(A0 - B0), np.linalg.norm(A1 - B1)
r0, r1 = (A0 - B0)[0], (A1 - B1)[0]
lower = (np.linalg.norm(r0) + np.linalg.norm(r1) - np.linalg.norm(r1 - r0)) / 2 # lower bound from the triangle inequality
exact = closest_all(np.vstack([A0, B0]), np.vstack([A1, B1]))[0]
print(f"distance at the two ends {ends[0]:.2f} m and {ends[1]:.2f} m, lower bound {lower:.2f} m, exact closest approach {exact:.2f} m")
def make_scene(sp):
counts = [96, 78, 60, 40, 26] # drones on five rings, 300 in total
goal = []
for c in counts:
r = c * sp / (2 * np.pi)
th = 2 * np.pi * np.arange(c) / c
goal += [[r * np.cos(t), 0.0, 60 + r * np.sin(t)] for t in th]
gx, gy = np.meshgrid((np.arange(20) - 9.5) * 3.0, (np.arange(15) - 7) * 3.0)
start = np.column_stack([gx.ravel(), gy.ravel(), np.full(300, 60.0)]) # horizontal grid, 3 m apart
return start, np.array(goal)
start, goal = make_scene(2.0)
S_req = round(s_req, 2) # required separation (m) from Example 1
T = 18.75
shape = lambda u: 10 * u ** 3 - 15 * u ** 4 + 6 * u ** 5
order = np.arange(300) # drone i goes to target i (distance ignored)
exact_bad = int((closest_all(start[order], goal[order]) < S_req).sum())
print(f"numbered order, exact check: {exact_bad} of {300 * 299 // 2} pairs come closer than {S_req} m")
iu = np.triu_indices(300, 1)
for dt in (T, 6.25, 1.0, 0.25):
bad = np.zeros(len(iu[0]), bool)
for t in np.arange(0, T + 1e-9, dt):
p = start[order] + (goal[order] - start[order]) * shape(t / T)
d = np.linalg.norm(p[:, None] - p[None], axis=-1)[iu]
bad |= d < S_req
print(f"sampled every {dt:5.2f} s: {int(bad.sum()):3d} pairs flagged")
distance at the two ends 2.00 m and 2.00 m, lower bound 0.00 m, exact closest approach 0.00 m
numbered order, exact check: 386 of 44850 pairs come closer than 1.48 m
sampled every 18.75 s: 0 pairs flagged
sampled every 6.25 s: 127 pairs flagged
sampled every 1.00 s: 297 pairs flagged
sampled every 0.25 s: 385 pairs flagged
The two drones that swap places are 2.00 m apart at both ends, yet the true closest approach is 0.00 m, and the lower bound also gives 0.00 m. In the 300-drone scene with assignment by number, the exact check finds that 386 of the 44,850 pairs come closer than 1.48 m. Checking only the start and end frames (sampling every 18.75 s) catches 0 pairs, the most dangerous false result. Sampling every 6.25 s catches 127 pairs, every 1.0 s catches 297 and every 0.25 s catches 385, close to 386 but still not complete. The number caught rises with the sampling rate but never reaches the true value with certainty, whereas the closed form gives a single answer that is exact for the straight-line model.
Choosing the formation spacing and screening with the lower bound
A failing transition has two fixes: change the assignment or change the picture. The assignment that minimises the total squared distance (Module 2) removes most of the crossings, and changing the picture means widening the spacing of the points, which costs a bigger picture or more drones. The designer must therefore find the smallest spacing that passes, both at true size and with the vertical stretch factor. Measuring with the stretched vertical axis makes pictures in a vertical plane, where drones are already stacked in vertical columns, stricter than pictures in a horizontal plane. Another option is to delay the start of some drones slightly to avoid crossings. Turpin et al. (2013) do this systematically with priorities and start times, and Huang et al. (2021) adjust the assignment only within the groups of drones involved, but these methods mean the drones no longer arrive at the new picture together, so the effect on the storyboard and the whole conflict check must be redone.
When there are many pairs, a detailed check of every pair in every interval can be slow in a program that repeats many times. The lower bound helps by screening. Compute the lower bound for each short interval (for example 1 s). If the bound of every interval is above the required distance, the pair is certified at once, and only the remaining pairs need the detailed closed-form check.
Example 4 Finding a formation spacing that passes, and screening pairs with the lower bound
Use the 300-drone scene of Example 3 but with the assignment that minimises the total squared distance. Check formation spacings of 2.0, 2.3, 2.5 and 2.6 m both with normal measurement () and with the stretched vertical axis (), looking at the closest approach over the move, the number of pairs below 1.48 m, the closest spacing inside the final picture and the longest move. Then at 2.6 m use the lower bound over 1 s intervals to certify the safe pairs.
# Run both checks on the least-squares assignment, then find the formation spacing that passes
def evaluate(sp, c):
st, go = make_scene(sp)
cost = np.linalg.norm(st[:, None] - go[None], axis=2)
r, col = linear_sum_assignment(cost ** 2)
pair = closest_all(st[r], go[col], c) # closest approach of every pair during the move
static = closest_all(go, go, c).min() # closest spacing inside the final picture
return pair, static, cost[r, col].max()
for sp in (2.0, 2.3, 2.5, 2.6):
for c in (1.0, c_vert):
pair, static, longest = evaluate(sp, c)
print(f"spacing {sp:.1f} m, vertical factor {c:.1f}: closest {pair.min():.3f} m, pairs under {S_req} m: {int((pair < S_req).sum()):3d}, final picture closest {static:.3f} m, longest move {longest:.1f} m")
# screen with the lower bound first: check closely only the pairs whose bound is not yet above the requirement
st, go = make_scene(2.6)
cost = np.linalg.norm(st[:, None] - go[None], axis=2)
r, col = linear_sum_assignment(cost ** 2)
st, go = st[r], go[col]
k = np.array([1.0, 1.0, 1 / c_vert])
iu = np.triu_indices(300, 1)
ts = np.arange(0, T + 1e-9, 1.0)
if ts[-1] < T:
ts = np.append(ts, T)
rel = []
for t in ts:
p = (st + (go - st) * shape(t / T)) * k
rel.append(p[:, None] - p[None]) # relative position vector of every pair
safe = np.ones(len(iu[0]), bool)
for a, b in zip(rel[:-1], rel[1:]):
da, db = np.linalg.norm(a, axis=-1), np.linalg.norm(b, axis=-1)
chord = np.linalg.norm(b - a, axis=-1)
safe &= ((da + db - chord) / 2)[iu] >= S_req # lower bound of the closest approach inside that interval
print(f"pairs certified safe by the 1 s bound: {int(safe.sum())} of {len(safe)}; exact check still needed for {int((~safe).sum())}")
spacing 2.0 m, vertical factor 1.0: closest 1.663 m, pairs under 1.48 m: 0, final picture closest 1.995 m, longest move 37.0 m
spacing 2.0 m, vertical factor 1.5: closest 1.221 m, pairs under 1.48 m: 93, final picture closest 1.334 m, longest move 37.0 m
spacing 2.3 m, vertical factor 1.0: closest 1.822 m, pairs under 1.48 m: 0, final picture closest 2.294 m, longest move 39.4 m
spacing 2.3 m, vertical factor 1.5: closest 1.372 m, pairs under 1.48 m: 11, final picture closest 1.534 m, longest move 39.4 m
spacing 2.5 m, vertical factor 1.0: closest 1.918 m, pairs under 1.48 m: 0, final picture closest 2.494 m, longest move 42.9 m
spacing 2.5 m, vertical factor 1.5: closest 1.457 m, pairs under 1.48 m: 4, final picture closest 1.667 m, longest move 42.9 m
spacing 2.6 m, vertical factor 1.0: closest 1.962 m, pairs under 1.48 m: 0, final picture closest 2.594 m, longest move 43.6 m
spacing 2.6 m, vertical factor 1.5: closest 1.501 m, pairs under 1.48 m: 0, final picture closest 1.734 m, longest move 43.6 m
pairs certified safe by the 1 s bound: 44839 of 44850; exact check still needed for 11
With normal measurement () every spacing passes the 1.48 m criterion, even 2.0 m (closest approach 1.663 m). With the vertical axis stretched by , spacing 2.0 m has 93 pairs below the criterion (closest approach 1.221 m), 2.3 m has 11, 2.5 m has 4, and 2.6 m has none, with a closest approach of 1.501 m, only 0.021 m above 1.48 m. So 2.6 m is chosen as the picture spacing for this scene. At that spacing the same picture gets bigger (the outer ring radius is 39.7 m, up from 30.6 m at 2.0 m, which still fits the 20 to 100 m height of the show volume, but only just) and the longest move grows from 37.0 to 43.6 m. The screening with the 1 s lower bound certifies 44,839 of the 44,850 pairs at once, leaving only 11 pairs that need the detailed check. The key observation is that a closest approach of 1.501 m exceeds the criterion by very little: this show passes only if m, which Module 5 ties to the wind criterion.
Random experiments and the limits of evidence
Once the trajectories pass the closed-form check, the question remains whether the real tracking error causes a collision. A Monte Carlo experiment draws a random error for each drone and counts the runs in which any pair is closer than the body size. This is useful for finding gross mistakes and for seeing the sensitivity to , but it has statistical limits that must be understood. If runs are made and no failure is seen, we can only conclude that the true failure rate is at most an upper bound at 95% confidence, (about ), which for is about 1.5%. Proving a failure rate below by experiment needs almost three million runs, each a simulated flight of 300 drones. (In practice nobody proves a risk this small by random sampling. The evidence is the computed margin from the error distribution as in Example 2, together with the closed-form check and the rehearsal logs.)
Example 5 A random experiment on tracking error for the 300-drone scene at 2.6 m spacing
Use the assignment that passed the checks in Example 4. Draw a constant position error per drone over the move (a crude model) with = 0.10, 0.25 and 0.40 m per axis, 200 runs per value, and count the runs in which any pair comes closer than the body size of 0.70 m (measured with the vertical axis stretched). Report the smallest closest approach and the 95% upper bound of the failure rate, and compute the number of runs needed to prove a failure rate below when no failures are seen.
from scipy.stats import beta
# Monte Carlo: add a tracking error to each drone and count runs where a pair gets closer than the body size
rng = np.random.default_rng(2026)
st0, go0 = st.copy(), go.copy() # the assignment that passed the checks at 2.6 m spacing
def run(sigma_axis, n_runs):
fails = 0
worst = np.inf
for _ in range(n_runs):
eps = rng.normal(0, sigma_axis, (300, 3)) # a constant offset per drone over the move (crude)
m = closest_all(st0 + eps, go0 + eps, c_vert).min()
worst = min(worst, m)
fails += m < d_body
return fails, worst
def upper95(x, n):
return 1 - 0.05 ** (1 / n) if x == 0 else beta.ppf(0.95, x + 1, n - x) # one-sided 95% Clopper-Pearson upper bound
for sg, n_runs in ((0.10, 200), (0.25, 200), (0.40, 200)):
f, worst = run(sg, n_runs)
print(f"sigma {sg:.2f} m: {f:3d} of {n_runs} runs had a collision, smallest closest approach {worst:.2f} m, 95% upper bound on the failure rate {100 * upper95(f, n_runs):.2f}%")
print(f"runs needed to show a failure rate under 1e-6 with zero failures: {int(np.ceil(np.log(0.05) / np.log(1 - 1e-6))):,}")
sigma 0.10 m: 0 of 200 runs had a collision, smallest closest approach 1.11 m, 95% upper bound on the failure rate 1.49%
sigma 0.25 m: 4 of 200 runs had a collision, smallest closest approach 0.64 m, 95% upper bound on the failure rate 4.52%
sigma 0.40 m: 95 of 200 runs had a collision, smallest closest approach 0.07 m, 95% upper bound on the failure rate 53.56%
runs needed to show a failure rate under 1e-6 with zero failures: 2,995,731
At m no collision is found in 200 runs, the smallest closest approach is 1.11 m, and the 95% upper bound of the failure rate is 1.49%. At m four runs collide, the smallest closest approach falls to 0.64 m and the bound rises to 4.52%. At m 95 of 200 runs fail (smallest closest approach 0.07 m). The result is very sensitive to , which agrees with what Example 2 predicted (at m the required distance is 2.66 m, more than the 1.501 m the scene has). Proving a failure rate below by seeing no failures needs 2,995,731 runs. The conclusion is that a random experiment tells you how much error the system tolerates and when it breaks, but it is not evidence of a very low risk. That evidence comes from the calculated margin, the closed-form check and the rehearsal logs together.
Module lab
Lab: build a conflict-checking tool and a report for one transition (computer work, no drone flight)
- Take one transition from the Module 2 lab (60 to 300 drones). Write a function that computes the closest approach of every pair in closed form as in Example 3, and a function for the lower bound over short intervals.
- Check it with the three assignments of Module 2. Compare the number of pairs below the required distance, and compare sampled checks at 4 intervals with the closed-form check. Report how many pairs each catches.
- Estimate the per-axis tracking error of your chosen platform from a control-loop simulation like Example 1 (adjust gains and wind to be realistic) or from SITL logs if available, then calculate the minimum spacing as in Example 2, stating the assumed vertical factor and the reason.
- Find the smallest formation spacing that passes as in Example 4, with the number of drones the scene needs at that spacing.
- Run the random experiment of Example 5 with at least 100 runs and report the 95% upper bound of the failure rate instead of reporting “no collision found”.
- Write a one-page conflict-check report with the 10 closest pairs (drone numbers, distance, time), all assumptions, and what the check does not yet cover.
Common mistakes
Watch out
- Checking distance only at the start and end frames and concluding there is no collision, when drones that swap places collide midway
- Reporting a sampled check as a guarantee, when the result changes with the sampling interval; use the closed form or a bound that covers the whole interval
- Measuring distance between centres and comparing it with a criterion derived from edges, forgetting the body size
- Using the same spacing in every direction, when downwash makes the vertical requirement larger
- Setting the tracking error by feel instead of measuring it from closed-loop simulation or rehearsal logs, and not tying it to the wind condition
- Concluding that the show is safe because the random experiment found no collision, without computing the upper bound of the failure rate or knowing how many runs would be needed to prove it
- Believing that one level of simulation can replace another, for example using a pretty preview instead of dynamics checks and rehearsal flights
Summary
- There are five levels of simulation, each answering a different question. The design software checks at frame level, and closed-loop dynamics gives the tracking error from which all spacing starts.
- The required separation is . Tracking error is the main driver, and the vertical direction needs more by a factor that must be measured.
- The closest approach of every pair over a move has a closed form, . A check at the start and end frames or sparse sampling can pass even when there is a collision.
- The lower bound screens out almost all the safe pairs, leaving only a few that need the detailed check.
- A random experiment cannot prove a very low risk. If no failure is seen in runs, the 95% upper bound is , and almost three million runs are needed to get below .
Self-check questions
- Two drones start at relative position m and end at m over the same time. What is the closest approach over the move?
- For the same pair, what is the lower bound from the triangle inequality?
- Body size 0.60 m, tracking error 0.08 m per axis, show collision risk , 500 pairs come close. What is the required separation?
- In the horizontal direction a drone needs 1.48 m. If , how far apart must drones directly below one another be?
- 300 runs show no collision. What is the 95% upper bound of the failure rate?
Answers
- , , , so and . The closest approach is m
- , , . The bound is m, below the true 2.683 m (a lower bound is safe but not always tight)
- . The chi value with 3 degrees of freedom at is 5.407. The allowance is m, so the required separation is m
- m
- , about 0.99% (the approximation )
Key formulas
| Required minimum separation (body size plus an error allowance) where chi3 is the chi distribution with 3 degrees of freedom | |
| Closest approach of two drones moving on straight lines over the same interval | |
| Lower bound of the closest approach within an interval (triangle inequality) | |
| Distance measured with the vertical axis stretched by a factor c | |
| One-sided 95% upper bound of the failure rate when x failures are seen in n runs (Clopper-Pearson) | |
| Per-axis tracking error estimated from simulation as a straight line in wind |
Key references
- CollMot Robotics. Skybrush Studio for Blender documentation (latest). link
- Preiss, J. A., Hönig, W., Ayanian, N., & Sukhatme, G. S. (2017). Downwash-aware trajectory planning for large quadrotor teams. In 2017 IEEE/RSJ International Conference on Intelligent Robots and Systems (pp. 250–257). IEEE (arXiv:1704.04852). link
- IMRCLab. Crazyswarm2: A ROS 2 testbed for aerial robot teams [Documentation]. link
- ArduPilot Dev Team. SITL simulator (software in the loop). link
- PX4 Autopilot. Gazebo simulation. PX4 user guide (main). link
- PX4 Autopilot. Hardware in the loop simulation (HITL). PX4 user guide (main). link
- Turpin, M., Mohta, K., Michael, N., & Kumar, V. (2013). Goal assignment and trajectory planning for large teams of aerial robots. In Robotics: Science and Systems IX. RSS Foundation. link
- Huang, J., Tian, G., Zhang, J., & Chen, Y. (2021). On unmanned aerial vehicles light show systems: Algorithms, software and hardware. Applied Sciences, 11(16), Article 7687. link
Further reading
Study the assigned knowledge units in advance, review media and take the module quiz
Simulation tools for payloads and drone shows
Exercises and evaluation of simulated missions
Developing simulations and connecting SITL
Downloads and bibliography for payloads and drone shows
In class / field
Lab or field practice from worksheets with a safety checklist
Learning evidence: Checked worksheets and quiz results