Module 2/5 · Weeks 4–6 · 27 h

Trajectory generation and drone-to-point assignment

UAT 464 Drone Light Show and Aerial Formation Display Technology

About 90 minDraft, awaiting reviewLast updated 1 October 2026

Lesson

By the end of this module you will be able to

  1. Convert coordinates from the animation program's frame to WGS84 geographic coordinates by rotating the heading, and check units and bounds before exporting a file
  2. Assign drones to target points with the Hungarian method and compare a total-distance cost with a squared-distance cost
  3. Compute rest-to-rest polynomial trajectories (minimum jerk and minimum snap) and choose a transition time within the speed and acceleration limits
  4. Build a minimum-snap trajectory through several waypoints and compare it with stopping at every waypoint
  5. Choose the sampling rate of the animation so that the trajectory error and the file size are in balance

Prerequisites: UAT 101 Applied Mathematics for Technology (polynomials, derivatives and linear algebra) · UAT 104 Computer Programming (Python and NumPy) · UAT 461 Autonomous Navigation Technology (single-vehicle trajectories and tracking)

Why this matters

Module 1 ended with a storyboard: we know how many points each scene has, where they are and how long each transition takes. But a drone does not read a storyboard. A drone reads its own table of positions against time, and the job of this module is to turn the storyboard into that table in four steps. First, convert the animation’s coordinates into real-world coordinates. Second, decide which drone goes to which point of the next picture. Third, build smooth paths that stay within the airframe’s limits. Fourth, sample the trajectory into the points that go into the show file. Every step hides a trap that can ruin the show while the simulation still looks beautiful: coordinates in centimetres read as metres, an assignment that makes paths cross, or a sampling so sparse that a circle turns into a polygon.

All numbers continue from Module 1 in the “Lotus in the Lake” case, which is hypothetical and made up for learning. The module uses an assumed platform limit of 6 m/s peak speed and 1 m/s² acceleration. The trajectories and controller of a single vehicle are in UAT 461, and task allocation in multi-vehicle systems in general is in UAT 461; this module concentrates on what is specific to shows: every drone must reach the new picture at the same moment on paths that do not collide. The Python code can be downloaded from /downloads/uat-464/.

Coordinates, units and heading

Design software uses the scene’s relative coordinates, while drones use coordinates on the Earth, so two conversions are chained. The first rotates the scene axes to real directions. The second converts distances in metres to latitude and longitude. The documentation of Skybrush Studio states that one Blender space unit is a metre and one time unit is a second, that the first frame should be 0 (which maps to 0 s in the file), and that the scene origin (0, 0, 0) maps to a “show origin” on the map. The X axis is front, Y is left and Z is up, with the ground at Z = 0, and the front direction can be rotated freely when the show is set up on site (CollMot Robotics, n.d.). Each software package has its own convention. This course uses the audience’s view: to the right, into the picture (depth) and up, rotated by an azimuth , the bearing the audience looks toward (degrees clockwise from north). This gives east and north . A rotation does not change distances between points, so that gives a check on the program.

To go from distances on the local plane to degrees, use the radii of curvature of the WGS84 ellipsoid (NGA, 2014) at the latitude of the site. The north-south radius is and the prime-vertical radius is , where . Then and in radians. This planar approximation is good over the few hundred metres of a show area. MAVLink messages that carry target positions, such as SET_POSITION_TARGET_GLOBAL_INT, store latitude and longitude as 32-bit integers in units of degrees (MAVLink Development Team, n.d.). The resolution of that unit must be checked against the position accuracy we need.

Example 1 From scene coordinates to latitude and longitude, and a unit check before export

The show origin is at latitude 15.0000°, longitude 102.0000° (assumed, not a real site). The audience looks toward a bearing of 20° from north. The show volume is 120 m wide, 60 m deep and 20 to 100 m high. Four points in the scene are at (0, 0, 30), (30, 0, 30), (−30, 25, 60) and (58, −29, 98) metres. Convert them to east, north and latitude and longitude, check that the rotation preserves distances between points, compute the resolution of the degree unit, and test whether a bounding-box check would catch a file accidentally exported in centimetres.

import numpy as np
# From animation coordinates (metres; x right, y depth, z up as the audience sees it) to WGS84 latitude and longitude (assumed values)
A, F = 6378137.0, 1 / 298.257223563                     # WGS84 semi-major axis and flattening
E2 = F * (2 - F)
lat0, lon0 = 15.0000, 102.0000                          # show origin (assumed, not a real site)
azimuth = 20.0                                          # bearing the audience looks toward (degrees clockwise from north)

def show_to_enu(p, az_deg=azimuth):
    """rotate the animation axes to real directions: depth (y) points along the audience's line of sight"""
    a = np.radians(az_deg)
    east = p[:, 0] * np.cos(a) + p[:, 1] * np.sin(a)
    north = -p[:, 0] * np.sin(a) + p[:, 1] * np.cos(a)
    return east, north, p[:, 2]

