Localization and obstacle avoidance
UAT 457 UAS for Transportation and Autonomous Delivery
Lesson
By the end of this module you will be able to
- Explain the position sources of a delivery drone and the accuracy of standard GNSS and RTK
- Compute total system error from its three components and decide whether a narrow corridor can be flown
- Design a navigation-health monitor that chooses an action from position quality and corridor width
- Explain three layers of obstacle avoidance and compute the highest speed that still stops within the sensor's real range
Why this matters
The corridors of module 7 only mean something if the drone actually stays inside them. If the system’s own position is three metres off in a corridor only six metres wide between two buildings, the propellers may brush a wall. And even with a good position, things not on the map, such as a newly raised crane or a cherry picker lifting workers onto a roof, can block the way on any day.
This module answers two questions from the delivery system’s point of view: is the known position good enough for this corridor, and when an obstacle appears, how does the system respond from the aircraft up to the server. How the EKF works is covered in UAT 305 and sensor principles in UAT 205; here we use their outputs to make decisions.
Position sources of a delivery drone
Localization means knowing where you are and which way you face. A delivery drone fuses several sources with an extended Kalman filter (EKF) on the flight controller (Groves, 2013).
- GNSS, satellite navigation such as GPS, Galileo and BeiDou, gives position anywhere with a view of the sky but can be several metres off, and worse near tall walls or large metal tanks that reflect signals
- RTK (real-time kinematic) uses a ground reference station to send corrections. When the carrier-phase ambiguities are fully resolved the solution is fixed, accurate to centimetres; otherwise it is float, accurate to decimetres or half a metre. Many commercial docks include an RTK module
- IMU and barometer give continuous short-term motion and height, bridging GNSS outages
- Cameras and rangefinders are used in the final phase near the ground and above the dock, covered in module 9
Each source also reports its own quality, such as fix type, number of satellites and estimated accuracy. The delivery system must decide using this quality, not just the coordinates.
Error budget and corridor width
Civil aviation route navigation offers a framework that applies directly to drones. FAA AC 90-105A defines total system error (TSE) as the difference between true and desired position, equal to the vector sum of three parts (Federal Aviation Administration, 2016).
- NSE (navigation system error): the difference between true position and estimated position
- FTE (flight technical error): how accurately the estimated position is kept on the path; for a drone, how well the position controller holds the line in gusts
- PDE (path definition error): the difference between the path defined in the system and the path actually wanted, for example corridor coordinates surveyed slightly wrong
Civil specifications state values for 95% of flight time, for example lateral TSE within ±1 nautical mile for at least 95% of the time. Drones on the estate use the same idea in metres. If the three parts are taken as independent, they combine as root-sum-square, , which is compared with the corridor half-width minus half the aircraft width including propellers .
Example 1 Which position source allows the narrow gap between buildings?
Test-flight logs give a 95% FTE of 1.0 m, corridor coordinates may be off by 0.2 m, and the aircraft is 1.2 m wide including propellers. There are two corridor types: narrow between buildings with a 3 m half-width, and wide over a road with an 8 m half-width (all assumed).
import math
# total system error (95%) for each positioning mode, combined as root-sum-square (assumed independent)
FTE, PDE = 1.0, 0.2 # flight technical error and path definition error (m, assumed)
NSE = {"RTK fixed": 0.05, "RTK float": 0.5, "GNSS": 3.0, "GNSS degraded": 6.0}
half_span = 0.6 # half the aircraft width including propellers (m)
def tse(mode):
return math.sqrt(NSE[mode] ** 2 + FTE ** 2 + PDE ** 2)
for corridor_half in (3.0, 8.0): # narrow corridor between buildings, wide corridor over a road
allow = corridor_half - half_span
print(f"corridor half-width {corridor_half} m, TSE allowed {allow:.1f} m")
for m in NSE:
print(f" {m:13s} TSE {tse(m):4.2f} m {'ok' if tse(m) <= allow else 'not allowed'}")
corridor half-width 3.0 m, TSE allowed 2.4 m
RTK fixed TSE 1.02 m ok
RTK float TSE 1.14 m ok
GNSS TSE 3.17 m not allowed
GNSS degraded TSE 6.09 m not allowed
corridor half-width 8.0 m, TSE allowed 7.4 m
RTK fixed TSE 1.02 m ok
RTK float TSE 1.14 m ok
GNSS TSE 3.17 m ok
GNSS degraded TSE 6.09 m ok
With RTK, TSE is almost entirely FTE (1.02 m), so spending more on position accuracy no longer helps; the controller needs tuning instead. With standard GNSS, TSE is 3.17 m, above the 2.4 m the narrow corridor allows, though the wide corridor is still fine. The system must therefore know which corridor segment needs which level of positioning.
Monitoring navigation health in flight
Position quality changes throughout a flight. RTK may drop to float under a tall conveyor bridge, or to standard GNSS when the correction link fails. The delivery system therefore needs a navigation health monitor on the companion computer that checks every second whether the current quality is good enough for the corridor the drone is in. The flight controller already runs EKF consistency checks and failsafes (UAT 305), but it does not know how narrow this corridor segment is, so this job belongs to the mission layer.
The design principle is a short grace period, because a one-second dip that recovers is rarely dangerous; acting at once would turn drones back far too often. A drop that lasts beyond the grace period must be acted on immediately. Actions go from light to heavy: continue, slow down (reducing FTE and giving RTK time to return), and divert to the nearest dock through wide corridors.
Example 2 A navigation health monitor
Using the TSE values from Example 1 and a 3-second grace period, the log below is a flight that passes a narrow corridor, a wide one, and back into a narrow one (assumed).
import math
# navigation-health monitor: choose an action every second from fix type and corridor width
FTE, PDE, half_span = 1.0, 0.2, 0.6
NSE = {"RTK fixed": 0.05, "RTK float": 0.5, "GNSS": 3.0, "GNSS degraded": 6.0, "no fix": math.inf}
GRACE = 3 # seconds a bad fix may last before acting (assumed)
def ok(mode, corridor_half):
return math.sqrt(NSE[mode] ** 2 + FTE ** 2 + PDE ** 2) <= corridor_half - half_span
# (second, fix type, corridor half-width in m) from a flight log (assumed)
log = [(0, "RTK fixed", 3.0), (1, "RTK float", 3.0), (2, "GNSS", 3.0), (3, "GNSS", 3.0),
(4, "RTK float", 3.0), (5, "GNSS", 8.0), (6, "GNSS", 8.0), (7, "GNSS", 3.0),
(8, "GNSS", 3.0), (9, "GNSS", 3.0), (10, "GNSS degraded", 3.0)]
bad = 0
for t, mode, w in log:
bad = 0 if ok(mode, w) else bad + 1
if bad == 0:
action = "continue"
elif bad < GRACE:
action = "slow down"
else:
action = "divert to nearest dock"
print(f"t={t:2d}s {mode:13s} half-width {w} m -> {action}")
t= 0s RTK fixed half-width 3.0 m -> continue
t= 1s RTK float half-width 3.0 m -> continue
t= 2s GNSS half-width 3.0 m -> slow down
t= 3s GNSS half-width 3.0 m -> slow down
t= 4s RTK float half-width 3.0 m -> continue
t= 5s GNSS half-width 8.0 m -> continue
t= 6s GNSS half-width 8.0 m -> continue
t= 7s GNSS half-width 3.0 m -> slow down
t= 8s GNSS half-width 3.0 m -> slow down
t= 9s GNSS half-width 3.0 m -> divert to nearest dock
t=10s GNSS degraded half-width 3.0 m -> divert to nearest dock
At seconds 2 and 3 quality drops in the narrow corridor, so the drone slows and waits; at second 4 RTK returns and it carries on. At seconds 5 and 6 standard GNSS is fine because the corridor is wide. From seconds 7 to 9 the drop lasts the full 3 seconds in a narrow corridor, so the system diverts to a dock and moves the job to RETURNING as in module 6.
Three layers of obstacle avoidance
Obstacle avoidance in a delivery system is not only on the aircraft. It has three layers working on different time scales (Siegwart and colleagues, 2011).
- Strategic layer (before flight): known obstacles such as stacks, chemical tanks and high-voltage pylons are avoided when corridors and geofences are drawn. Temporary obstacles announced in advance, such as cranes, are handled by closing graph edges as in module 7
- Tactical layer (on the drone): anything not on the map must be handled by onboard sensors within a fraction of a second. PX4 Collision Prevention keeps a map of the surroundings in sectors (the user guide says 36 sectors, while the source code uses 72 five-degree bins, the format of the
obstacle_distancemessage) and slows and stops before obstacles in Position mode; if no range data arrives for more than 0.5 s it allows no horizontal movement, and after 5 s it switches to Hold mode (PX4 Autopilot, n.d.). ArduPilot offers simple stop or slide avoidance and path planning around obstacles with BendyRuler, or around fences with Dijkstra (ArduPilot Dev Team, n.d.) - System layer (server): when a drone stops at an obstacle it reports position and event type to the server, which decides whether to wait, reroute or recall, and temporarily closes that corridor segment for other drones
A common mistake is assuming the tactical layer sees everything. Avoidance depends entirely on sensors: if a sensor cannot see an object, such as a thin steel cable, the system will not avoid it. And in directions with no sensor coverage, PX4 by default does not allow flight at all.
The fastest speed that still stops in time
Whether the tactical layer stops in time depends on speed. Stopping distance with margin is , where is the delay from detection to braking (PX4 documentation gives typical CP_DELAY values of 0.1 to 0.5 s), the braking deceleration and the distance that must remain. The highest speed comes from solving , where is the range at which the sensor really sees that kind of object, not the maximum range on the datasheet.
Example 3 The corridor beside the crane yard
The W4 to F5 corridor passes the crane yard of a steel-structure plant. Tests show the sensor reliably sees crane steelwork at 15 m. Total delay is 0.4 s, braking 3 m/s², and 2 m must remain (assumed).
import math
# fastest speed that still stops before an obstacle first seen at the sensor's real range (assumed values)
R = 15.0 # range at which the sensor reliably sees crane steelwork (m)
t_d = 0.4 # sensing + decision + response delay (s)
a = 3.0 # braking deceleration (m/s^2)
m = 2.0 # distance that must remain after stopping (m)
def d_stop(v):
return v * t_d + v ** 2 / (2 * a) + m
# solve v*t_d + v^2/(2a) + m = R for v
A, B, C = 1 / (2 * a), t_d, m - R
v_max = (-B + math.sqrt(B ** 2 - 4 * A * C)) / (2 * A)
print(f"v_max = {v_max:.2f} m/s")
for v in (6, 7.5, 9, 12):
print(f"v {v:4.1f} m/s: stopping distance {d_stop(v):5.1f} m {'ok' if d_stop(v) <= R else 'too far'}")
# time cost of the speed limit over a 600 m stretch next to the crane yard
L = 600
print(f"extra time at 7.5 instead of 12 m/s: {L / 7.5 - L / 12:.0f} s")
v_max = 7.71 m/s
v 6.0 m/s: stopping distance 10.4 m ok
v 7.5 m/s: stopping distance 14.4 m ok
v 9.0 m/s: stopping distance 19.1 m too far
v 12.0 m/s: stopping distance 30.8 m too far
extra time at 7.5 instead of 12 m/s: 30 s
At the 12 m/s cruise speed the drone needs 30.8 m, almost twice what the sensor sees. The team limits this segment to 7.5 m/s, slightly below 7.71 m/s for margin. The cost is 30 seconds per flight over 600 m, which must be added to the time used to estimate the ETA.
The effect of avoidance on the schedule must be considered too. Every stop or slow-down pushes the job’s ETA back, and if a stop lasts beyond a threshold, say 20 seconds, the server should reroute rather than wait. Every avoidance event is logged with its position so the team can see later which corridor segments cause trouble often and should be moved.
Module lab
Lab: navigation monitor and stopping test
- Log GNSS from a stationary drone for 10 minutes in open ground and next to a tall building; compute the 95% position spread for each fix type
- Measure FTE from logs of autonomous straight-line flight, then compute TSE for the corridors in your group’s graph with the code in Example 1 and set the positioning level each segment needs
- Adapt the code in Example 2 to read your group’s real log and report how often the system would slow down and divert to a dock
- In SITL or a safe field set-up with a soft obstacle, test stopping at low speed first and increase step by step; compare measured stopping distance with the code in Example 3
Common mistakes
Watch out
- Watching coordinates without fix quality, then flying narrow corridors on standard GNSS
- Buying better positioning when FTE dominates TSE; tune the controller instead
- Acting immediately on a one-second dip, turning drones back far too often
- Using the datasheet’s maximum sensor range instead of the range at which real objects on site are seen
- Assuming avoidance sees everything, although thin cables and glass may not appear in the data
Summary
- A delivery drone fuses GNSS, RTK, IMU, barometer and cameras with an EKF and must decide using data quality, not coordinates alone
- (assumed independent) must not exceed the corridor half-width minus half the aircraft width
- A navigation health monitor uses a grace period, then continues, slows down or diverts to a dock
- Obstacle avoidance has three layers, and speed must be low enough that
Check your understanding
- NSE 2.0 m, FTE 0.8 m, PDE 0.3 m. What is TSE (assumed independent)?
- A corridor half-width of 4 m and a drone half-width of 0.6 m. Is standard GNSS with TSE 3.17 m acceptable?
- At 5 m/s with 0.4 s delay, 3 m/s² braking and 2 m to remain, what is the total stopping distance?
- Why does PX4 forbid horizontal movement when no range data arrives for more than 0.5 s?
- Why should the navigation health monitor sit on the companion computer rather than leaving the decision to the flight controller’s EKF alone?
Answers
- m
- Yes, the limit is m, above 3.17 m, but with only 0.23 m to spare
- m
- Because it does not know what is ahead, so stopping is safer than flying on blind
- The EKF checks data consistency but does not know each corridor’s width; the mission layer knows both the corridors and the job, so it can decide to slow down, divert or change the job state
Key formulas
| Total system error (assumed independent) | |
| Corridor condition | |
| Stopping distance with margin |
Key references
- Groves, P. D. (2013). Principles of GNSS, inertial, and multisensor integrated navigation systems (2nd ed.). Artech House. link
- Federal Aviation Administration. (2016). Approval guidance for RNP operations and barometric vertical navigation in the U.S. National Airspace System and in oceanic and remote continental airspace (Advisory Circular 90-105A). link
- Siegwart, R., Nourbakhsh, I. R., & Scaramuzza, D. (2011). Introduction to autonomous mobile robots (2nd ed.). MIT Press. link
- PX4 Autopilot. Collision prevention. PX4 user guide (main). link
- ArduPilot Dev Team. Object avoidance. ArduPilot Copter documentation. link
Further reading
Study the assigned knowledge units in advance, review media and take the module quiz
GNSS and constrained navigation
LiDAR เรดาร์ และเซนเซอร์หลบหลีกสิ่งกีดขวาง
การวางแผนเส้นทางและหลบหลีกสิ่งกีดขวางอัตโนมัติ
In class / field
Lab or field practice from worksheets with a safety checklist
Learning evidence: Checked worksheets and quiz results