Attitude Calculation Based on Sequential Correction of Gravity Field and Geomagnetic Field

Mingyong Liu, Jiaojiao Guo, Mengfan Wang, Yun Niu, Lu WangXibei 2020

Abstract

Aiming at the problems of gyroscope error divergence and magnetometer susceptibility to soft magnetic environment in attitude calculation of unmanned systems, this paper proposes a method based on gravity field and geomagnetic field sequential correction. The method utilizes gyroscope output to construct the state equation of the attitude quaternion, which is then sequentially corrected twice using accelerometer and magnetometer data. Experimental results demonstrate that this algorithm effectively suppresses gyroscope drift and improves accuracy under magnetic interference compared to traditional methods. The static accuracy remains within $\pm 0.5^\circ$ and dynamic error is less than $2^\circ$, meeting the requirements for unmanned system applications.

Introduction

Accurate attitude estimation is fundamental for the navigation of drones and mobile robots. Most systems rely on low-cost Micro-Electro-Mechanical Systems (MEMS) sensors, including gyroscopes, accelerometers, and magnetometers. However, these sensors possess inherent flaws: gyroscopes suffer from cumulative integration drift, accelerometers are sensitive to high-frequency vibrations, and magnetometers are easily distorted by nearby metallic or electronic equipment (soft iron effects).

Existing solutions like standard Complementary Filters (CF) or basic Kalman Filters often struggle to balance these issues, particularly in dynamic environments or areas with significant magnetic disturbances.

The Sequential Extended Kalman Filter (SEKF) Method

The proposed Sequential Extended Kalman Filter (SEKF) introduces a two-stage correction process to stabilize the attitude quaternion ($q$):

  1. State Prediction: The system uses the gyroscope's angular rate to predict the next state of the attitude quaternion.
  2. Gravity Correction: The predicted quaternion is first corrected using the accelerometer's measurement of the gravity vector, which stabilizes pitch and roll.
  3. Geomagnetic Correction: The result is updated a second time using magnetometer data to stabilize the yaw (heading).
  4. Error Modeling: The algorithm explicitly models zero-bias and random walk noise to enhance robustness.

By splitting the update into two sequential steps rather than a single high-dimensional matrix operation, the SEKF simplifies observation matrices and handles the distinct noise characteristics of gravity and magnetic fields more effectively.

Experimental Evaluation

To validate the algorithm, researchers conducted real-world experiments using an XQ-4 ROS mobile robot equipped with an AH-100B attitude sensor (3-axis MEMS gyro, accelerometer, and magnetometer).

Static Performance

In a 2-hour stationary test, the SEKF demonstrated superior drift suppression. While the Complementary Filter (CF) error diverged significantly over time, the SEKF error remained bounded and stable. The SEKF achieved a mean error of $0.358^\circ$, compared to $0.645^\circ$ for the Adaptive Extended Kalman Filter (AEKF) and $1.436^\circ$ for the CF.

Figure 1: Comparison of static heading error over time, showing the divergence of the Complementary Filter (black) versus the stability of the SEKF (red).

Dynamic Performance

The robot followed a $3.2\text{m} \times 3.2\text{m}$ square path for five laps to test tracking performance. The SEKF produced a much smoother attitude curve than the AEKF, which exhibited high-frequency noise. Quantitatively, the SEKF outperformed both traditional methods in terms of mean error and standard deviation.

Figure 6: Quantitative comparison of dynamic error metrics (mean and standard deviation) for the three tested algorithms.

Conclusion

The SEKF algorithm provides a computationally efficient and numerically stable solution for embedded systems. It effectively "pulls" the gyroscope back to reality, maintaining high precision even in the presence of magnetic interference. Future work will focus on handling high-G maneuvers where centripetal acceleration might affect gravity sensing and exploring more complex compensation models for extreme "hard iron" magnetic environments.

Summary updated

BibTeX
@inproceedings{liu2020attitude,
  author = {Mingyong Liu and Jiaojiao Guo and Mengfan Wang and Yun Niu and Lu Wang},
  title = {{Attitude Calculation Based on Sequential Correction of Gravity Field and Geomagnetic Field}},
  booktitle = {Xibei},
  year = {2020},
  doi = {10.1051/jnwpu/20203810001},
}
Figure