def enu_to_geodetic(x_east, y_north, lat0_deg=lat0, lon0_deg=lon0):
    p = np.radians(lat0_deg)
    w = np.sqrt(1 - E2 * np.sin(p) ** 2)
    m_rad = A * (1 - E2) / w ** 3                       # meridian radius of curvature
    n_rad = A / w                                       # prime-vertical radius of curvature
    return lat0_deg + np.degrees(y_north / m_rad), lon0_deg + np.degrees(x_east / (n_rad * np.cos(p)))

pts = np.array([[0.0, 0.0, 30.0], [30.0, 0.0, 30.0], [-30.0, 25.0, 60.0], [58.0, -29.0, 98.0]])   # x right, y depth, z up
east, north, up = show_to_enu(pts)
lat, lon = enu_to_geodetic(east, north)
for p, e, n, la, lo in zip(pts, east, north, lat, lon):
    print(f"x {p[0]:6.1f} y {p[1]:6.1f} z {p[2]:5.1f} -> E {e:7.2f} N {n:7.2f} -> {la:.7f}, {lo:.7f}")
d_show = np.linalg.norm(pts[1, :2] - pts[2, :2])         # a rotation must not change distances between points
d_enu = np.hypot(east[1] - east[2], north[1] - north[2])
print(f"distance between points 2 and 3: {d_show:.3f} m in the animation, {d_enu:.3f} m after rotation")

# MAVLink stores lat/lon as integer degE7: what resolution does that give
p = np.radians(lat0)
w = np.sqrt(1 - E2 * np.sin(p) ** 2)
step_n = np.radians(1e-7) * A * (1 - E2) / w ** 3
step_e = np.radians(1e-7) * (A / w) * np.cos(p)
print(f"1e-7 deg = {step_n * 100:.2f} cm north, {step_e * 100:.2f} cm east")

# bounding-box check against the show volume before export: catches unit mistakes
box_lo, box_hi = np.array([-60.0, -30.0, 20.0]), np.array([60.0, 30.0, 100.0])
def inside(arr):
    return bool(np.all(arr >= box_lo) and np.all(arr <= box_hi))
print("metres  :", "inside" if inside(pts) else "OUTSIDE")
print("if cm   :", "inside" if inside(pts * 100) else "OUTSIDE", f"(largest coordinate {np.abs(pts * 100).max():.0f})")
x    0.0 y    0.0 z  30.0 -> E    0.00 N    0.00 -> 15.0000000, 102.0000000
x   30.0 y    0.0 z  30.0 -> E   28.19 N  -10.26 -> 14.9999073, 102.0002621
x  -30.0 y   25.0 z  60.0 -> E  -19.64 N   33.75 -> 15.0003050, 101.9998174
x   58.0 y  -29.0 z  98.0 -> E   44.58 N  -47.09 -> 14.9995744, 102.0004145
distance between points 2 and 3: 65.000 m in the animation, 65.000 m after rotation
1e-7 deg = 1.11 cm north, 1.08 cm east
metres  : inside
if cm   : OUTSIDE (largest coordinate 9800)

The point (30, 0, 30), 30 m to the right of the audience, lands at 28.19 m east and −10.26 m north: the audience looks north tilted 20° to the east, so its right-hand side points south-east. The distance between points 2 and 3 is 65.000 m both before and after rotating, which shows the rotation is correct. The degree unit gives a resolution of about 1.1 cm both north-south and east-west, fine enough compared with centimetre-level RTK accuracy (though not by a large margin, so never round values repeatedly). The bounding-box check catches the unit mistake at once: read as centimetres, the largest coordinate becomes 9,800 and falls out of the box. The check takes a fraction of a second but guards against the most serious mistake of this step.

Assigning drones to target points

When changing from one picture to the next, each drone must go to one point of the new picture and each point must receive exactly one drone. This is the assignment problem. With drones and points there are possible assignments, yet the best one can be found in time with the Hungarian method (Kuhn, 1955). This works because all the drones are identical (if they differ, for example in light colour or remaining battery, extra conditions must enter the cost matrix). The function scipy.optimize.linear_sum_assignment solves it with a modified Jonker-Volgenant algorithm (SciPy developers, n.d.; Crouse, 2016). The cost matrix entry is the cost of drone going to point ; the usual choice is the distance, and another popular choice is the squared distance.

Light-show research puts assignment at the centre of every transition. Huang et al. (2021) solve the assignment with the Hungarian method to minimise the total flight distance, then recompute only for groups of nearby drones when paths deviate to avoid each other, so the whole fleet need not be re-solved often. Turpin et al. (2013) propose an assignment that minimises the largest cost of any single drone (not the sum), using the Hungarian method as a component, and then order the priorities and start times of the drones to avoid collisions; the complexity is cubic in the number of drones. Alqudsi (2026) proposes, in a preprint that has not yet been peer reviewed, solving assignment and trajectory generation together and reports about 1 s on a laptop for 1,008 drones. These results suggest that the size of a real show is not a computational obstacle, yet the choice of criterion does affect the safety of the paths.

