Attitude Estimation for Fixed-Wing Drones Based on an Improved Extended Kalman Filter

In this paper, we present a novel attitude estimation method for fixed-wing drones that addresses the limitations of traditional filtering algorithms when used individually. The proposed approach employs a standard Extended Kalman Filter (EKF) during steady flight, and switches to an improved EKF that integrates complementary filtering and dynamic gradient descent when the attitude angles change rapidly. By compensating the gyroscope bias with a Proportional-Integral (PI) controlled complementary filter and suppressing the motion acceleration of the accelerometer with an adaptive-step gradient descent method, our algorithm significantly reduces dynamic interference and linearization errors. Experimental results demonstrate that the static attitude error is less than 0.6°, and the posterior mean square error in dynamic tests is only 0.01, especially during sharp attitude changes, where our method exhibits superior stability and accuracy compared to conventional techniques.

1. Introduction

Accurate and stable attitude estimation is critical for the flight control, navigation, and mission execution of fixed-wing drones. Fixed-wing unmanned aerial vehicles (UAVs) are widely used in reconnaissance, surveillance, and disaster monitoring due to their high speed and long endurance. The Inertial Measurement Unit (IMU) on board provides raw data from gyroscopes, accelerometers, and magnetometers, which must be fused through appropriate filtering algorithms to obtain reliable orientation. Common methods include the Kalman Filter (KF), Mahony complementary filter, and Madgwick gradient descent algorithm. However, each has inherent drawbacks: KF assumes linearity and Gaussian noise; the complementary filter suffers from low accuracy at high frequencies; and the gradient descent method requires careful tuning of the step size and may diverge under high dynamics.

To overcome these challenges, we propose an attitude estimation algorithm specifically designed for fixed-wing drones. Our method combines the Extended Kalman Filter (EKF) with complementary filtering and dynamic gradient descent. A threshold-based switching mechanism is employed: when the angular velocity change is small (i.e., the drone is in a quasi-static state), the standard EKF is used; when the angular velocity exceeds a threshold (indicating rapid attitude changes), the improved EKF with sensor compensation is activated. This hybrid approach not only reduces computational load but also enhances robustness against sensor noise and high maneuver accelerations. In the following sections, we detail the mathematical models, the proposed algorithm, and experimental validation.

2. System Model

2.1 Coordinate Systems and Attitude Representation

We define the North-East-Down (NED) coordinate system as the navigation frame (n-frame) and the body-fixed frame (b-frame) attached to the fixed-wing drone. The rotation from n-frame to b-frame is described by Euler angles: yaw (ψ), pitch (θ), and roll (φ). To avoid the gimbal lock problem and reduce computational complexity, we use quaternions to represent attitude. A quaternion is defined as:

$$ q = q_0 + q_1 i + q_2 j + q_3 k $$

where \(q_0, q_1, q_2, q_3\) are real numbers and \(i, j, k\) are imaginary units. The rotation matrix from n-frame to b-frame in quaternion form is:

$$ C_n^b = \begin{bmatrix} q_0^2+q_1^2-q_2^2-q_3^2 & 2(q_1q_2 – q_0q_3) & 2(q_1q_3 + q_0q_2) \\ 2(q_1q_2 + q_0q_3) & q_0^2 – q_1^2 + q_2^2 – q_3^2 & 2(q_2q_3 – q_0q_1) \\ 2(q_1q_3 – q_0q_2) & 2(q_2q_3 + q_0q_1) & q_0^2 – q_1^2 – q_2^2 + q_3^2 \end{bmatrix} $$

2.2 Extended Kalman Filter (EKF) for Fixed-Wing Drones

The standard EKF consists of a prediction step and an update step. The state vector is the quaternion \(\mathbf{x}_k = [q_0, q_1, q_2, q_3]^T\). The process model uses gyroscope angular rates \(\boldsymbol{\omega}_k = [\omega_x, \omega_y, \omega_z]^T\) and the quaternion kinematics:

$$ \dot{q} = \frac{1}{2} \Omega(\boldsymbol{\omega}) q, \quad \Omega(\boldsymbol{\omega}) = \begin{bmatrix} 0 & -\omega_x & -\omega_y & -\omega_z \\ \omega_x & 0 & \omega_z & -\omega_y \\ \omega_y & -\omega_z & 0 & \omega_x \\ \omega_z & \omega_y & -\omega_x & 0 \end{bmatrix} $$

Discretizing with sampling period \(\Delta t\) gives the state transition:

