The Magnetometer Gate That Passes Review and Quietly Kills Your Heading

The magnetic disturbance gate in most step-and-heading engines compares the measured field magnitude against a reference and rejects samples that fall outside a window. When that reference is a constant in a config file and not a value derived from the device's position, the gate behaves correctly in the office where it was tuned and turns off the compass in whole regions. Nothing crashes. The fusion falls back to gyro heading, the map matcher hides the drift for a while, and the incident gets closed as a building with bad steel, again.

Why the number looks right

The typical line reads like a fixed 50 µT reference with a 10 µT acceptance window, and every reviewer nods because 50 µT is the textbook value for Earth's field. It is the textbook value for Europe and much of North America. Geomagnetic reference models such as the WMM and IGRF show total intensity running from roughly the low twenties of microtesla over southern South America to above sixty near the magnetic poles, an estimate worth checking against the model for your own fleet. Over the South Atlantic Anomaly a perfectly clean field sits permanently outside that window, so the gate classifies the Earth itself as a disturbance. The code is correct, the unit is correct, the test fixtures were recorded in the same city as the tuning, and that is exactly why it survives review.

What keeps navigation alive, and why that hides the bug

A well built pedestrian engine degrades in layers: when the magnetometer is rejected, heading propagates from the gyroscope, map matching constrains that heading to corridor axes and walkable edges, and the barometer keeps the floor estimate honest independently of the horizontal solution. Each layer is a genuine resilience feature, and together they absorb the loss of the compass so well that short indoor sessions look fine. Gyro bias integrates without bound, though, and once the user walks through an open atrium, a plaza or any space where the graph offers several plausible edges, the matcher snaps to the wrong corridor and micro-routing issues a turn that points into a wall. The support ticket says the routing is wrong in one mall, the on-call engineer inspects that mall's map, and the real cause, a gate that has been closed since installation, never shows up in the trace because the fallback path reports itself as healthy. The fallback is doing its job; the problem is that nobody is alerted when the system lives on it permanently.

A detection step you can run against today's telemetry

Group your existing fusion telemetry by a coarse geohash cell, compute for each cell the share of heading epochs in which the magnetometer was accepted, then join each cell's centroid against the total intensity from the published World Magnetic Model coefficients, which any of the open geomagnetic libraries will evaluate in a few lines. Plot acceptance ratio against the absolute difference between your configured reference and the model intensity. If the gate is the culprit you will not see scattered bad buildings; you will see a clean step where acceptance collapses as soon as that difference exceeds your window, with step detection and barometer health unchanged in the same cells. The same idea works before merge: a unit test that sweeps the gate over a grid of model intensities covering every land cell where you ship, feeding an undisturbed synthetic field, and fails if any cell gets rejected. That test takes an afternoon to write and catches the next person who edits the constant.

The decision rule is simple to state and annoying to enforce: no absolute field magnitude may live in configuration, so the reference comes from the geomagnetic model at the last position fix, and when no fix exists the gate switches to the rate of change of magnitude instead of its absolute value, accepting slightly weaker rejection of steady indoor offsets in exchange for a compass that never switches off silently for an entire country.

Should we just widen the window instead of computing a model reference?

Widening the window hides the regional failure but lets real disturbances from rebar, escalators and parked vehicles through everywhere else, so you buy coverage in one region by degrading heading quality in all the others; a position-derived reference keeps the window tight and correct at the same time.

Back to Smart Device Sensor Fusion, Step-and-Heading Pedestrian Navigation & Micro-Routing · Domains

← Back to Smart Device Sensor Fusion, Step-and-Heading Pedestrian Navigation & Micro-Routing
Engineering & Architecture Brief

The Magnetometer Gate That Passes Review and Quietly Kills Your Heading

The magnetic disturbance gate in most step-and-heading engines compares the measured field magnitude against a reference and rejects samples that fall outside a window. When that reference is a constant in a config file and not a value derived from the device's position, the gate behaves correctly in the office where it was tuned and turns off the compass in whole regions. Nothing crashes. The fusion falls back to gyro heading, the map matcher hides the drift for a while, and the incident gets closed as a building with bad steel, again.

Why the number looks right

The typical line reads like a fixed 50 µT reference with a 10 µT acceptance window, and every reviewer nods because 50 µT is the textbook value for Earth's field. It is the textbook value for Europe and much of North America. Geomagnetic reference models such as the WMM and IGRF show total intensity running from roughly the low twenties of microtesla over southern South America to above sixty near the magnetic poles, an estimate worth checking against the model for your own fleet. Over the South Atlantic Anomaly a perfectly clean field sits permanently outside that window, so the gate classifies the Earth itself as a disturbance. The code is correct, the unit is correct, the test fixtures were recorded in the same city as the tuning, and that is exactly why it survives review.

What keeps navigation alive, and why that hides the bug

A well built pedestrian engine degrades in layers: when the magnetometer is rejected, heading propagates from the gyroscope, map matching constrains that heading to corridor axes and walkable edges, and the barometer keeps the floor estimate honest independently of the horizontal solution. Each layer is a genuine resilience feature, and together they absorb the loss of the compass so well that short indoor sessions look fine. Gyro bias integrates without bound, though, and once the user walks through an open atrium, a plaza or any space where the graph offers several plausible edges, the matcher snaps to the wrong corridor and micro-routing issues a turn that points into a wall. The support ticket says the routing is wrong in one mall, the on-call engineer inspects that mall's map, and the real cause, a gate that has been closed since installation, never shows up in the trace because the fallback path reports itself as healthy. The fallback is doing its job; the problem is that nobody is alerted when the system lives on it permanently.

A detection step you can run against today's telemetry

Group your existing fusion telemetry by a coarse geohash cell, compute for each cell the share of heading epochs in which the magnetometer was accepted, then join each cell's centroid against the total intensity from the published World Magnetic Model coefficients, which any of the open geomagnetic libraries will evaluate in a few lines. Plot acceptance ratio against the absolute difference between your configured reference and the model intensity. If the gate is the culprit you will not see scattered bad buildings; you will see a clean step where acceptance collapses as soon as that difference exceeds your window, with step detection and barometer health unchanged in the same cells. The same idea works before merge: a unit test that sweeps the gate over a grid of model intensities covering every land cell where you ship, feeding an undisturbed synthetic field, and fails if any cell gets rejected. That test takes an afternoon to write and catches the next person who edits the constant.

The decision rule is simple to state and annoying to enforce: no absolute field magnitude may live in configuration, so the reference comes from the geomagnetic model at the last position fix, and when no fix exists the gate switches to the rate of change of magnitude instead of its absolute value, accepting slightly weaker rejection of steady indoor offsets in exchange for a compass that never switches off silently for an entire country.

Technical FAQ: Should we just widen the window instead of computing a model reference?

Widening the window hides the regional failure but lets real disturbances from rebar, escalators and parked vehicles through everywhere else, so you buy coverage in one region by degrading heading quality in all the others; a position-derived reference keeps the window tight and correct at the same time.

Related Architecture Specifications (GEOLOCATION): globalgeolocation.com · geodeticmapping.com · worldgeolocation.com

More Technical Articles on mobilenavi.com

Unconstrained Pedestrian Localization in GNSS-Challenged Transit Hubs →Memory-Constrained Graph Traversal and Map Matching for Wearables →The Heading Fallback That Never Times Out →The Gyro Fallback That Only Breaks Inside Elevators →