Example 2 A 60-drone grid to a 60-point ring: numbered order versus the best assignment

Sixty drones sit in a 10 × 6 grid, 3 m apart, in a vertical plane. Their numbers are shuffled and do not follow position. They must change to a ring of radius 15 m in the same plane at the same time, each along a straight line. Compare three methods: numbered order, assignment minimising the total distance and assignment minimising the total squared distance. Look at the total distance, the longest move and the closest approach between every pair of drones during the move (computed with the quadratic formula for the distance between two straight-line motions). Then repeat 20 times with the start positions jittered by ±0.8 m to see whether the result is stable (the safe distance used in this example is 1.0 m, an assumed value).

import numpy as np
from scipy.optimize import linear_sum_assignment
# Assign drones to targets: a 10 x 6 grid (3 m apart) to a 15 m ring in the same vertical plane (assumed)
rng = np.random.default_rng(7)
gx, gz = np.meshgrid((np.arange(10) - 4.5) * 3.0, (np.arange(6) - 2.5) * 3.0 + 60.0)
start = np.column_stack([gx.ravel(), gz.ravel()])
start = start[rng.permutation(len(start))]              # drone numbers are shuffled, not ordered by position
ang = 2 * np.pi * np.arange(60) / 60
goal = np.column_stack([15.0 * np.cos(ang), 60.0 + 15.0 * np.sin(ang)])
cost_d = np.linalg.norm(start[:, None, :] - goal[None, :, :], axis=2)

def min_pair_distance(a, b):
    """closest approach of every pair over equal-time straight moves (quadratic formula)"""
    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)
    iu = np.triu_indices(len(a), 1)
    return d[iu]

methods = {}
methods["numbered order"] = (np.arange(60), np.arange(60))
methods["min total distance"] = linear_sum_assignment(cost_d)
methods["min total distance^2"] = linear_sum_assignment(cost_d ** 2)
sep = 1.0                                               # separation used in this example (m)
for name, (r, c) in methods.items():
    d = cost_d[r, c]
    pair = min_pair_distance(start[r], goal[c])
    print(f"{name:21s} total {d.sum():6.1f} m  longest {d.max():5.1f} m  closest pair {pair.min():5.2f} m  pairs under {sep} m: {(pair < sep).sum()}")

# repeat 20 times with start positions jittered by +-0.8 m to see whether the result is stable
better, worst = 0, {"d": 9.9, "d2": 9.9}
for seed in range(20):
    s0 = start + np.random.default_rng(seed).uniform(-0.8, 0.8, start.shape)
    c0 = np.linalg.norm(s0[:, None, :] - goal[None, :, :], axis=2)
    r1, c1 = linear_sum_assignment(c0)
    r2, c2 = linear_sum_assignment(c0 ** 2)
    p1, p2 = min_pair_distance(s0[r1], goal[c1]).min(), min_pair_distance(s0[r2], goal[c2]).min()
    worst["d"], worst["d2"] = min(worst["d"], p1), min(worst["d2"], p2)
    better += p2 >= p1
print(f"20 jittered starts: worst closest pair {worst['d']:.2f} m (min distance) vs {worst['d2']:.2f} m (squared); squared >= plain in {better} of 20")
numbered order        total 1050.7 m  longest  30.4 m  closest pair  0.00 m  pairs under 1.0 m: 128
min total distance    total  365.1 m  longest  13.3 m  closest pair  1.36 m  pairs under 1.0 m: 0
min total distance^2  total  374.9 m  longest  13.3 m  closest pair  1.42 m  pairs under 1.0 m: 0
20 jittered starts: worst closest pair 0.94 m (min distance) vs 1.22 m (squared); squared >= plain in 19 of 20

Numbered order uses a total distance of 1,050.7 m, almost three times that of the best assignment, and 128 pairs come closer than 1.0 m. The closest approach is 0.00 m, an actual collision. The two optimal assignments use total distances of 365.1 and 374.9 m, share the same longest move of 13.3 m, and have no pair closer than 1.0 m. The interesting number is the closest approach: the squared-distance assignment gives 1.42 m against 1.36 m for the total distance. In the 20 jittered repeats the worst case of the total-distance method drops to 0.94 m (below 1.0 m), the squared method gives 1.22 m, and the squared method is no worse in 19 of 20 runs. What we can conclude is that the best assignment by distance removes most of the path crossings, and squaring gives a slightly larger closest approach in this scenario because squaring penalises long moves more heavily, so the work is spread more evenly. This is the result of an experiment in one scenario, not a guarantee. A guarantee must always come from checking every pair of paths (Module 4). When drones stack vertically, the downwash of the upper drone disturbs the one below, so the work of Preiss et al. (2017) plans the fleet trajectories with this in mind; we use the idea as a vertical factor in Module 4.

