Attitude heading reference algorithm based on transformed cubature Kalman filter

Stable and accurate attitude estimation is the key to the autonomous control of unmanned aerial vehicle. The Attitude Heading Reference System using micro-electro-mechanical system inertial measurement unit and magnetic sensor as measurement sensors is an indispensable system for attitude estimation of the unmanned aerial vehicle. Aiming at the problem of low precision of the Attitude Heading Reference System caused by the nonlinear attitude model of the micro unmanned aerial vehicle, an attitude heading reference algorithm based on cubature Kalman filter is proposed. Aiming at the nonlocal sampling problem of cubature Kalman filter, the transformed cubature Kalman filter using orthogonal transformation of the sampling point is presented. Meanwhile, an adaptive estimation algorithm of motion acceleration using Kalman filter is proposed, which realizes the online estimation of motion acceleration. The car-based tests show that the algorithm proposed in this paper can accurately estimate the carrier’s motion attitude and motion acceleration without global positioning system. The accuracy of acceleration reaches 0.2 m/s2, and the accuracy of attitude reaches 1°.


Introduction
Stable and accurate attitude estimation is a prerequisite for autonomous control and navigation of unmanned aerial vehicle (UAV). 1 The navigation system using inertial sensors (strapdown inertial navigation system (SINS)) has become one of the most important systems for UAV with its high degree of autonomy. 2 Microelectro-mechanical system (MEMS) gyroscope and accelerometer have been used in navigation system due to its small size and low power consumption. 3 Attitude Heading Reference System (AHRS) using MEMS accelerometer and magnetic sensor as measurement sensors and Kalman filter for attitude estimation is an effective method for attitude estimation of UAV. 4 The motion characteristics of the micro UAV result in the nonlinearity of the aircraft attitude mathematical model, so the UAV attitude algorithm is a typical nonlinear filtering problem. At present, extended Kalman filter (EKF) is the most commonly used nonlinear filter algorithm. 5 This method propagates state variables through first-order linearization of nonlinear systems. The linearization method introduces large linearization errors, resulting in suboptimal estimation of the filter and even filter divergence. 6 Although unscented Kalman filter (UKF) can realize the state estimation of nonlinear system through unscented transform (UT), the UKF algorithm based on symmetric sampling can lead to the non-positive definite of UT transfer variance and instability of filtering when applied to highdimensional system. 7,8 The EKF and UKF require that the system must be Gaussian noise. 9 Particle filter has been proposed to solve nonlinear and non-Gaussian problems, and particle filter has become one of the most commonly used algorithms. 10 However, traditional particle filtering methods have particle impoverishment (PI) problems, and the computation increases geometrically with the increase in system dimension. 11,12 Arasaratnam and Haykin 13,14 have proposed a cubature Kalman filter (CKF) algorithm based on cubature transformation and proved that CKF has a higher filter accuracy than UKF. CKF guarantees the positive definiteness of the variance matrix. Because the variance matrix needs to be multiplied by a coefficient n during sampling, the sampling point is too far from the center point with the increase in the coefficient n. The filter algorithm is prone to nonlocal sampling problems, which in turn affects the accuracy of the filter algorithm.
On the contrary, the current AHRS is difficult to meet attitude accuracy requirements because the accelerometer cannot distinguish between gravity acceleration and motion acceleration, which results in low accuracy of attitude estimation under maneuvering state. 15 In view of the attitude estimation and correction problem under the condition of measurement interference, scholars have studied the state-based motion state detection algorithm, fuzzy filter, and adaptive filter to eliminate motion acceleration interference and improve the attitude estimation accuracy. 16,17 However, such algorithms are used to determine whether there is motion acceleration and then decide whether to use the accelerometer output for attitude correction. Because the motion acceleration is not estimated, this kind of algorithm usually has the problem of insufficient or excessive measurement correction, which leads to the low accuracy of attitude estimation.
Aiming at the nonlinearity of the attitude model and attitude estimation is affected by the motion acceleration, and the CKF is introduced into the AHRS to estimate the attitude. In order to solve the nonlocal sampling problem in traditional CKF, the transformed sampling point method is proposed. Meanwhile, based on the motion characteristics of micro UAV, an online adaptive estimation model of motion acceleration is established, which can effectively improve the attitude estimation accuracy of AHRS.

