Abstract
This paper addresses the quadcopter unmanned aerial vehicle (UAV) attitude measurement problem by presenting a Quaternion-based Unscented Kalman Filter (QUKF) data fusion method. The system utilizes an STM32F103 central controller, an MPU6050 (accelerometer and gyroscope), and an HMC5883L magnetometer. By combining coordinate rotation relationships in quaternions with the Unscented Kalman Filter (UKF), the system tracks the genuine attitude of the vehicle. The effectiveness of the algorithm is validated by comparing it against the Extended Kalman Filter (EKF), Complementary Filter (CF), and high-precision ground truth values. Experimental results demonstrate that using quaternions as state variables with UKF provides precise attitude information for subsequent UAV control.
Introduction
Precise attitude estimation—determining orientation in terms of roll, pitch, and yaw—is fundamental for the stable flight of quadrotor UAVs. While high-end industrial sensors offer accuracy, their cost and weight are often prohibitive for smaller platforms. Consequently, most research and consumer drones rely on low-cost Micro-Electro-Mechanical Systems (MEMS) sensors. However, these sensors suffer from inherent flaws: gyroscopes exhibit long-term drift, accelerometers are sensitive to high-frequency noise and vibration, and magnetometers are vulnerable to local magnetic interference.
To bridge the gap between low-cost hardware and professional-grade performance, this study proposes a robust data fusion method using a Quaternion-based Unscented Kalman Filter (QUKF). This approach effectively mitigates the limitations of individual sensors by fusing their signals into a stable, real-time estimate.
Methodology
The QUKF approach integrates data from a 9-axis sensor suite to provide a stable orientation estimate. The methodology is centered on three key pillars:
System Architecture and Data Fusion
The hardware platform consists of an STM32F103 microcontroller interfacing with an MPU6050 and an HMC5883L. As shown in the system block diagram, raw sensor data undergoes a rigorous calibration process to account for deterministic errors like zero bias and scale factors before entering the fusion stage. This calibration is critical for improving the "cleanliness" of the input data.
Quaternion-Based Representation
To represent the UAV's orientation, the system uses quaternions rather than Euler angles. This four-dimensional representation avoids the "gimbal lock" singularity, ensuring continuous tracking across all flight regimes. The filter estimates the rotation between the airframe coordinate system and the navigational coordinate system, providing a smooth mathematical framework for 3D orientation.
Unscented Kalman Filter (UKF)
The UKF is chosen over the traditional Extended Kalman Filter (EKF) for its superior handling of nonlinear systems. Instead of linearizing equations via Taylor series approximations—which can introduce significant errors in complex rotations—the UKF uses the Unscented Transform. It passes a set of carefully chosen "Sigma points" through the actual nonlinear equations to more accurately capture the system's mean and covariance.
Experimental Results and Discussion
The algorithm was tested using real-world flight data, with a high-precision MTI-300 sensor providing the "ground truth" reference. The QUKF was compared against EKF and Complementary Filter (CF) implementations using Root Mean Square Error (RMSE) and Mean Absolute Error (MAE) metrics.
- Accuracy: The QUKF achieved an average RMSE of approximately 0.53° for roll, 0.69° for pitch, and 0.58° for yaw during motion tests.
- Comparative Performance: The QUKF outperformed the EKF by approximately 0.2° and showed a substantial 0.5° improvement over the CF.
- Dynamic Stability: Qualitative analysis showed that the QUKF tracks reference values much more closely during rapid maneuvers. While the CF exhibited significant jitter and the EKF showed higher approximation errors, the QUKF maintained a smooth and accurate trajectory.
Conclusion
The Quaternion-based Unscented Kalman Filter provides a high-precision, robust solution for UAV attitude estimation using low-cost MEMS sensors. By leveraging quaternions to avoid singularities and the Unscented Transform to handle nonlinear dynamics, the system achieves professional-grade orientation tracking. While the UKF is more computationally intensive than simpler filters, the STM32 platform handled the load effectively. Future work will explore the performance limits in high-interference magnetic environments and the integration of this precise attitude information into advanced autonomous flight control loops.
Summary updated