Two side-by-side panels, each with a grey 10 by 6 grid of dots low in the picture and a pink 60-dot ring above. The left panel, numbered order, shows tangled grey lines crossing in many places, a total distance of 1050.7 metres and a closest approach of 0 metres. The right panel, minimum squared distance assignment, shows short mostly non-crossing paths, a total distance of 374.9 metres and a closest approach of 1.42 metres.
Figure 1 Paths from the grid to the ring with numbered order versus minimum squared-distance assignment

Smooth rest-to-rest trajectories

Once we know which drone goes where, we must say how it goes in time. Moving along a straight line at constant speed is impossible, because the speed would have to jump from 0 to a constant value at once, the flight controller cannot follow, and large errors appear at the start and the stop. The standard method uses a polynomial in time. Set the boundary conditions so that the position starts at 0 and ends at 1 and the speed and acceleration are zero at both ends. These six conditions determine a quintic polynomial uniquely.

This trajectory minimises the integral of the squared jerk (the third derivative of position) for a rest-to-rest move. For an even gentler move that also sets the jerk to zero at the ends, the result is the degree-seven polynomial , which minimises the integral of the squared snap (the fourth derivative) (Mellinger & Kumar, 2011). The position of one drone is , where is the start and the end point.

An important property for shows: if every drone uses the same and the same function , the peak speed of a drone is proportional to its move length, . Drones with shorter moves therefore move more slowly and more gently automatically, and every drone arrives at the new picture at the same moment. The time we choose is set by the drone with the longest move. There is also a safety consequence. The relative position of two drones is , a straight line traversed in time by the function . Because rises from 0 to 1, the closest approach of the two drones equals that of two drones moving at constant speed, and does not depend on which polynomial is used. We use this to check conflicts in Module 4.

Example 3 The shortest time for a 60 m move under speed and acceleration limits

The platform limits are 6 m/s and 1 m/s² (assumed). The drone with the longest move must travel 60 m. Compute the peaks of speed, acceleration and jerk of the quintic (minimum jerk) and septic (minimum snap) trajectories in units of , and . Then find the shortest that meets both limits and see the peak speed and acceleration of drones with shorter moves when the same is used.

import numpy as np
# Rest-to-rest polynomial move: least time within speed and acceleration limits
quintic = np.poly1d([6, -15, 10, 0, 0, 0])               # t is normalised time 0..1
septic = np.poly1d([-20, 70, -84, 35, 0, 0, 0, 0])       # s(t) = 35t^4 - 84t^5 + 70t^6 - 20t^7
tt = np.linspace(0, 1, 100001)
peaks = {}
for name, poly in (("quintic (min jerk)", quintic), ("septic (min snap)", septic)):
    v, a, j = poly.deriv(1), poly.deriv(2), poly.deriv(3)
    peaks[name] = (np.abs(v(tt)).max(), np.abs(a(tt)).max(), np.abs(j(tt)).max())
    print(f"{name:19s} s(1)={poly(1):.0f}, v(0)={v(0):.0f}, a(0)={a(0):.0f}, peak v {peaks[name][0]:.4f}, peak a {peaks[name][1]:.4f}, peak jerk {peaks[name][2]:.2f}  (x d/T, d/T^2, d/T^3)")

d, v_lim, a_lim = 60.0, 6.0, 1.0                        # longest move (m) and platform limits (assumed)
for name, (kv, ka, _) in peaks.items():
    t_v, t_a = kv * d / v_lim, np.sqrt(ka * d / a_lim)   # time needed by the speed limit and by the acceleration limit
    T = max(t_v, t_a)
    print(f"{name:19s} {d:.0f} m: speed limit needs {t_v:5.2f} s, acceleration limit needs {t_a:5.2f} s -> T = {T:5.2f} s ({'speed' if t_v >= t_a else 'acceleration'} limited)")

# every drone uses the same T, so shorter moves are automatically gentler
T = max(peaks["quintic (min jerk)"][0] * d / v_lim, np.sqrt(peaks["quintic (min jerk)"][1] * d / a_lim))
for dist in (60.0, 30.0, 10.0):
    kv, ka, _ = peaks["quintic (min jerk)"]
    print(f"move {dist:4.0f} m in {T:.2f} s: peak speed {kv * dist / T:.2f} m/s, peak acceleration {ka * dist / T ** 2:.2f} m/s^2")