AHRS model based on transformed CKF
The structure of the attitude estimation algorithm based on transformed CKF (TCKF) is shown in Figure 1.
In Figure 1, v b ib is the vehicle body angular rate measured by MEMS gyroscopes; f b is the acceleration including motion acceleration and gravitational acceleration measured by MEMS accelerometers; f nom is the acceleration excluding motion acceleration obtained by the motion acceleration adaptive estimation algorithm; g i , u i , c i are the roll, pitch, and heading calculated using the strapdown inertial navigation algorithm; and g, u, c are the roll, pitch, and heading estimated by the TCKF.
The ''north-east-ground'' frame is set as the navigation frame. The ''front-right'' direction of the vehicle body is set as the X-Y direction of the body frame, and the down direction is set as the Z direction of the body frame. The magnetic sensor frame is set in coincidence with the body frame.

TCKF algorithm
Analysis of the CKF algorithm The nonlinear system is shown in equation (1) where x k is the state vector of the dynamic system at discrete time k; z k is the measurement vector; f(x) and h(x) are the system matrix and measurement matrix of the nonlinear system, respectively; v is the measurement noise; and w is the process noise. CKF uses cubature rules and deterministic weighted points to sample. For n-dimensional vectorsx k with mean value x and mean square error P, the sampling points fj i g and their weights fv i g are shown in equation (2) 13 where ½ ffiffiffi ffi P p i represents the ith column of the matrix ffiffiffi ffi P p . The nonlinear transformation of any sampling point can be obtained using equation (3) x Equation (3) can be expanded as follows using the Taylor expansion According to equation (4), the mean value of f(j i ) can be written as According to the symmetry, the odd moment of f x ð Þ is zero. Therefore Considering & , the factor D 2k Dx i f in equation (6) can be written as where a ij is the ith row and jth column of ffiffiffi ffi P p . According to equations (6) and (7), equation (6) can be written as The higher order information of f(x) can be shown as From equation (9), it can be seen that the mean value after CKF transmission can be accurate to the third order, and the error is only introduced in the fourth and higher order. The higher order information increases significantly with the increase in dimension, which is prone to nonlocal sampling problems.

TCKF algorithm
The orthogonal matrix B in equation (10) is used to transform the sampling points fj i g in equation (2) to obtain a new set of sampling points where s is the integer from 1 to ½2=m, and ½2=m is the integer part of 2=m.
The sampling points fj i g can be represented as a matrix After orthogonal transformation using equation (10), j can be rewritten as follows where s = 1, . . . , m, and x h, m = ( À 1) h . According to equation (12), the new sampling points fj i g and their weights fv i g are shown in equation (13) z = ffiffiffiffiffiffiffiffi ffi P x x p w i = 1=2n, i = 1, :::, 2n The new Gaussian filtering algorithm (TCKF) can be obtained by replacing the sampling points in the CKF with the proposed transformed points.
Therefore, the higher order information transmitted by TCKF is much smaller than CKF. This greatly reduces the problem of nonlocal sampling.

AHRS system model
According to the relationship between the body frame and the navigation frame, v b nb of body frame relative to the geographic frame is as shown in equation (15)  where where C b n is the attitude transformation matrix from ''north-east-ground'' frame to ''front-right-down'' frame, v n ie is the earth rotation rate, and v n en is the angular rate of the ''north-east-ground'' frame with respect to the earth frame. C b n , v n ie , v n en can be solved by the attitude, velocity, and position of the UAV and can be regarded as known quantities.
Therefore, equation (15) can be simply written as where e r is a first-order Markov process driven by s r , and s r is the Gaussian noise where T r is the relevant time. Extending the noise model to the equation of state, equations (15) and (16) can be written as a nonlinear equation as shown in equation (18)  where A = 1 cos u cos u À sin g sin u cos g sin u 0 cos g cos u À sin g cos u 0 sin g cos g The state variable vector is chosen as follows x = g u c e rx e ry e rz ½ T According to equation (18), the state equations of the system can be written as where f( Á ) is the nonlinear system state equation. Without drone acceleration, the acceleration measured by the accelerometers can be simply written as cos u sin g cos u cos g where g n = ½0, 0, g, and g is the gravitational acceleration.
According to equation (20), the measurement equation can be set as where y = ½ f bx f by f bz , and h(Á) is the nonlinear measurement equation.
The nonlinear system composed of equations (19) and (21) can be solved using the TCKF algorithm proposed.

