Skip to the content
FixTheRobot Explore Robotics / UAV / Module 5 / M5-T10

UAV Systems Engineering · Module 5

M5-T10: Waypoint navigation

Following a list of points sounds trivial until the vehicle cuts corners, overshoots turns or never quite “arrives”. The guidance law and the acceptance rule decide all three.

  • Lesson 10 of 17
  • UAV Guidance, Navigation and Control (GNC)
  • Established engineering
  • About 6 minutes to read

A mission is a list of waypoints, but the vehicle flies legs between them. How the autopilot decides it has reached a waypoint, and what it steers toward in between, determines accuracy, smoothness and failure behaviour. These choices are simple, and a surprising number of field problems come from leaving them at defaults.

Learning objectives

After this lesson, you should be able to:

  • Define a leg, cross-track error and along-track distance from two waypoints.
  • Choose acceptance radius and speed at waypoints from vehicle dynamics and mission requirements.
  • Implement a carrot (look-ahead) guidance law and explain its tuning parameter.
  • List the safety conditions a waypoint mission must monitor.

Conceptual explanation

Established Line-of-sight and carrot guidance are standard textbook methods. Specific autopilot behaviour (acceptance radius parameters, corner blending, speed limits) is implementation-specific: read the documentation of your autopilot.

A waypoint mission is an ordered list of positions (and optionally altitude, speed, yaw and hold time). Between waypoints WkW_{k} and Wk+1W_{k+1} the vehicle flies a leg. Two ideas matter:

  • Guidance: what point or velocity to command at each instant. Flying directly at the next waypoint (pure pursuit of the waypoint) is simple, but a gust that pushes the vehicle off the line leaves it on a curved path. Flying toward a point on the leg a look-ahead distance ahead of the vehicle’s projection (carrot or line-of-sight) holds the line.
  • Acceptance: the condition that advances to the next waypoint. A radius that is too small means the vehicle circles or stalls; too large and corners are cut.
Waypoint navigation state machineA waypoint mission loops through: select the next waypoint, fly the leg, test the acceptance condition, then either advance, hold or abort. Safety checks run on every cycle.Next waypointindex, positionLeg guidanceline or pointAcceptance testradius, speedAdvance / holddelay, yawMission endland / RTLSafety monitors (geofence, battery, estimator health) can pre-empt every state.
The waypoint loop. Acceptance decides when to advance; monitors can interrupt at any time.
Animation of waypoint following with carrot guidance in a crosswind for three look-ahead distances. The vehicle steers towards a point a look-ahead distance ahead on the current leg. A short look-ahead holds the line closely with small cross-track error but turns sharply, a long look-ahead gives a smooth path that drifts further from the line in wind and cuts the corners. The cross-track error along the mission is plotted for the three.
Carrot guidance: aim at the point on the leg LL ahead of the projection of the vehicle. The cross-track time constant is about L/v, so a short LL converges fast, a long LL is gentle; a constant crosswind leaves a steady offset ww LL / vv. Simulated with a first-order velocity response (0.5 s), 5 m/s, 1 m/s wind and L=4L=4, 10, 20 m. (Looping, about 6 seconds; drawn and computed for this course with illustrative values.)

Engineering intuition

Imagine leading a dog with a treat held ahead of it along a rope. A short rope (small look-ahead) makes the dog hug the line but jerk around; a long rope makes it smooth but lets it cut corners. The look-ahead distance is the single most important tuning knob, and it should scale with speed: at 10 m/s a 2 m look-ahead is asking for oscillation, because the vehicle crosses it in 0.2 s.

Acceptance is the same trade-off in time. The vehicle is a physical object with lag; it cannot turn instantly. If you require it to be within 0.2 m of a waypoint before turning, it must decelerate to nearly zero first. If you accept within 3 m, it turns early and flies a rounded corner at speed. Neither is wrong: the mission requirement (photograph the target? pass a gate? survey a field?) decides.

Mathematical formulation

For a leg from A to BB with unit direction u=(B−A)/∥B−A∥u=(B-A)/\Vert B-A\Vert and vehicle position pp, define the projection and the errors:

Along-track distance
s=u⊤(p−A)s = \mathbf u^{\top}(\mathbf p - \mathbf A)
Cross-track error
ect=u⊥⊤(p−A)e_{ct} = \mathbf u_{\perp}^{\top}(\mathbf p - \mathbf A)
u⊥ is u rotated by 90°.
Carrot point
pcarrot=A+(s+L) u\mathbf p_{\text{carrot}} = \mathbf A + (s + L)\,\mathbf u
L is the look-ahead distance.

A velocity command toward the carrot with speed vv is v(pcarrot−p)/∥pcarrot−p∥v(p_{\text{carrot}}-p)/\Vert p_{\text{carrot}}-p\Vert . The geometry gives the cross-track dynamics for small errors: with speed vv the cross-track error decays with time constant about L/v, so

Cross-track convergence
e˙ct≈−vL ect,τct=Lv\dot e_{ct} \approx -\frac{v}{L}\,e_{ct}, \qquad \tau_{ct} = \frac{L}{v}

Choosing L=v τL=v\,\tau for the desired time constant τ\tau (say 2–4 s for a smooth multirotor, depending on its limits) makes LL scale with speed. Corner speed is limited by the available lateral acceleration amax⁡a_{\max}: for a turn of radius rr, v≤amax⁡rv\le \sqrt{a_{\max} r}, and a corner of interior angle ϕ\phi blended with acceptance radius RaccR_{\text{acc}} has a radius of roughly Racc/cos⁡(ϕ/2)R_{\text{acc}}/\cos (\phi /2)-type geometry (the exact relation depends on the blending method).

AA, BB
leg end points (m).
LL
look-ahead distance (m).
ecte_{\text{ct}}
cross-track error (m).
amax⁡a_{\max}
maximum lateral acceleration the vehicle can sustain (m/s2)(m/s^{2}).

Architecture and data flow

Mission item list (from the ground station or the companion computer) → navigator (current leg, acceptance logic) → position/velocity setpoint → position controller → attitude controller. In PX4 the navigator publishes a position setpoint triplet (previous, current and next) that the position controller uses to blend corners; in ArduPilot the equivalent is the waypoint navigation controller with its own acceptance radius and spline options. The safety monitors (geofence, battery, link and estimator status) sit beside the navigator and can override it with return or land.

Real-world UAV applications

  • Survey and mapping missions flown as lawn-mower legs.
  • Inspection routes along infrastructure.
  • Automated delivery and patrol routes.
  • Test routines in SITL: the same mission replayed with different wind and sensor noise.

Implementation example

This runs as shown. A point-mass vehicle with a first-order velocity response (time constant 0.5 s, a stand-in for the inner loops) and a steady crosswind flies a 3-waypoint mission with carrot guidance. A pure carrot law has no wind feedforward, so the crosswind leaves a steady cross-track offset of about ww LL / vv (here 1 × 10 / 5 = 2 m); the test confirms the simulated offset matches that prediction and that the mission completes. Reducing the offset needs integral action on cross-track error or a wind estimate.

import numpy as np

def carrot(p, A, B, L):
    u = (B - A) / np.linalg.norm(B - A); s = u @ (p - A)
    n = np.array([-u[1], u[0]]); e_ct = n @ (p - A)
    return A + (s + L) * u, s, e_ct, np.linalg.norm(B - A)

W = [np.array(w, float) for w in [(0, 0), (60, 0), (60, 40)]]
dt, tau_v, v_cmd, R_acc = 0.05, 0.5, 5.0, 2.0
wind = np.array([0.0, 1.0])                           # 1 m/s steady crosswind pushes the vehicle off the first leg
p = W[0].copy(); v = np.zeros(2); leg = 0; worst = 0.0; t = 0.0
while leg < len(W) - 1 and t < 120:
    A, B = W[leg], W[leg + 1]
    c, s, e, length = carrot(p, A, B, L=v_cmd * 2.0)    # look-ahead = speed x 2 s
    c = A + (B - A) * min(1.0, max(0.0, (c - A) @ (B - A) / length ** 2))   # never aim past the waypoint
    dirn = (c - p) / max(np.linalg.norm(c - p), 1e-6)
    v += (v_cmd * dirn - v) / tau_v * dt                # first-order velocity response
    p += (v + wind) * dt; t += dt
    if t > 8.0 and leg == 0: worst = max(worst, abs(e))     # after the transient
    if np.linalg.norm(B - p) < R_acc: leg += 1