quintic (min jerk)  s(1)=1, v(0)=0, a(0)=0, peak v 1.8750, peak a 5.7735, peak jerk 60.00  (x d/T, d/T^2, d/T^3)
septic (min snap)   s(1)=1, v(0)=0, a(0)=0, peak v 2.1875, peak a 7.5132, peak jerk 52.50  (x d/T, d/T^2, d/T^3)
quintic (min jerk)  60 m: speed limit needs 18.75 s, acceleration limit needs 18.61 s -> T = 18.75 s (speed limited)
septic (min snap)   60 m: speed limit needs 21.88 s, acceleration limit needs 21.23 s -> T = 21.88 s (speed limited)
move   60 m in 18.75 s: peak speed 6.00 m/s, peak acceleration 0.99 m/s^2
move   30 m in 18.75 s: peak speed 3.00 m/s, peak acceleration 0.49 m/s^2
move   10 m in 18.75 s: peak speed 1.00 m/s, peak acceleration 0.16 m/s^2

The quintic has a peak speed of , a peak acceleration of and a peak jerk of . The septic is gentler at the ends but pays for it with a higher peak speed of and a peak acceleration of , because it must accelerate harder in the middle. For 60 m at 6 m/s, the quintic needs s from the speed limit and s from the acceleration limit, so s, limited by speed. The septic needs 21.88 s, about 17% slower, in exchange for gentleness at the ends. With s, a 30 m move has a peak speed of 3.00 m/s and acceleration of 0.49 m/s², while a 10 m move has 1.00 m/s and 0.16 m/s². This course therefore uses the quintic as the starting choice because it gives a shorter time, and uses the septic when the platform’s controller responds poorly to jerk at the ends.

Two panels of normalised rest-to-rest trajectories. The left panel is speed against normalised time 0 to 1: the orange quintic curve peaks at 1.875 in the middle and the purple septic curve peaks at 2.1875 in the middle and is narrower. The right panel is acceleration: the quintic peaks at 5.77 and the septic peaks at 7.51.
Figure 2 Normalised speed and acceleration of the quintic (minimum jerk) and septic (minimum snap) trajectories

Trajectories through several waypoints

Rest-to-rest transitions suit changing from one picture to another, but some parts of a show need drones to flow through several points without stopping, for example a curved path around an obstacle during take-off, or a picture that is itself moving continuously. Stopping at every point wastes time and energy on repeated accelerating and braking. The method of Mellinger and Kumar (2011) joins several degree-seven polynomials so that they pass through given points at given times, and chooses the coefficients to minimise the snap cost . The position must pass through the waypoints, the velocity, acceleration and jerk must be continuous at the joints, and the drone rests at the start and end. This is a quadratic problem with linear constraints, solved in one step by a linear system (a KKT system). Snap is related to rapid changes in the motor commands of a quadrotor, which makes it a fitting criterion for this vehicle type (Mellinger & Kumar, 2011).

Example 4 Flowing through three segments versus stopping at every point

A drone must travel along one axis through waypoints at 0, 24, 36 and 60 m, with segment times of 8, 5 and 8 s, 21 s in total (assumed). Compare the minimum-snap trajectory that flows through the points without stopping with a septic rest-to-rest trajectory that stops at every point in the same time, looking at peak speed, peak acceleration, peak jerk, total snap cost and the speed at the waypoints.

import numpy as np
# Minimum-snap trajectory through several waypoints versus stopping at every one (one axis, assumed values)
wp = np.array([0.0, 24.0, 36.0, 60.0])                  # m, positions to pass
T = np.array([8.0, 5.0, 8.0])                           # s, duration of each segment
n, order = len(T), 8                                    # degree-7 polynomials, 8 coefficients per segment

def deriv_row(t, k):
    """row that turns coefficients into the k-th derivative at time t"""
    row = np.zeros(order)
    for i in range(k, order):
        row[i] = np.prod(np.arange(i, i - k, -1)) * t ** (i - k)
    return row

Q = np.zeros((n * order, n * order))                    # cost = integral of squared snap
for s in range(n):
    for i in range(4, order):
        for j in range(4, order):
            c = np.prod(np.arange(i, i - 4, -1)) * np.prod(np.arange(j, j - 4, -1))
            Q[s * order + i, s * order + j] = c * T[s] ** (i + j - 7) / (i + j - 7)
rows, rhs = [], []
def add(seg_terms, value):
    r = np.zeros(n * order)
    for s, row in seg_terms:
        r[s * order:(s + 1) * order] += row
    rows.append(r); rhs.append(value)
for s in range(n):                                      # hit the waypoints at both ends of each segment
    add([(s, deriv_row(0.0, 0))], wp[s]); add([(s, deriv_row(T[s], 0))], wp[s + 1])
for k in (1, 2, 3):                                     # rest at the start and the end
    add([(0, deriv_row(0.0, k))], 0.0); add([(n - 1, deriv_row(T[-1], k))], 0.0)
for s in range(n - 1):                                  # derivatives 1 to 3 continuous at the joints
    for k in (1, 2, 3):
        add([(s, deriv_row(T[s], k)), (s + 1, -deriv_row(0.0, k))], 0.0)
