Nagesh Yadav Publications
Sensors · MDPI · 2014 · Open Access · Journal Article

Accurate Orientation Estimation Using AHRS under Conditions of Magnetic Distortion

Nagesh Yadav · Chris Bleakley Open Access
UCD Complex and Adaptive Systems Laboratory · School of Computer Science and Informatics · University College Dublin, Dublin 4
Published 24 October 2014
Journal Sensors · Vol. 14 · No. 11
PubMed PMID 25347584 · PMC4279468

A novel algorithm is proposed for accurate 3D orientation estimation using a low-cost AHRS (accelerometer, gyroscope and magnetometer) in the presence of magnetic field distortions caused by nearby ferrous objects. The method detects disturbances using both magnetic dip angle and field strength, then uses an adaptive particle filter to reduce reliance on the corrupted magnetometer and fall back on gyroscope dead reckoning. The algorithm achieves under 2 degrees static peak-to-peak error and under 5 degrees dynamic peak-to-peak error, significantly outperforming both gradient descent and Kalman filter methods.

The Magnetometer Problem in Real Buildings

An AHRS estimates 3D orientation by combining gyroscope angular velocity integration with reference vector measurements: gravity from the accelerometer and Earth's magnetic field from the magnetometer. Gravity is reliable as long as accelerations are small. The magnetic field is the problem.

In an ideal outdoor environment, the Earth's horizontal magnetic field points toward magnetic North with predictable dip angle and strength. In an Irish home or hospital ward, the field is distorted by steel door frames, reinforced concrete, radiators, speakers, kitchen appliances and electrical equipment. Any of these can deflect the apparent North direction by tens of degrees within a matter of centimetres.

For a wearable rehabilitation system, this is a serious issue. A patient performing sit-to-stand exercises in their living room is likely to be within arm's reach of exactly these kinds of materials. If the magnetometer corrupts the heading estimate, the entire kinematic chain built on top of it is wrong.

The key experimental finding: when a ferrous object moves toward a static magnetometer, the heading estimate is affected first (around t=12 seconds), the magnetic dip angle is affected second (around t=15 seconds), and the scalar field strength registers a clear anomaly last (around t=17 seconds). An algorithm that only watches field strength will be 5 seconds late. Combined detection using dip angle cuts this gap significantly.

Catching Disturbance Earlier with Dip Angle

The magnetic dip angle is the angle between Earth's field lines and the horizontal surface. At any location it has a known expected value that can be looked up from the World Magnetic Model. Deviations from this expected value indicate a distorting object nearby, even before the scalar field strength shows a significant change.

Check 1

Primary check: compare current field strength to calibration threshold. Threshold set over a 5-second rest in a magnetically clean environment. Immediate detection when a strongly magnetic object is present.

Check 2

If accelerometer is in quasi-static range, derive dip angle from the dot product of gravity vector and magnetic field vector. Compare to expected dip angle from World Magnetic Model.

Disturbance flag

If deviation in dip angle exceeds the noise floor calibrated at rest, flag as disturbance. This catches slow-moving or distant ferrous objects that have negligible effect on scalar strength but already measurably affect direction.

Dip angle: theta_dip = pi/2 - arccos( g_vec · m_vec ) where g_vec = gravity direction from accelerometer (normalised) m_vec = magnetic field direction from magnetometer (normalised) Disturbance detection: sigma_dip = deviation of theta_dip from expected (from WMM) if sigma_dip > sigma_calib → DISTURBANCE DETECTED Weighting under disturbance: k = 1 / floor( sigma_delta_theta / sigma_dip ) q_meas = k * q_mag + (1 - k) * q_gyro_dead_reckoning

Particle Filter with Adaptive Cost Function

A particle filter is used rather than an EKF for two reasons. First, the orientation state space on SO(3) is nonlinear and the particle filter makes no linearisation approximation. Second, with no assumption on noise distribution, the particle filter handles the non-Gaussian disturbance errors more robustly.

State is represented as a unit quaternion to avoid gimbal lock. Gyroscope readings propagate particles forward. The key adaptation is in the cost function and the variance parameter governing particle spread during resampling.

Under no disturbance, quasi-static conditions: cost function uses both accelerometer inclination and magnetometer heading. Under no disturbance, fast motion: cost function uses magnetometer heading and WMM dip angle (ignoring corrupted accelerometer). Under detected disturbance: magnetometer heading is de-weighted via k, and gyroscope dead reckoning carries most of the heading estimate. Variance parameter also increases, spreading particles to capture heading uncertainty until the disturbance passes.

Static Objects, Moving Objects, High Acceleration

Experiments used a nine-axis Shimmer sensor (accelerometer, gyroscope, magnetometer) sampled at 200 Hz with a 50 Hz low-pass filter. Tests conducted in a standard indoor office environment at UCD, with ferrous objects including a metallic can, a portable hard drive and a PC speaker.

Distortion Object Magnetic Flux (Gauss) RMS Error - Proposed RMS Error - Uncompensated
None 0.49 0.4 deg 0.5 deg
Metallic can 0.55 1.5 deg 5.4 deg
Portable HDD 1.15 2.8 deg 7.2 deg
Speaker (strong) 5.4 3.0 deg 10.5 deg
Estimation Method Peak-to-Peak Error RMS Error
Proposed (this paper) 5 deg 3.4 deg
Gradient descent (Madgwick) 10 deg 6 deg
Kalman filter (Roetenberg) 12 deg 9.26 deg
Uncompensated AHRS 23 deg 15.4 deg

Under high acceleration (tested at 3 g, typical of sit-to-stand movements), the proposed approach shows 2 degree error against 5 degrees for the Veltink/Luinge accelerometer autocalibration approach. At the other extreme, in the static case with a moving ferrous object 1 cm away, the uncompensated approach drifts to 14 degrees while dead reckoning drifts at 10 degrees per minute; the proposed algorithm holds under 5 degrees throughout.

Closing the Remaining Gap in Indoor Motion Capture

The 2010 and 2011 papers established the system architecture and showed that dead reckoning accuracy could be meaningfully improved. The 2012 paper showed how to handle partial occlusion in the ranging subsystem. This 2014 paper addresses the last major unsolved problem: what to do when the orientation reference itself is corrupted.

Together these four papers trace a coherent engineering effort to build a complete, clinically deployable wearable motion capture system. Each one addresses a different failure mode that would make the system unreliable in a real domestic environment. Magnetic distortion was in some ways the hardest because it is invisible, spatially variable, and present everywhere indoors to some degree.

Why dip angle matters and what comes next

The insight that dip angle is a faster indicator than scalar field strength is the central technical contribution of this paper. It shifts detection from measuring how much the field has changed in magnitude to measuring how much it has changed in direction. Direction changes propagate outward from a distorting object more quickly than magnitude changes, which is why dip angle gives earlier warning.

The authors note that future work could use the pair of magnetic strength and dip angle measurements to construct a spatial map of distortion regions, which would enable correction based on position rather than just online detection. This extension would close the loop between the positioning subsystem (from the earlier papers) and the orientation subsystem.

Citation
Yadav, N. and Bleakley, C. (2014). Accurate Orientation Estimation Using AHRS under Conditions of Magnetic Distortion. Sensors, 14(11), 20008-20024.
DOI: 10.3390/s141120008  ·  PMID: 25347584  ·  PMC: PMC4279468
UCD Research Repository: hdl.handle.net/10197/7081