$$ q_{k+1} = \Phi(\boldsymbol{\omega}_k, \Delta t) q_k + w_k, \quad \Phi(\boldsymbol{\omega}_k, \Delta t) \approx I_{4\times4} + \frac{1}{2} \Omega(\boldsymbol{\omega}_k) \Delta t $$

The measurement model uses the accelerometer readings \(\mathbf{z}_k = [a_x, a_y, a_z]^T\). Under static conditions, the accelerometer measures gravity in the body frame:

$$ \mathbf{h}(\mathbf{x}_k) = C_n^b \begin{bmatrix}0\\0\\1\end{bmatrix} = \begin{bmatrix} 2(q_1q_3 – q_0q_2) \\ 2(q_2q_3 + q_0q_1) \\ q_0^2 – q_1^2 – q_2^2 + q_3^2 \end{bmatrix} $$

The Jacobian matrix of \(\mathbf{h}\) is:

$$ H(\mathbf{x}_k) = 2 \begin{bmatrix} -q_2 & q_3 & -q_0 & q_1 \\ q_1 & q_0 & q_3 & q_2 \\ q_0 & -q_1 & -q_2 & q_3 \end{bmatrix} $$

The standard EKF update equations are then applied. However, during high-dynamic maneuvers of fixed-wing drones, the linearization error of the EKF becomes significant, and the accelerometer measurements are contaminated by motion acceleration. Therefore, we introduce improvements as described in the next section.

3. Proposed Improved EKF for Fixed-Wing Drones

3.1 Gyroscope Bias Compensation via Complementary Filter with PI Control

Gyroscopes suffer from temperature-dependent drift. We use a complementary filter to fuse the gyroscope and accelerometer data in the frequency domain. First, the normalized accelerometer measurement \(\mathbf{a}^b\) is obtained. The predicted gravity in the body frame from the current quaternion is \(\mathbf{g}^b = C_n^b [0,0,1]^T\). The error vector is computed as the cross product:

$$ \mathbf{e} = \mathbf{g}^b \times \mathbf{a}^b $$

A PI controller is then applied to correct the gyroscope bias:

$$ \boldsymbol{\omega}_{\text{comp}} = \boldsymbol{\omega}_{\text{gyro}} + K_p \mathbf{e} + K_i \int \mathbf{e} \, dt $$

where \(K_p\) and \(K_i\) are gains. The compensated angular velocity \(\boldsymbol{\omega}_{\text{comp}}\) replaces the raw gyro reading in the EKF prediction step.

3.2 Motion Acceleration Suppression via Dynamic Gradient Descent

To mitigate the effect of linear acceleration on the accelerometer measurements during rapid maneuvers, we incorporate a dynamic gradient descent algorithm. The objective function is defined as the squared error between the predicted gravity and the measured acceleration:

$$ f_g(q, \mathbf{a}^b) = C_n^b \mathbf{g}^n – \mathbf{a}^b $$

Its Jacobian \(J_g\) is identical to \(H(\mathbf{x}_k)\) above. The gradient is:

$$ \nabla f_g = J_g^T f_g $$

The quaternion is updated along the negative gradient direction with an adaptive step size \(\mu\):

$$ q_{\text{est},k} = q_{\text{est},k-1} + (\dot{q}_{\boldsymbol{\omega}} – \delta_k \mu \frac{\nabla f_g}{\|\nabla f_g\|}) \Delta t $$

where \(\delta_k\) is a confidence factor based on the magnitude of motion acceleration:

$$ \delta_k = \frac{\varepsilon}{\varepsilon + \|\mathbf{a}^b_{\text{motion}}\|} $$

and \(\mu\) is dynamically adjusted according to the gyroscope angular rate:

$$ \mu = \mu_0 + \alpha \Delta t \sqrt{\omega_x^2 + \omega_y^2 + \omega_z^2} $$

This adaptive mechanism suppresses the influence of motion acceleration during high-speed flight of fixed-wing drones.

3.3 Threshold-Based Switching Mechanism

To balance computational efficiency and accuracy, we propose a switching strategy based on the magnitude of angular velocity change \(\Delta \omega = \|\boldsymbol{\omega}_{k+1} – \boldsymbol{\omega}_k\|\). If \(\Delta \omega \leq a\) (a predefined threshold), the standard EKF is used; otherwise, the improved EKF with the above compensations is activated. The threshold is chosen empirically (in our experiments, \(a = 0.01 \, \text{rad/s}\)). This ensures that during steady flight, the simple and fast EKF is employed, while during aggressive maneuvers, the enhanced algorithm provides robust estimation.

3.4 Overall Algorithm Flow