A_eq, b_eq = np.array(rows), np.array(rhs)
kkt = np.block([[2 * Q, A_eq.T], [A_eq, np.zeros((len(rhs), len(rhs)))]])
sol = np.linalg.solve(kkt, np.concatenate([np.zeros(n * order), b_eq]))
coef = sol[:n * order].reshape(n, order)

def sample(coefs, k, per=2000):
    out = []
    for s in range(n):
        t = np.linspace(0, T[s], per)
        out.append(sum(coefs[s][i] * np.prod(np.arange(i, i - k, -1)) * t ** (i - k) for i in range(k, order)) if k else sum(coefs[s][i] * t ** i for i in range(order)))
    return np.concatenate(out)

septic = np.array([35, -84, 70, -20])                    # rest-to-rest
stop = np.zeros((n, order))
for s in range(n):
    d = wp[s + 1] - wp[s]
    stop[s, 4:] = d * septic / T[s] ** np.arange(4, 8)
    stop[s, 0] = wp[s]
def cost(coefs):
    c = coefs.reshape(-1)
    return float(c @ Q @ c)
print("method            peak v   peak a   peak jerk   snap cost     speed at waypoints (m/s)")
for name, cf in (("stop at each wp", stop), ("minimum snap", coef)):
    v, a, j = (np.abs(sample(cf, k)).max() for k in (1, 2, 3))
    vw = [sum(cf[s][i] * i * T[s] ** (i - 1) for i in range(1, order)) for s in range(n - 1)]
    print(f"{name:16s} {v:6.2f}  {a:7.2f}  {j:9.2f}  {cost(cf):10.2f}     " + " ".join(f"{abs(x):5.2f}" for x in vw))
print(f"total time {T.sum():.0f} s for both; position error at the waypoints {max(abs(sum(coef[s][i] * T[s] ** i for i in range(order)) - wp[s + 1]) for s in range(n)):.1e} m")
method            peak v   peak a   peak jerk   snap cost     speed at waypoints (m/s)
stop at each wp    6.56     3.61       5.04      241.17      0.00  0.00
minimum snap       5.20     1.53       0.86        4.03      3.62  3.62
total time 21 s for both; position error at the waypoints 7.1e-15 m

Both methods take 21 s and pass through the waypoints exactly (an error of m from computer rounding), but the differences are large. The stop-at-every-point trajectory must reach a peak speed of 6.56 m/s, an acceleration of 3.61 m/s² and a jerk of 5.04 m/s³, because it must accelerate hard in each short segment to make up for the time spent stopped. The minimum-snap trajectory flows through the waypoints at 3.62 m/s and reaches a peak speed of only 5.20 m/s, an acceleration of 1.53 m/s² and a jerk of 0.86 m/s³. Its total snap is 60 times lower (4.03 against 241.17). The conclusion is that when a drone does not need to stop, flowing through the points greatly reduces the load on motors and controller, but you must choose the segment times yourself and check that the resulting path does not bulge away from a safe position, because a polynomial through points can overshoot the straight line between them when segment times are unbalanced.

Graph of speed against time from 0 to 21 seconds. The orange stop-at-every-point trajectory is three bell shapes touching zero at 8 and 13 seconds, with a peak of 6.56 metres per second. The green minimum-snap trajectory is a smooth curve that never returns to zero in between, passes the waypoints at 3.62 metres per second and peaks at 5.20 metres per second. Vertical dashed lines at 8 and 13 seconds mark the waypoints.
Figure 3 Speed of the stop-at-every-point trajectory versus the minimum-snap trajectory flowing through the waypoints

From animation to a table of sampled points

In the end the trajectory must be saved to a file as a table of points in time. The sampling rate is a trade-off between shape error and file size. If the samples are too far apart, the straight lines joining them cut the corners of curves. The clearest case is a picture rotating as a circle, whose points accelerate toward the centre all the time. For a circle of radius rotating at rate , the centripetal acceleration is , and the maximum error of a straight line joining two samples apart is . The error grows with the square of the sampling interval. If the position and the velocity are stored at each sample and joined with cubic (Hermite) curves, the error falls to the fourth power of the interval, but the file is twice as large.

The Skybrush Studio documentation recommends choosing an animation frame rate that divides the exported trajectory frame rate evenly (for example 25 frames per second with a 5 frames per second trajectory) and using 25 rather than 24, because the internal control loops of drones run at 1 kHz, 400 Hz or 100 Hz, so the samples line up with the controller cycles (CollMot Robotics, n.d.).

Example 5 How densely must a rotating ring be sampled?

A ring of radius 25 m rotates about its centre. The speed limit is 6 m/s and the acceleration limit is 1 m/s². Choose the highest rotation rate within both limits, then compare the maximum error of straight lines joining samples with cubic curves that use the position and velocity at the ends of the interval, for sampling intervals of 2.0, 1.0, 0.5, 0.25 and 0.05 s, together with the file size for 300 drones in a 480 s show (3 float32 position values for the linear form, and 3 position plus 3 velocity values for the cubic form).