print(f"mission complete: {leg == len(W) - 1}, time {t:.1f} s, worst cross-track {worst:.2f} m on leg 1")
print(f"predicted steady offset w L / v = {1.0 * 10.0 / 5.0:.2f} m")
assert leg == len(W) - 1 and 1.5 < worst < 2.5
Carrot guidance with a crosswind. The look-ahead is speed × 2 s, so the cross-track time constant is about 2 s and the steady offset is about w L / v.

Common engineering mistakes

Fixed look-ahead at all speeds

It becomes too short at high speed and oscillates; scale with speed.

Acceptance radius smaller than the position error

The vehicle never “arrives” and hovers forever; the radius must exceed the achievable position accuracy including GNSS or VIO error.

Ignoring the leg beyond the waypoint

The carrot can pass the waypoint and pull the vehicle past it: clamp the projection.

Altitude and horizontal legs treated identically

Climb rates and horizontal speeds have different limits.

No mission-level timeout

A stalled waypoint can hold the vehicle until the battery is empty.

Failure modes

Failure modes, symptoms and causes
Failure modeHow it shows upLikely cause
Corner cuttingVehicle passes far from the waypointAcceptance radius too large or no corner speed limit
Hovering at the waypoint foreverNever advancesRadius smaller than position error; wrong waypoint frame or altitude reference
Snaking along the legOscillation around the lineLook-ahead too short for the speed and inner-loop lag
Wide arcs in windLarge cross-track errorPure pursuit of the waypoint instead of line following; wind exceeds capability

Debugging approach

  1. Plot the flown path over the planned legs and the cross-track error against time.
  2. Log the acceptance distance at each waypoint switch.
  3. Replay the mission in SITL with wind off, then on, to separate guidance faults from estimation faults.
  4. Check the frame and altitude reference (relative to home, above mean sea level) for each waypoint.

Practical exercises

  1. Change the look-ahead to 0.5 s × speed and 6 s × speed and compare cross-track error and corner cutting.
  2. Add a corner speed limit v=amax⁡rv=\sqrt{a_{\max} r} with amax⁡=3 m/s2a_{\max}=3\,\mathrm{m}/\mathrm{s}^{2} and a radius derived from the acceptance circle.
  3. Add integral action on cross-track error (or a wind-velocity feedforward) and show the steady offset going to zero.
  4. Write the acceptance logic for a waypoint that requires a 5 s hold and a heading.

Interview questions

Write an answer in your own words, then reveal the model answer. Nothing is sent anywhere.

Question 1

What is cross-track error and how is it used in guidance?

Model answer

The signed perpendicular distance from the planned leg. Guidance laws such as carrot or line-of-sight steer to reduce it with a time constant set by the look-ahead distance divided by speed.

Question 2

How do you choose a waypoint acceptance radius?

Model answer

Larger than the achievable position accuracy (so the vehicle can arrive) and smaller than the mission tolerance. Trade corner speed against precision: tight acceptance forces slow, near-stopped corners.

Question 3

Why scale the look-ahead with speed?

Model answer

The cross-track time constant is L/v. A fixed LL makes the loop faster as speed rises, until the vehicle’s inner-loop lag makes it oscillate.

References and further reading

Primary papers, official documentation and standards. Each claim above that is specific to a tool or version points here.

What’s next

Mark this lesson

Saved in this browser and synced to your account when you are signed in.

Practice this lesson

M5-L7: Implement waypoint navigation

Fly a waypoint sequence.

Next lesson

M5-T11: A* and RRT path planning

Plan a collision-free path with A* on a grid and RRT in continuous space, and compare optimality, completeness and run time.