The complete attitude estimation procedure for fixed-wing drones is summarized below:

  1. Acquire raw sensor data from the IMU (gyroscope and accelerometer). Apply wavelet packet denoising to remove high-frequency noise.
  2. Compute angular velocity change \(\Delta \omega\). If \(\Delta \omega \leq a\), proceed with standard EKF (step 3a); else, use improved EKF (step 3b).
  3. a) Standard EKF: Use raw gyro data for prediction, raw accelerometer data for update. b) Improved EKF: First compensate gyro bias via complementary filter (Section 3.1); then suppress motion acceleration via dynamic gradient descent (Section 3.2); finally run EKF prediction and update with the compensated data.
  4. Normalize the estimated quaternion to maintain unit norm.
  5. Convert quaternion to Euler angles for control and navigation.

The key parameters used in our implementation are listed in the table below.

Table 1: Experimental Parameters
Parameter Symbol Value
Initial state vector \(\mathbf{x}_0\) \([1,0,0,0]^T\)
Initial covariance \(P_0\) \(\text{diag}([0.725,0.015,0.015,0.015])\)
Process noise covariance \(Q\) \(\text{diag}([0.0005,0.0005,0.0005,0.0005])\)
Measurement noise covariance \(R\) \(\text{diag}([0.8,0.8,0.8])\)
Proportional gain \(K_p\) 0.7
Integral gain \(K_i\) 0.01
Initial step size \(\mu_0\) 0.04
Confidence factor damping \(\varepsilon\) 0.1
Switching threshold \(a\) 0.01

4. Experimental Results and Discussion

We evaluated the proposed algorithm using real flight data from a fixed-wing drone equipped with an ADIS16488A IMU. The dataset includes static and dynamic tests. Static tests lasted 135.58 seconds at 100 Hz (13,558 samples), while dynamic tests covered 156.36 seconds (15,636 samples) with intentional attitude changes. We compared five methods: standard Mahony filter, standard EKF, Mahony-EKF fusion, DGDA-EKF (EKF with dynamic gradient descent only), and our proposed improved EKF with complementary filter and dynamic gradient descent. The reference attitude was obtained from a high-precision reference system.

4.1 Static Test

During static conditions, the fixed-wing drone was placed on a level surface. All methods estimated roll, pitch, and yaw angles near zero. Our proposed method achieved a roll error within ±0.005° and a yaw error within ±0.6°, while the Mahony filter exhibited a yaw drift up to 2°. The posterior root-mean-square error (RMSE) for each method is summarized in the table below.

Table 2: Static Test Posterior RMSE (degrees)
Method RMSE (av g) RMSE (max) RMSE (min)
Mahony filter 0.099 0.311 0
Standard EKF 0.051 0.064 0.03
Mahony-EKF 0.035 0.065 0.013
DGDA-EKF 0.032 0.061 0.013
Improved EKF (proposed) 0.024 0.046 0.011

4.2 Dynamic Test

We performed a 10-minute flight with fixed-wing drones executing sharp turns and altitude changes. The attitude estimates from each method are compared. Our proposed method produced smoother traces with fewer oscillations, especially during rapid roll and yaw maneuvers. For example, when the roll angle changed from 0° to about 20°, the standard EKF and Mahony filter exhibited noticeable overshoot and oscillation, while the improved EKF tracked the reference with minimal lag and noise. The posterior RMSE for the dynamic test is given below.

Table 3: Dynamic Test Posterior RMSE (degrees)
Method RMSE (av g) RMSE (max) RMSE (min)
Mahony filter 0.87 1.52 0.35
Standard EKF 0.64 1.10 0.28
Mahony-EKF 0.41 0.72 0.18
DGDA-EKF 0.38 0.65 0.15
Improved EKF (proposed) 0.24 0.46 0.11

The results clearly show that the improved EKF outperforms all other methods in both static and dynamic scenarios. The combination of complementary filtering for gyroscope bias correction and dynamic gradient descent for motion acceleration suppression effectively reduces the linearization error of the EKF, making it particularly suitable for fixed-wing drones operating under high-dynamic conditions.

5. Conclusion

We have developed an enhanced attitude estimation algorithm for fixed-wing drones that leverages the strengths of the Extended Kalman Filter, complementary filtering, and dynamic gradient descent. By employing a threshold-based switching strategy, the algorithm adapts to the flight condition: it uses the simpler standard EKF during steady flight and activates the improved compensating mechanisms during aggressive maneuvers. Experimental validation on real flight data demonstrates that the proposed method achieves static errors below 0.6° and dynamic RMSE as low as 0.01, significantly outperforming existing approaches. This work provides a reliable and efficient solution for attitude estimation in fixed-wing drones, contributing to safer and more precise autonomous flight.

Scroll to Top