import numpy as np
# A rotating ring: pick the rate from the limits, then see how dense the samples must be (assumed values)
r, v_lim, a_lim = 25.0, 6.0, 1.0
w = min(v_lim / r, np.sqrt(a_lim / r))                  # rad/s from the speed and centripetal-acceleration limits
print(f"omega {w:.4f} rad/s (speed limit {v_lim / r:.4f}, acceleration limit {np.sqrt(a_lim / r):.4f}), period {2 * np.pi / w:.1f} s")
print(f"speed {w * r:.2f} m/s, centripetal acceleration {w * w * r:.2f} m/s^2")

def pos(t):  return r * np.array([np.cos(w * t), np.sin(w * t)])
def vel(t):  return r * w * np.array([-np.sin(w * t), np.cos(w * t)])

def hermite(t, t0, dt):
    """cubic curve from end positions and velocities"""
    u = (t - t0) / dt
    h00, h10, h01, h11 = 2*u**3 - 3*u**2 + 1, u**3 - 2*u**2 + u, -2*u**3 + 3*u**2, u**3 - u**2
    return h00 * pos(t0) + h10 * dt * vel(t0) + h01 * pos(t0 + dt) + h11 * dt * vel(t0 + dt)

n_drone, t_show = 300, 480
fine = np.linspace(0, 2.0, 2001)
print("dt (s)  linear err (m)  cubic err (m)  linear file  cubic file")
for dt in (2.0, 1.0, 0.5, 0.25, 0.05):
    lin = np.array([pos(0) + (pos(dt) - pos(0)) * (t / dt) for t in fine if t <= dt])      # straight line between samples
    err_lin = np.linalg.norm(lin - np.array([pos(t) for t in fine if t <= dt]), axis=1).max()
    cub = np.array([hermite(t, 0.0, dt) for t in fine if t <= dt])
    err_cub = np.linalg.norm(cub - np.array([pos(t) for t in fine if t <= dt]), axis=1).max()
    size_lin = n_drone * (t_show / dt) * 3 * 4 / 1e6                                        # 3 float32 per sample
    size_cub = n_drone * (t_show / dt) * 6 * 4 / 1e6                                        # position and velocity
    print(f"{dt:5.2f}  {err_lin:14.4f}  {err_cub:13.5f}  {size_lin:7.2f} MB  {size_cub:7.2f} MB")
omega 0.2000 rad/s (speed limit 0.2400, acceleration limit 0.2000), period 31.4 s
speed 5.00 m/s, centripetal acceleration 1.00 m/s^2
dt (s)  linear err (m)  cubic err (m)  linear file  cubic file
 2.00          0.4983        0.00166     0.86 MB     1.73 MB
 1.00          0.1249        0.00010     1.73 MB     3.46 MB
 0.50          0.0312        0.00001     3.46 MB     6.91 MB
 0.25          0.0078        0.00000     6.91 MB    13.82 MB
 0.05          0.0003        0.00000    34.56 MB    69.12 MB

The rotation rate is limited by acceleration, not speed: rad/s against 0.240 rad/s from speed. The ring completes a turn in 31.4 s at 5.00 m/s with a centripetal acceleration of 1.00 m/s². With samples every 2.0 s the straight lines are off by 0.498 m, in agreement with m. At 1.0 s the error is 0.125 m, and the interval has to come down to 0.25 s before the error is below 1 cm (0.0078 m), with a file of 6.91 MB. The cubic curves, even with samples as far apart as 2.0 s, are off by only 0.00166 m (1.7 mm) with a 1.73 MB file, four times smaller than the linear file that meets the 1 cm budget (0.25 s, 6.91 MB). The conclusion is that the sampling rate must start from the error budget we can accept (here about 1 cm, compared with RTK accuracy) and then the needed interval is calculated, not chosen by habit; and for strongly curved pictures, storing velocity too is cheaper than sampling more densely.

Module lab

Lab: build the trajectory table of one transition (desk work, no drone flight)

  1. Use two pictures from the Module 1 lab (a start picture and an end picture with equal numbers of points) or create new ones, then set the scene coordinate frame and the audience azimuth. Convert every point to latitude and longitude as in Example 1, and check the bounding box and the distances between points after rotation.
  2. Assign drones to the end points with three methods as in Example 2 (numbered order, minimum total distance, minimum squared distance). Record the total distance, the longest move and the closest approach between pairs, then draw the paths of the worst and the best method.
  3. Using the speed and acceleration limits of your chosen platform, calculate the minimum for the quintic and septic trajectories as in Example 3 and choose the time for this scene with a reason.
  4. Add one intermediate waypoint for the drone with the longest move and build the minimum-snap trajectory as in Example 4, compared with stopping at that point.
  5. Sample the trajectory at 5 FPS and at 25 FPS as in Example 5, calculate the maximum error from the continuous trajectory and the file size of the fleet, and propose a rate that fits a 1 cm error budget.
  6. Export the table as CSV (time, drone number, position, colour) and write a one-page report on what each step produced and what has been checked.