Adaptive estimation algorithm of motion acceleration
Equation (20) is obtained based on the situation that the UAV has no motion acceleration. However, there will be frequent acceleration and deceleration maneuvers during the flight of the UAV, which will introduce the motion acceleration component into the measurement information of the accelerometer. Because the accelerometer cannot distinguish gravity acceleration and motion acceleration, it is impossible to perform attitude estimation using equation (20) directly. This paper designs a motion acceleration adaptive estimation algorithm.
The motion of the micro UAV have low-frequency and slow-changing characteristic. Thus, the first-order Markov model is used to model the motion acceleration as follows where e a, k is the first-order Markov white noise and a is the attenuation coefficient. The conversion relationship between the body frame and the geographic frame is shown as where v a is acceleration measurement noise and a n is the motion acceleration in geographic frame. Considering that micro UAVs have a slow speed generally, (2v n ie + v n en )3V n can be ignored. So equation (23) can be written as where a b = C b n a n and g b = C b n g n are the motion acceleration and gravity acceleration in the body frame, respectively.
From equation (23), taking the output of the accelerometer as the measurement information, equation (24) can be written as follows Taking equation (22) as the state equation and equation (25) as the measurement equation, the Kalman filter is used to estimate the motion acceleration.
Using the estimated motion acceleration a b k , f b nom used in equation (20) can be rewritten as At the same time, equation (22) has shown that the value of the attenuation coefficient is 0 \ a41, which reflects the change of the motion acceleration and also determines the degree of confidence in the estimated motion acceleration at the previous moment. Therefore, adaptive adjustment of a using equation (26) based on the UAV's motion can improve the estimation precision of the motion acceleration effectively a = 0:53 a b k À 3O 50O À 3O where

Car-based TCKF test
In order to verify the attitude estimation performance of the proposed algorithm in practical applications, the MEMS AHRS shown in Figure 2 is designed. The gyroscope is composed of three ADXRS646 single-axis gyros with an precision of 12°/h, and the accelerometer uses a three-axis ADXL355 with a precision of 5 3 10 23 G. The output frequency of gyroscopes and accelerometers is 1000 Hz. Considering the low dynamic characteristics of the UAV, the sampling frequency of the gyroscope and acceleration is set as 100 Hz to reduce the impact of MEMS sensor noise. The system processor adopts STM32F4 series ARM with floating point arithmetic capability, and its frequency is 168 MHz. Considering the computing power of the processor, the frequency of TCKF is set as 10 Hz, and the Kalman filter frequency estimated by motion acceleration is set as 20 Hz. Because the frequency of the motion acceleration estimation algorithm in section ''Adaptive AHRS-based TCKF algorithm'' is faster than the frequency of the TCKF, the results of motion acceleration estimation algorithm can be smoothed and used as the input of the TCKF.
A car experiment has been conducted in Nanjing University of Science and Technology. In the experiment, commercial SBG Ellipse Inertial/GPS (global positioning system) integrated navigation system using EKF was used as a reference, and the measurement precision of the roll and pitch angle with GPS is 0.2°. The path is shown in Figure 3.

Results analysis
The comparison of the roll and pitch angle of the TCKF algorithm, CKF algorithm, and SBG, presented in this paper, is shown in Figures 4 and 5.  It can be seen from the figure that our proposed attitude algorithm using TCKF without GPS is consistent with the SBG results with GPS basically.
As shown in Figures 6 and 7, from 0 to 40 s, without motion acceleration, the attitude error between TCKF/ CKF and SBG is less than 0.2°. The proposed motion acceleration adaptive estimation algorithm can estimate the motion acceleration.
As shown in Figures 8 and 9, from 200 to 300 s, in the case of acceleration and deceleration, the SBG can accurately reflect the change in attitude angle with GPS assistance.
Meanwhile, it can be seen from Figures 6 and 8 that the accuracy of the TCKF algorithm is significantly better than that of the CKF algorithm. The attitude error between our proposed algorithm and SBG is shown in Table 1.
From Table 1, the attitude error of our proposed algorithm is less than 1°. The algorithm has reached a high precision without GPS with SBG results as a reference. The mean error and mean square error of the TCKF algorithm are improved by 70% compared to CKF.      Figures 9 and 10, the proposed motion acceleration adaptive estimation algorithm can estimate the trend of the carrier's motion acceleration, and the error between estimated acceleration and actual acceleration is less than 0.2 m/s 2 . The attitude angle error caused by the acceleration error is less than 1.0°, which is consistent with the error reflected in Figure 7. It can be seen from Figure 10 that the acceleration estimation algorithm has good real-time performance.

Conclusion
The core of attitude estimation for micro UAV is AHRS which uses micro-electronic mechanical system inertial measurement unit (MEMS-IMU) as measuring sensors. The AHRS nonlinear estimation model and an adaptive motion acceleration estimation algorithm are established. Aiming at the nonlinear filtering and the nonlocal sampling problem of CKF problem, the TCKF algorithm is proposed based on the orthogonal sampling transformation. The car-based test has proved that the presented algorithm has a precision of 1°without GPS. Meanwhile, the accuracy of the TCKF algorithm is improved by 70% compared to CKF. The algorithm proposed in this paper has important practical value for the research and application of AHRS.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.