Drone Navigation: GNSS, RTK/PPK, and GPS-Denied Flight, The Ultimate Guide
How drones fix position: GNSS trilateration, RTK/PPK for centimeter mapping, and holding steady when GPS is jammed, spoofed, or gone indoors.
A drone hovering over a field looks like it is standing still. Really it is dead-reckoning off a swarm of atomic clocks 20,000 km overhead, correcting a position estimate that would otherwise drift meters in seconds, and it is doing this while a magnetometer argues with the motor currents an inch away and the barometer wanders with the afternoon weather. The stillness is the output of a filter, and the filter is only as honest as the radio signals feeding it. Cut the GNSS fix in a steady wind and a position-hold quad will slide off downwind, hunting for a ground reference it no longer has.
That fragility is why navigation is a layered stack of systems. At the top is GNSS: the Global Navigation Satellite Systems (GPS, GLONASS, Galileo, BeiDou) that hand the aircraft an absolute position anywhere on Earth with a clear view of the sky. Underneath sit the corrections that turn a meters-level fix into a centimeter one (RTK and PPK), and underneath those sit the fallbacks for when the sky is gone: inertial dead reckoning, optical flow, visual-inertial odometry, and lidar SLAM. Every serious platform blends the layers through an Extended Kalman Filter, so the same aircraft can survey a quarry to survey grade in the open and still hold position in an underground drift where no satellite reaches.
This guide works from the physics of a single satellite fix outward: how a receiver solves for position and its own clock, where the error comes from, how RTK and PPK beat it down to centimeters, why that precision is the whole point of mapping and spraying, and what the aircraft does when the signal degrades, jams, spoofs, or simply vanishes indoors. Positioning stays at the concept level throughout. We care about the mechanism and leave the model numbers aside.
The take: A GNSS receiver measures time of flight from four or more satellites and solves for three position coordinates plus its own clock error simultaneously, which is why four satellites is the floor and geometry (DOP) matters as much as signal count. Standalone GNSS lands at 1 to 3 m because the ionosphere, troposphere, and multipath each add their own delay to that timing. RTK and PPK both kill those errors by differencing the aircraft's measurements against a nearby base station that knows exactly where it sits, reaching 1 to 3 cm by tracking the carrier wave itself instead of the code riding on it. RTK does it live over a radio or cellular link and is what you need to fly a swath; PPK does it after landing from logged raw data and is more robust for mapping. When the sky is blocked, jammed, or spoofed, position hold falls back to inertial plus optical flow, VIO, or lidar SLAM, and the EKF that fuses all of it is only as trustworthy as its worst input.
Companion reading: SLAM & localization, robot sensors, drone & UAV hardware, real-time control systems, drone mapping & photogrammetry, and counter-drone & C-UAS.
Table of contents
- Key takeaways
- How GNSS works: timing, trilateration, the clock unknown
- The four constellations and multi-constellation receivers
- Sources of positioning error
- Standalone vs SBAS accuracy
- RTK: carrier phase, base stations, NTRIP, fixed vs float
- PPK: post-processing and the RTK/PPK tradeoff
- Why RTK/PPK matters: mapping and spraying
- GPS-denied and degraded environments
- Optical flow, VIO, rangefinders, and SLAM
- The magnetometer and its failure modes
- EKF sensor fusion for navigation state
- Failsafe behavior: RTH, geofencing, GNSS-loss handling
- Selecting a navigation stack
- Frequently asked questions
How GNSS works: timing, trilateration, the clock unknown
Strip away the constellations and acronyms and a satellite fix is one idea: measure how long a signal took to arrive, multiply by the speed of light to get a distance, and intersect enough distances to pin a point in space. Each satellite broadcasts a continuous stream stamped with the exact time it left and the satellite's own position (from the broadcast ephemeris, the orbital data the satellite sends about itself). The receiver reads the timestamp, subtracts it from its own clock, and gets a travel time. Travel time times the speed of light is a pseudorange, the receiver's raw estimate of the distance to that satellite.
Call it "pseudo" for a reason. The satellite carries a cesium or rubidium atomic clock disciplined to national time standards, accurate to nanoseconds. The receiver carries a cheap quartz oscillator that is off by microseconds, and a microsecond of clock error is 300 m of range error. If the receiver clock were the truth, three satellites would suffice: three spheres intersect at a point (two points, one of which is out in space and discarded). The receiver clock is not the truth, so its bias becomes a fourth unknown, common to every pseudorange at once. Four satellites, four equations, four unknowns (x, y, z, and clock bias t), and the solver recovers all four. This is why a 3D fix needs a minimum of four satellites, and it is also a gift: solving for t means the receiver's junk clock gets corrected to nanosecond time as a free byproduct, which is why GPS is also the world's timing utility.
The measurement itself rides on a pseudo-random noise (PRN) code, a known bit sequence unique to each satellite. The receiver generates its own copy and slides it in time until it correlates with the incoming signal; the slide amount is the travel time. Code correlation is coarse. A GPS C/A code chip is about 293 m long, and a receiver tracks it to maybe 1 percent of a chip, so raw code pseudorange precision is on the order of a few meters even before the atmosphere gets involved. That noise floor is the entire reason RTK exists, and it is why RTK abandons the code and measures the carrier wave underneath it.
Rule of thumb: One nanosecond of timing error equals about 30 cm of range. Every technique in this guide, from dual-frequency correction to RTK, is a method of pinning down travel time more precisely against something trying to smear it.
Satellites beyond the fourth earn their keep. Extra measurements over-determine the solution, and the receiver runs a least-squares (or Kalman) fit that averages down random noise and lets it detect and exclude a bad satellite (receiver autonomous integrity monitoring, RAIM). A modern drone receiver tracks 20 to 30 satellites across several constellations at once, which is why fixes are so much faster and steadier than the 8-satellite GPS-only era.
The four constellations and multi-constellation receivers
There are four independent global systems in orbit as of 2026, each a full constellation with its own ground control and time reference:
| System | Operator | Satellites (nominal) | Notes |
|---|---|---|---|
| GPS | United States | ~31 | The original, L1/L2/L5 signals, modernized |
| GLONASS | Russia | ~24 | FDMA legacy, moving to CDMA; different frequency scheme |
| Galileo | European Union | ~28 | Civil-run, strong on L1/E5, high-accuracy service |
| BeiDou (BDS-3) | China | ~35+ | Global since 2020, includes short-message service |
Two regional systems fill gaps over their footprints: Japan's QZSS (which parks satellites over Asia-Pacific and augments GPS) and India's NavIC. A receiver that listens to all of them is multi-constellation, and it wins for a plain geometric reason: more satellites visible means more of the sky is covered, which means better geometry (lower DOP), faster fixes, and resilience when buildings or terrain block part of the sky. In an urban canyon where a single constellation might show four satellites down a slot of visible sky (terrible geometry), four constellations together might show fifteen spread wide enough to solve well.
The other axis is frequency. Each system broadcasts on multiple bands (GPS L1 at 1575.42 MHz, L2 at 1227.6 MHz, L5 at 1176.45 MHz, with Galileo and BeiDou on nearby bands). A single-frequency receiver hears one band and must model the ionosphere from a broadcast approximation. A dual-frequency (or triple-frequency) receiver hears two or more and can measure the ionospheric delay directly, because that delay depends on frequency in a known way. This is the single biggest jump in standalone accuracy, and it is why survey-grade drone receivers are all multi-frequency. Dual frequency also speeds up RTK ambiguity resolution dramatically, which matters when an aircraft banks and briefly loses lock on satellites.
Rule of thumb: For a drone, multi-constellation plus dual-frequency is the combination that matters. Multi-constellation buys you sky coverage and geometry; dual-frequency buys you direct ionospheric correction and fast, reliable RTK fixes. Chasing raw satellite count on one band gains far less.
Sources of positioning error
Standalone GNSS lands at 1 to 3 m because a chain of independent errors each perturbs the travel time. Understanding them tells you exactly what RTK and PPK are cancelling.
Ionospheric delay. The ionosphere, roughly 60 to 1000 km up, is charged plasma that slows the code and advances the carrier. The delay ranges from about 1 m at night at the zenith to more than 10 m for a low satellite during a daytime solar maximum. It is dispersive, meaning it depends on frequency (as roughly 1/f squared), which is precisely what lets a dual-frequency receiver measure and remove it. This is usually the largest single standalone error.
Tropospheric delay. The lower, neutral atmosphere adds a delay of about 2.3 m at the zenith (a dry hydrostatic component plus a wet water-vapor component), growing as satellites drop toward the horizon. It is not dispersive, so dual-frequency does not help; it is handled by a model, and it largely cancels in RTK because the base and aircraft see nearly the same troposphere.
Multipath. The signal bounces off ground, water, buildings, or the airframe itself and arrives twice, once direct and once delayed, and the receiver's correlator smears between them. Multipath adds up to a few meters on code and up to a few centimeters on carrier phase. It does not cancel in RTK because it is local to each antenna. This is why survey antennas use a ground plane or choke ring, why the GNSS antenna sits high and clear on a mast, and why flying over calm water or next to a metal wall degrades the fix.
Satellite clock and ephemeris error. The broadcast orbit and clock are predictions, off by up to a couple of meters. These are common to any receiver looking at the same satellite, so they cancel almost perfectly in differential techniques.
Receiver noise and geometry. Thermal noise in the receiver adds a little. Geometry multiplies everything, and geometry has a name.
Dilution of precision (DOP) is the amplification factor from ranging error to position error. If the satellites you are using are spread evenly across the sky, their pseudorange spheres intersect at a sharp, well-conditioned point, and DOP is low (near 1). If they are bunched together, the spheres graze at a shallow angle and a small ranging error smears the fix over a large region, so DOP is high. The flavors:
- GDOP: geometric, the overall factor including clock.
- PDOP: position (3D).
- HDOP / VDOP: horizontal and vertical split. Vertical is always worse because you only see satellites above you, never below, so the vertical geometry is one-sided.
Total horizontal error is roughly HDOP × range_error. A PDOP under 2 is excellent, 2 to 5 is usable, above 6 is poor. Vertical GNSS error runs about 1.5 to 3 times the horizontal, which is why drones lean on the barometer for altitude even with a good fix.
| Error source | Typical magnitude | Cancels in RTK/PPK? |
|---|---|---|
| Ionosphere | 1 to 10+ m | Yes (and dual-freq removes it standalone) |
| Troposphere | ~2.3 m zenith, more at low elevation | Mostly (short baseline) |
| Satellite clock/ephemeris | up to ~2 m | Yes |
| Multipath | code few m, carrier few cm | No (local to antenna) |
| Receiver noise | sub-meter | No, but small |
Standalone vs SBAS accuracy
A bare multi-constellation receiver with a decent antenna gives you 1 to 3 m horizontal (CEP, circular error probable, the radius containing half the fixes) in the open. Good enough to return to a launch point within a car-length, hold a loose position against wind, and fly a waypoint mission where a couple of meters of wander does not matter. Not good enough to stitch survey-grade orthomosaics or drive a sprayer down a crop row.
SBAS, the Satellite-Based Augmentation Systems, are the first step up and cost nothing to use. A network of ground reference stations at surveyed locations measures the live errors (ionosphere, satellite clock and orbit) across a continent, and geostationary satellites broadcast those corrections on the GPS L1 frequency so any compatible receiver can apply them. The regional systems:
- WAAS (North America)
- EGNOS (Europe)
- MSAS (Japan)
- GAGAN (India)
SBAS trims standalone error to roughly 0.5 to 1 m horizontal, and it adds an integrity message (a guarantee, used in aviation, that the fix is trustworthy or flagged unusable). For a consumer or prosumer drone this is often the ceiling of built-in accuracy. The corrections are wide-area, so they cancel the parts of the error that vary slowly over hundreds of kilometers (ionosphere, orbits) but not the parts local to your antenna (multipath) or the residual atmosphere. To break below decimeter you have to stop trusting the code entirely and measure the carrier, against a base station close enough that the local atmosphere cancels. That is RTK.
RTK: carrier phase, base stations, NTRIP, fixed vs float
RTK, Real-Time Kinematic, reaches 1 to 3 cm by measuring the phase of the carrier wave instead of the code stamped on it. The GPS L1 carrier is a sine wave about 19 cm long, and a receiver can measure where it sits within one cycle to about 1 percent, a couple of millimeters. That is a thousand times finer than code. The problem is that a sine wave looks identical every cycle, so the receiver knows the fractional phase precisely but has no idea how many whole wavelengths lie between the satellite and the antenna. That unknown integer count is the carrier-phase integer ambiguity, and resolving it is the entire game of RTK.
You cannot solve the ambiguity from one receiver. RTK solves it by differencing against a second receiver, the base station, sitting motionless on a point whose coordinates are known exactly (surveyed, or averaged over a long occupation). Because base and aircraft (the rover) see the same satellites through nearly the same atmosphere, subtracting one receiver's measurements from the other cancels the errors they share: satellite clock, ephemeris, and (over a short baseline) most of the ionosphere and troposphere. What remains is the geometry between base and rover, which the receiver solves to centimeter level once it fixes the integer ambiguities. The algorithm that searches for the correct integers efficiently is the LAMBDA method, and modern dual-frequency receivers converge in seconds.
The corrections have to get from base to rover in real time, and there are two transport paths:
- Radio link: a pair of telemetry radios (often 900 MHz or 433 MHz) streams base observations directly to the aircraft. Fully self-contained, works with no cellular coverage, range-limited to line of sight.
- NTRIP over cellular: NTRIP (Networked Transport of RTCM via Internet Protocol) streams RTCM correction messages over the internet. The aircraft (or its ground station) pulls corrections from an NTRIP caster, which can be your own base or a CORS network (Continuously Operating Reference Stations) run by a government or commercial provider. Network RTK (VRS, virtual reference station) interpolates a virtual base right next to you from a mesh of real stations, so you do not need your own base at all where coverage exists.
Baseline length is the hard limit. RTK works best under about 10 km base-to-rover and degrades beyond 20 to 30 km, because past that the atmosphere over the base stops matching the atmosphere over the rover and the shared errors no longer cancel. Long baselines take longer to fix and fall back to float more often.
That word matters. RTK reports one of two states:
- Fixed: the integer ambiguities are resolved, and you have full 1 to 3 cm accuracy. This is the only state you should log for survey.
- Float: the receiver is still estimating the ambiguities as real numbers, not integers, and accuracy is decimeter-level (10 to 50 cm). Float looks like a lock but is not survey grade.
War story: A team flew an RTK mapping mission and only checked that the aircraft showed "RTK" on the ground station, never that it showed fixed. The link dropped to float partway through when the aircraft banked and shadowed its antenna, and nobody noticed. The orthomosaic came back internally consistent but bodily shifted 30 cm from the control points, and the whole flight had to be reshot. Log the solution status per epoch, and treat any float epoch as suspect. RTK that is not fixed is just expensive standalone GNSS.
PPK: post-processing and the RTK/PPK tradeoff
PPK, Post-Processed Kinematic, uses the same carrier-phase physics as RTK and reaches the same 1 to 3 cm, but it moves the computation off the aircraft and after the flight. Instead of streaming corrections live, the aircraft logs its own raw GNSS observations to onboard storage, and the base station logs its raw observations independently. After landing, you feed both logs into processing software (open-source RTKLIB, or commercial packages) which computes the trajectory offline.
Moving the math off the critical path buys three real advantages:
- No radio link to drop. There is no correction stream to lose over range, terrain, or a banking airframe. A dropped link is a failed RTK flight; PPK does not have a link.
- Forward and backward processing. RTK can only run causally, forward in time, so a satellite outage mid-flight leaves a gap while it re-converges. PPK processes the log in both directions and blends them, so an outage that RTK would ride out as float gets filled in from data on the far side. This makes PPK the more robust of the two for demanding mapping.
- Base flexibility. You can process against your own logged base, or download data from a public CORS station after the fact and process against that, choosing the nearest station retroactively.
The cost is that you get nothing in real time. PPK cannot steer the aircraft, cannot hold a precise swath live, and cannot tell the operator anything until the data is processed. That draws the line between them:
| RTK | PPK | |
|---|---|---|
| When computed | Live, in flight | After landing |
| Needs live data link | Yes (radio or NTRIP) | No |
| Robust to link/satellite dropout | Falls to float | Fills gaps (forward + backward) |
| Steers the aircraft in flight | Yes (swaths, precision hold) | No |
| Base station | Live base or NTRIP/CORS | Logged base or downloaded CORS |
| Best fit | Real-time guidance: spraying, RTK loiter, precision landing | Highest-confidence mapping and geotagging |
The clean way to say it: RTK when the aircraft needs the centimeter position during the flight to do its job, PPK when only the final geotagged data needs to be centimeter accurate and robustness beats immediacy. Many mapping rigs log raw data for PPK even while flying RTK, so PPK becomes the fallback that saves a mission when the live link drops to float.
Why RTK/PPK matters: mapping and spraying
Centimeter positioning earns its keep on a mapping or agricultural drone. It changes what the aircraft can do without human scaffolding.
Mapping and photogrammetry. A survey drone geotags every photo with the camera's position at the instant of exposure. Standalone GNSS tags each shot to a few meters, so to georeference the final model you must lay out and survey ground control points (GCPs), painted targets on the ground at known coordinates, then identify them by hand in the imagery. That is slow, needs site access, and is impossible over water or hazardous ground. RTK/PPK tags each photo to a couple of centimeters, which collapses the GCP count to a handful of checkpoints (used only to verify, not to solve), and in many workflows removes them entirely. The details that make this work: the camera fires an electronic event marker (a hot-shoe pulse) that timestamps the exact exposure against the GNSS clock to sub-millisecond, and the software applies the fixed lever-arm offset from the GNSS antenna phase center to the camera sensor. Get the timing or the lever arm wrong and every geotag inherits a constant shift. Done right, a mapping flight comes back to survey grade with no one walking the site placing targets. The drone leaderboard at data.robo2u.com/drones tracks which survey platforms ship integrated RTK/PPK and multi-frequency receivers.
Agricultural spraying. A spray drone flies parallel swaths across a field, and the swaths must abut without gapping (untreated strips) or overlapping (double-dosed strips that waste chemical and risk crop burn). At 1 to 3 m standalone accuracy, a 4 to 6 m swath cannot be placed reliably, so the passes drift and the coverage is uneven. RTK holds the aircraft on line to centimeters, so swaths butt cleanly, section control shuts nozzles off over already-sprayed ground, and the same field can be re-treated weeks later along the identical lines. RTK also enables repeatable terrain-following altitude over the canopy when paired with a downward radar or lidar. The economics are direct: tighter swaths mean less wasted chemical, fewer misses, and defensible records of exactly where product went down.
The shared thread is repeatability. Absolute centimeter accuracy means two flights weeks apart land in the same coordinate frame, so you can measure a stockpile's change, follow the same spray lines, or overlay this month's map on last month's. Standalone GNSS, with its wandering few-meter bias, cannot promise that two maps of the same field even line up.
GPS-denied and degraded environments
Everything above assumes a clear view of the sky. Take that away and the aircraft has to navigate anyway. GNSS degrades or vanishes in four distinct ways, and they are not equivalent.
Indoors and underground. GNSS signals arrive at about -160 dBm, weaker than the thermal noise floor, recovered only by correlating against the known PRN code. A roof or a few meters of rock kills them outright. Inside a building, a mine, or a tunnel there is simply no fix, and the aircraft must hold position on onboard sensing alone.
Urban canyon. Between tall buildings the sky narrows to a slot, so few satellites are visible and their geometry is one-sided (high DOP). Worse, the signals that do arrive often come by multipath, bounced off glass and concrete, so the receiver computes a range that is too long and the fix jumps around by tens of meters. A canyon fix can look healthy (satellites tracked, "3D fix") while being badly wrong, which is more dangerous than no fix at all.
Jamming. A jammer floods the GNSS band with noise, and because the real signal is already below the noise floor, even a cheap low-power jammer can deny it over a wide area. The symptom is a clean loss of fix and rising receiver noise. Jamming is now common near conflict zones and around some infrastructure, and a drone that treats loss-of-GNSS as an emergency will react to it constantly.
Spoofing. The dangerous one. A spoofer broadcasts counterfeit GNSS signals, stronger than the real ones, carrying false timing, and captures the receiver's tracking loops. The receiver reports a confident, healthy fix at a wrong position, and can be walked smoothly away from the truth or made to believe it is somewhere it is not. Spoofing defeats naive geofencing (feed the drone a fake position outside the fence and it will not trigger, or feed it one inside a no-fly zone and ground it). Detection leans on cross-checks: does the GNSS position agree with the inertial dead reckoning, do multiple constellations and frequencies agree, is the signal power implausibly high, does a multi-antenna receiver see a single direction of arrival (a spoofer transmits from one point, real satellites from many). Military receivers add encrypted signals; civil drones increasingly add inertial and visual cross-checks. For the offensive and defensive side of this, see counter-drone & C-UAS.
Safety rule: A "3D fix" is not proof of a correct position. In an urban canyon or under a spoofer the receiver can report high confidence while being tens of meters or miles wrong. Cross-check GNSS against the inertial estimate and reject positions that imply impossible velocity jumps. Trust the fix only when independent sensors agree with it.
Optical flow, VIO, rangefinders, and SLAM
When GNSS is gone or untrusted, position hold falls to sensors that never needed the sky. They form a ladder of capability and cost.
Inertial dead reckoning is the baseline and the reason nothing collapses instantly. The IMU integrates acceleration and angular rate to propagate position forward with no external reference. It is exact over the very short term and useless over the long term, because integrating accelerometer noise and bias makes the position error grow with the square of time. A MEMS IMU alone drifts meters within seconds. Dead reckoning buys the seconds an aircraft needs to notice GNSS is bad and switch to a real GPS-denied source; it cannot hold position on its own.
Optical flow is the cheapest true position aid. A downward camera tracks how the ground texture slides across the frame between images, which (scaled by the height above ground) gives horizontal velocity. Integrate velocity and you get a position that holds against wind indoors. Optical flow needs a textured surface (it fails over blank concrete, calm water, or snow), adequate light, and, critically, a height reference to convert pixel motion into real velocity, which is why it is almost always paired with a downward rangefinder.
Downward rangefinders give height above ground directly. A short-range lidar or time-of-flight sensor is good to a few centimeters up to tens of meters; a downward radar altimeter works to a hundred meters or more and sees through dust and crop canopy, which is why spray drones use it for terrain following. Height above ground is what makes optical flow metric and what enables precision landing and terrain-following altitude independent of the barometer.
Visual-inertial odometry (VIO) is the step up. It fuses one or more cameras with the IMU: the camera tracks visual features across frames to estimate 6-DOF motion, and the IMU fills the fast dynamics and resolves the scale and gravity direction that vision alone leaves ambiguous. VIO gives a drift-bounded position estimate with no external reference and no ground texture requirement (it uses features in any direction), and it is what lets a drone hold position and fly through a GPS-denied building. The tradeoff is compute and a dependence on visual texture and light; VIO gets lost in a dark, featureless, or foggy space.
Lidar SLAM is the heaviest and most capable. A 3D lidar builds a point-cloud map of the surroundings and localizes the aircraft within it simultaneously (Simultaneous Localization and Mapping), giving centimeter-class position with no GNSS and no light at all. This is what flies drones through unlit underground mines and collapsed structures, building the map that is also the deliverable. It costs the most in payload, power, and compute, and it is the subject of its own guide: SLAM & localization. For the sensors underneath all of this, see robot sensors and the depth-sensing hardware in drone & UAV hardware.
The pattern up the ladder is more capability for more compute, weight, and cost: dead reckoning (free, seconds), optical flow plus rangefinder (cheap, hold indoors), VIO (moderate, fly indoors), lidar SLAM (heavy, map and fly in the dark). A platform picks the rung its mission needs.
The magnetometer and its failure modes
Position tells you where you are. Heading tells you which way you point, and on a GNSS aircraft that comes from the magnetometer (compass), which measures the Earth's magnetic field vector to derive yaw relative to magnetic north. It is the single least reliable sensor on the aircraft, and its failures are quietly dangerous because a bad heading corrupts position control even when the position sensors are perfect.
The field it measures is tiny (25 to 65 microtesla), so anything magnetic nearby swamps it:
- Motor and ESC currents produce their own fields that scale with throttle, so the compass error changes as the aircraft maneuvers. This is why the GNSS/compass module sits up on a mast, as far from the power wiring as the airframe allows.
- Hard-iron distortion is a fixed offset from permanent magnets and magnetized steel on the aircraft (screws, motors, battery straps with steel buckles). It shifts the field by a constant vector and is removed by calibration.
- Soft-iron distortion is ferrous material that bends the field direction, turning the calibration sphere into an ellipsoid. It needs a fuller calibration to correct.
- Environmental fields: flying near steel structures, rebar in concrete, power lines, or vehicles bends the local field, and the compass follows it. Local magnetic declination (the angle between magnetic and true north, varying by location and slowly by year) has to be looked up and applied to convert magnetic heading to true.
The classic failure is toilet-bowling: with a heading error, the position controller pushes in a slightly wrong direction, the aircraft corrects, overcorrects, and spirals outward in a widening circle around the target instead of holding it. A hard compass fault mid-flight can send a position-hold aircraft flying off in a confident wrong direction. Because of all this, FPV and manual quads that fly on gyro heading often skip the compass entirely (see drone & UAV hardware), and it only becomes essential when you need absolute heading for GNSS position hold and missions.
The robust fix on serious platforms is to derive heading from GNSS itself. A dual-antenna moving-baseline RTK setup puts two GNSS antennas a fixed distance apart on the airframe and measures the carrier-phase vector between them, which gives true heading to a fraction of a degree with no magnetic sensor in the loop at all. It is immune to motor currents, rebar, and declination, and it is standard on survey and heavy-lift rigs where a compass fault is unacceptable.
Rule of thumb: If a GNSS aircraft slowly circles a target it should be holding, suspect the compass before the GPS. Calibrate away from steel and power lines, mount the magnetometer far from the ESCs, and on any platform that cannot tolerate a heading fault, use dual-antenna GNSS heading instead of a magnetometer.
EKF sensor fusion for navigation state
No single sensor gives a clean navigation state, so every capable autopilot fuses them in an Extended Kalman Filter. GNSS is absolute but slow, jumpy, and sometimes wrong; the IMU is fast and smooth but drifts; the barometer gives altitude but wanders with weather and prop wash; the magnetometer gives heading but lies near metal; optical flow and vision give velocity but need texture. The EKF (PX4's EKF2, ArduPilot's EKF3) blends all of them into one continuously updated estimate of position, velocity, and attitude, weighting each measurement by its modeled uncertainty.
The machinery is a predict/update cycle. Between measurements the filter predicts, integrating the IMU forward at high rate to propagate the state and growing its uncertainty (covariance) to reflect accumulating drift. When a slower measurement arrives (GNSS at 5 to 20 Hz, baro, flow, vision) the filter updates, computing a gain that blends the measurement against the prediction in proportion to their relative trust. A confident GNSS fix (small assumed error) snaps the estimate to it; a jumpy one (large assumed error) barely nudges it. The IMU carries the state smoothly across the gaps between GNSS epochs, which is why the aircraft's reported position moves fluidly at hundreds of Hz off a GNSS receiver that only updates ten times a second. The full derivation lives in SLAM & localization; the drone-specific point is what fusion buys for navigation.
Two behaviors matter for navigation specifically:
- Innovation gating (outlier rejection). Before accepting a measurement the filter checks the innovation, the gap between what the sensor reports and what the filter predicted. If the gap is too large for the modeled uncertainty (a GNSS position that jumps 40 m in one epoch, an impossible velocity), the filter rejects it as an outlier rather than following it. This is the front-line defense against multipath spikes, a single-satellite fault, and crude spoofing, and it is why a good EKF rides out a brief GNSS glitch on inertial without lurching.
- Graceful source switching. The EKF can fuse or drop sources on the fly. Lose GNSS and it keeps propagating on IMU plus baro plus optical flow or vision, so position hold degrades smoothly instead of collapsing. Regain GNSS and it eases back in once the fix agrees with the inertial estimate, rather than snapping to a possibly-bad fix.
Rule of thumb: Position hold is a fused estimate, and it is only as trustworthy as the filter's worst accepted input. A vibrating IMU, a bad compass, or an unrejected multipath spike poisons the whole estimate. Tune the innovation gates so the filter rejects garbage without rejecting real motion, and log the estimator's health flags alongside the position.
Failsafe behavior: RTH, geofencing, GNSS-loss handling
Navigation is also about what the aircraft does when navigation breaks. Failsafes are the coded responses to lost links, lost signal, and boundary violations, and they run on the same real-time control stack described in real-time control systems.
Return-to-home (RTH) is the headline failsafe. On a trigger (radio link loss, low battery, operator command) the aircraft climbs to a set safe altitude, flies a straight or retraced path back to a recorded home point, and lands or hovers. RTH depends entirely on a good position estimate and a correct home point. The failure modes are instructive: a home point recorded before GNSS had a solid fix sends the aircraft "home" to the wrong coordinates; an RTH altitude set below nearby obstacles flies it into a tree line; RTH triggered in a GNSS-denied area has no position to navigate by and must fall back to something else.
Geofencing defines boundaries the aircraft will not cross, a maximum radius and altitude (a cylinder) or a polygon around a no-fly zone. On reaching the fence the aircraft stops, holds, or triggers RTH depending on configuration. Geofencing is only as good as the position estimate behind it, which is exactly the surface a spoofer attacks: feed a false position and the fence is defeated. Robust geofencing cross-checks the fix against inertial and rejects implausible jumps before acting on them.
GNSS-loss handling is the graceful degradation ladder. Lose the fix and a well-configured autopilot does not panic; it steps down through the modes it still has support for:
- Hold on alternatives. If optical flow, VIO, or lidar SLAM is available and healthy, keep holding position on those. Many indoor and inspection drones fly entire missions here with no GNSS at all.
- Fall back to altitude/attitude hold. With no position source, drop to holding altitude (barometer plus rangefinder) and level attitude (IMU), which stops the aircraft from flying away but lets it drift with the wind. The operator flies it out manually.
- Dead-reckon briefly. Coast on the inertial estimate for the few seconds it stays accurate, enough to ride out a short dropout or a tunnel, then re-acquire.
- Controlled land. If nothing can hold position and no operator takes over, descend in place on altitude hold rather than drift uncontrolled.
The ordering is the whole design: never do something drastic when a gentler fallback still works, and never trust a single sensor's failure to mean the aircraft is lost. A drone that treats every GNSS glitch as an emergency RTH is dangerous in a canyon or under intermittent jamming, where it would launch skyward on a bad position; a drone that ignores a real GNSS loss flies away. The tuning is in the middle.
Safety rule: Test every failsafe on the bench and in a safe open area before you trust it: confirm the home point records only after a solid 3D fix, set RTH altitude above the tallest obstacle on the route, and verify the aircraft holds sensibly when you deliberately deny GNSS. A failsafe you have not tested is a failure you have scheduled.
Selecting a navigation stack
Put it together into a repeatable choice, driven by the mission:
- Decide the accuracy the mission actually needs. Loose position hold and waypoints: standalone or SBAS (1 m) is fine. Survey mapping or precision spraying: RTK or PPK (centimeter). Do not pay for centimeters a mission does not use, and do not try to map on standalone GNSS.
- If you need centimeters, choose RTK vs PPK by whether the aircraft needs the position live. Real-time guidance (spraying swaths, RTK loiter, precision landing) means RTK, and you must plan the correction link (radio range or cellular NTRIP coverage). Only the final geotags need to be accurate: PPK, more robust, no link to drop. Log raw data for PPK even on RTK flights as a fallback.
- Spec the receiver: multi-constellation and (for centimeter work) multi-frequency. More constellations for sky coverage and geometry, dual-frequency for direct ionospheric correction and fast RTK fixes. Mount the antenna high and clear of the airframe with a ground plane against multipath.
- Decide the heading source. Magnetometer for light and manual craft, mounted far from the ESCs and calibrated away from steel. Dual-antenna moving-baseline GNSS heading for survey and heavy-lift, where a compass fault is unacceptable.
- Plan for GNSS-denied if the mission ever loses the sky. Optical flow plus a downward rangefinder for indoor hold, VIO to fly through structures, lidar SLAM for the dark and underground. Match the rung to the environment and budget the payload, power, and compute.
- Configure and test the failsafes. Home-point-after-fix, RTH altitude above obstacles, geofence, and the GNSS-loss ladder. Verify each in a safe area before the aircraft carries them over a real site.
Do this in order and the aircraft knows where it is when it can, holds steady when it cannot, and does something sane when everything goes dark. Skip the RTK/PPK decision or the failsafe testing and you find out over the field, at survey grade, that your map is shifted 30 cm or your aircraft flew home to the wrong home.
Frequently asked questions
Why does a GNSS receiver need four satellites and not three? Because it solves for four unknowns at once: three position coordinates plus its own clock error. The receiver's cheap quartz clock is off by microseconds, and a microsecond is 300 m of range error, so its bias becomes a fourth unknown common to every measurement. Four satellites give four equations for the four unknowns. A useful side effect is that the receiver's clock gets corrected to nanosecond accuracy, which is why GPS doubles as a global timing source.
What is the real difference between RTK and PPK? Both use carrier-phase measurements and both reach 1 to 3 cm; the difference is when and where the math runs. RTK computes the position live in flight from base-station corrections streamed over a radio or cellular NTRIP link, so it can steer the aircraft but depends on that link holding. PPK logs raw data on the aircraft and base separately and computes the trajectory after landing, forward and backward, with no link to drop, which makes it more robust for mapping but useless for real-time guidance.
What does "fixed" versus "float" mean in RTK? It is whether the carrier-phase integer ambiguity is resolved. Fixed means the receiver has locked the whole number of wavelengths between satellite and antenna, giving full centimeter accuracy. Float means it is still estimating those as decimals, so accuracy is only decimeter-level (10 to 50 cm). Float can look like a healthy lock but is not survey grade, so log the solution status per epoch and treat any float data as suspect.
How accurate is a drone without RTK? Standalone multi-constellation GNSS gives roughly 1 to 3 m horizontal in the open, and SBAS (WAAS, EGNOS, MSAS, GAGAN) trims that to about 0.5 to 1 m for free where it is available. That is enough for waypoint missions, loose position hold, and returning near a launch point, but not for survey mapping or precision spraying, which need the centimeter accuracy of RTK or PPK. Vertical accuracy is always worse than horizontal, typically 1.5 to 3 times, because you only see satellites above you.
Can a drone fly with no GPS at all? Yes, in GPS-denied mode. It falls back to inertial dead reckoning for the first few seconds, then holds position on optical flow plus a downward rangefinder (indoors over textured ground), visual-inertial odometry (flying through structures), or lidar SLAM (in the dark and underground). These never needed satellites and are how inspection and mining drones operate inside buildings, tunnels, and mines. The tradeoff is more compute, weight, and cost as you climb from flow to VIO to lidar SLAM.
What is GPS spoofing and why is it worse than jamming? Jamming floods the band with noise and denies the fix, and the aircraft sees a clean loss of signal it can react to. Spoofing broadcasts counterfeit satellite signals stronger than the real ones and feeds the receiver a false but confident position, which can walk the aircraft off course or defeat a geofence without any obvious symptom. Because the receiver reports a healthy fix, spoofing is caught only by cross-checking GNSS against the inertial estimate, multiple constellations and frequencies, and signal power, not by trusting the fix itself.
Why does my drone slowly circle instead of holding position? That is toilet-bowling, and it almost always means a bad magnetometer heading. With a heading error the position controller pushes in a slightly wrong direction, corrects, overcorrects, and spirals outward around the target. The compass is corrupted by motor currents, ferrous metal, or nearby steel and rebar, so calibrate it away from those, mount it far from the ESCs on a mast, and on platforms that cannot tolerate a heading fault use dual-antenna GNSS heading instead of a compass.
Do I still need ground control points with RTK or PPK? Far fewer, and often none for georeferencing. RTK/PPK geotags each photo to a couple of centimeters, so the model is georeferenced from the image positions themselves rather than from surveyed targets on the ground. You keep a handful of independent checkpoints to verify accuracy, but you no longer need dense control points to solve the model, which removes the slow, access-dependent job of laying out and surveying targets across the site.
How close does the RTK base station have to be? Ideally within about 10 km of the aircraft, and accuracy and fix reliability degrade beyond 20 to 30 km. The reason is that RTK cancels shared errors (satellite clocks, orbits, and the atmosphere) by assuming the base and aircraft see nearly the same sky, and that assumption breaks down over long baselines as the atmosphere over each diverges. Network RTK (VRS) works around this by interpolating a virtual base near you from a mesh of reference stations, so you get a short effective baseline anywhere the network covers.
Related guides
- Fixed-Wing & VTOL UAVs: The Ultimate Guide
- Drone Mapping, Surveying & Photogrammetry: The Ultimate Guide
- Military Drones & Loitering Munitions: The Ultimate Guide
- Drone & UAV Hardware: The Ultimate Guide
- FPV Drones: The Ultimate Guide to Building, Flying & Digital Video
- Agricultural Drones & Precision Spraying: The Ultimate Guide