Common mistakes

Watch out

  • Exporting coordinates in the wrong unit (centimetres or feet instead of metres) or flipping left and right, with no bounding-box and distance check before export
  • Assigning drones by number or at random, which makes paths cross and multiplies the total distance
  • Believing that minimum total distance guarantees non-colliding paths, when every pair must always be checked
  • Setting transition time from the speed limit alone, without checking acceleration and without knowing which limit is the binding one
  • Using constant-speed straight lines, which need a speed jump at the ends so the controller cannot follow
  • Stopping at every waypoint without need, wasting energy and adding points where a drone hangs still in the downwash of the drone below
  • Sampling the trajectory too sparsely, so that circles become polygons, and not checking the error against a budget

Summary

  • Design software and drones use different coordinate frames. Rotate with the azimuth, convert to degrees with the WGS84 radii of curvature, and check units and bounds every time before export.
  • The Hungarian method solves assignment in time. Numbered order nearly triples the total distance and causes collisions. A squared cost gave a slightly better closest approach in the test case, but that is not a guarantee.
  • The quintic has a peak speed of and a peak acceleration of . must meet both limits, every drone uses the same , and drones with shorter moves are automatically gentler.
  • A minimum-snap trajectory flowing through several waypoints greatly reduces the peak speed, acceleration and jerk compared with stopping at every point.
  • The sampling rate starts from the error budget. The error of straight lines is , and storing velocity too allows much wider sampling intervals.

Self-check questions

  1. The audience looks toward bearing 90° (east). A drone is at m to the right and in the audience frame. What are its east and north coordinates?
  2. If latitude is stored as an integer in units of degrees at latitude 15°, what is the maximum rounding error in the north-south direction, in centimetres?
  3. The distance cost matrix for 3 drones to 3 points is, one row per drone, [[4, 1, 3], [2, 0, 5], [3, 2, 2]]. What is the minimum-total-distance assignment and what is the total?
  4. A move of 40 m with limits of 5 m/s and 1.2 m/s² using the quintic: what is the minimum , which limit binds, and what peak acceleration results?
  5. A ring of radius 20 m with a speed limit of 5 m/s and a centripetal acceleration limit of 0.8 m/s². What is the highest rotation rate, and roughly what is the straight-line error when sampling every 0.5 s?
Answers
  1. : m and m. The right-hand side of an audience looking east is south.
  2. The smallest step is cm at this latitude. The maximum rounding error is half a step, about 0.55 cm.
  3. Try all 6 assignments. The best is drone 1 to point 2 (cost 1), drone 2 to point 1 (cost 2) and drone 3 to point 3 (cost 2), total 5.
  4. s and s, so s, limited by speed. The peak acceleration is m/s².
  5. rad/s. The acceleration is m/s². The error is m.

Key formulas

Rotating from the audience frame to east and north
The assignment problem (choose a permutation sigma)
Minimum-jerk rest-to-rest trajectory (tau is normalised time 0 to 1)
Shortest time within the speed and acceleration limits
Cost of a minimum-snap trajectory
Error of straight lines joining samples on a circle

Key references

  1. Kuhn, H. W. (1955). The Hungarian method for the assignment problem. Naval Research Logistics Quarterly, 2(1–2), 83–97. link
  2. Crouse, D. F. (2016). On implementing 2D rectangular assignment algorithms. IEEE Transactions on Aerospace and Electronic Systems, 52(4), 1679–1696. link
  3. SciPy developers. scipy.optimize.linear_sum_assignment. SciPy v1.18 reference guide. link
  4. 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
  5. 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
  6. Alqudsi, Y. (2026). Enhancing drone light shows performances: Optimal allocation and trajectories for swarm drone formations (arXiv:2603.24401) [Preprint]. link
  7. Mellinger, D., & Kumar, V. (2011). Minimum snap trajectory generation and control for quadrotors. In 2011 IEEE International Conference on Robotics and Automation (pp. 2520–2525). IEEE. link
  8. 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
  9. CollMot Robotics. Skybrush Studio for Blender documentation (latest). link
  10. National Geospatial-Intelligence Agency. (2014). Department of Defense World Geodetic System 1984: Its definition and relationships with local geodetic systems (NGA.STND.0036_1.0.0_WGS84). link
  11. MAVLink Development Team. MAVLink common message set (common.xml). link

Further reading

Study the assigned knowledge units in advance, review media and take the module quiz

In class / field

Lab or field practice from worksheets with a safety checklist

Learning evidence: Checked worksheets and quiz results

Module quiz

This is a formative self-check, not a graded exam

Knowledge domain: Automation, robotics and swarms · Aircraft, structures and design