#### Abstract

Based on the output information of the three-axis geomagnetic sensor and three-axis gyroscope, a mathematical model for measuring the flight attitude information of special aircraft is established, and the flight attitude of the special aircraft is calculated in real time. To improve the accuracy of calculating the flight attitude of the special aircraft, the model of the pitch and yaw angles based on the Unscented Kalman filter (UKF) is established by using the output expression of the gyroscope and geomagnetic sensor -axis, and then the pitch angle and yaw angle obtained by filtering are brought into the geomagnetic sensor to calculate the roll angle of special aircraft in real time. The simulation results show that compared with the direct calculation of the special aircraft flight attitude angle, the combination of a geomagnetic sensor and gyroscope is more accurate after UKF processing, which verifies the effectiveness and feasibility of the attitude calculation method, and improves the accuracy of flight attitude measurement for special aircraft.

#### 1. Introduction

With the rapid development of precise flight requirements, the demand for flight path correction and navigation control technology of special aircraft is higher and higher. The position, velocity, and attitude angle information of a special aircraft need to be determined when necessary to perform trajectory correction and guidance control functions [1]. Attitude angle information includes pitch angle, yaw angle, and roll angle. Roll angle is the most significant and essential information among attitude variables. According to the special aircraft’s roll angle, the actuator’s space position can be determined, realizing the real-time correction and guidance control operation of the actuator. Therefore, the special aircraft’s flight attitude measurement technology is one of the key technologies to realize flight trajectory correction control [2–4].

At present, the commonly used attitude measurement methods for aircraft are the inertial navigation system measurement, gyroscope and satellite combined measurement, geomagnetic and satellite combined measurement, and solar orientation sensor method. Special aircraft are launched and take off employing special launching devices. In the flight process, the aircraft will be subject to high overload, accompanied by severe vibration and high-speed spin, so the traditional measurement methods are challenging to meet the measurement requirements. The geomagnetic sensor has the characteristics of high reliability, stable performance, strong anti-impact, and antioverload ability [3, 5]. At the same time, with the continuous improvement of the geomagnetic field theory, the geomagnetic sensor has become the research hotspot of attitude measurement technology. At present, the research on attitude measurement of special aircraft is more mature, such as the combination of the geomagnetic sensor and satellite measurement system and the combined measurement system of the geomagnetic sensor and gyroscope. The attitude angle measured by the integrated measurement system of the geomagnetic sensor and satellite is the trajectory inclination angle, trajectory deflection angle, and roll angle obtained by both. Still, it is necessary to correct the flight path of the aircraft. It is the shaft inclination angle, the shaft deflection angle, and the roll angle obtained by both. Zhang et al. [6] of Northwest Institute of Mechanical and Electrical Engineering research in China and other scholars have known and verified through experiment that there is a particular departure between the trajectory angle and the special aircraft axis angle, and the law of the deviation is related to the special aircraft flight environment, so it is difficult to summarize the law. Also, the geomagnetic and satellite integrated system will be affected by the magnetic measurement blind area. Dandan et al. [7] and other scholars proposed some compensation methods for the magnetic measurement blind area. Still, the compensation method did not eliminate the influence of the magnetic measurement blind area on attitude measurement. However, the gyroscope can calculate the axis deflection angle and the shaft inclination angle. Simultaneously, in the magnetic measurement blind area, the gyroscope can replace the geomagnetic sensor to measure the aircraft roll angle. Therefore, this paper puts forward a method to measure flight attitude of special aircraft by the combination of geomagnetism and gyroscope.

For the research of flight attitude measurement based on the combination of three-axis geomagnetic sensor and gyroscope, Aitian et al. [8] proposed a method of three-axis geomagnetic sensor and MEMS gyroscope for rocket flying attitude. By comparing the yaw angle and pitch angle measured by the gyroscope into the attitude determination model of the geomagnetic sensor, we drew the conclusion that the error of the yaw angle measured by the gyroscope and the pitch and roll angle measured by the geomagnetic sensor was small. Still, the principle of numerical integration was adopted in gyro angle measurement. There is a significant drift. Ya-qi et al. [9] and Xiaoming et al. [10] proposed a method to measure missile attitude based on an extended Kalman filter (EKF) gyroscope and geomagnetic sensor. He used EKF to linearize the nonlinear model to improve the accuracy and stability of the system. However, their calculation process was complicated, and the matching trajectory adopted by Ya-qi et al. was different from the real revolution. In Xiaoming et al.’s algorithm, only the first order of the Taylor expansion is carried out, which quickly leads to filter divergence. UKF is used in gyroscope and geomagnetic integrated measurement systems, most of which are used in the aerospace field to measure the attitude of spacecraft in space [11, 12]. Through the above scheme, this paper proposes an algorithm based on an Unscented Kalman filter to estimate the attitude of the special aircraft. The pitch angle and yaw angle of the special aircraft are measured by using the three-axis gyroscope. Simultaneously, the Xc axis of the three-axis geomagnetic sensor is used to measure the sensitive axis’s geomagnetic component. The functional relationship between the geomagnetic part and the pitch angle and yaw angle is obtained. UKF estimates the pitch angle and yaw angle of the special aircraft, and the pitch angle and yaw angle are obtained with high accuracy. The roll angle of the special aircraft is obtained by introducing the geomagnetic sensor. Thus, we can obtain the flight attitude angle of the aircraft with high accuracy.

#### 2. Establish a Mathematical Model

##### 2.1. Two Installation Methods of Sensors

It is assumed that the special aircraft’s gravity center is on the axis, and the Xd axis of the aircraft coordinate system is located along the axis. As shown in Figure 1, the Xc axis of the geomagnetic sensor coincides with the special aircraft axis and the other two axes are, respectively, positioned along the Yd axis and Zd axis of the aircraft coordinate system. The gyroscope is placed at the front end of the geomagnetic sensor. The three sensitive axes are parallel to the three axes of the geomagnetic sensor. The installation positions of the geomagnetic sensor and the gyro are on the axis.

In the figure, oXYZ represents the special aircraft coordinate system, oXcYcZc represents the geomagnetic sensor coordinate system and its three axes represent the three sensitive axes corresponding to the sensor, and o1XtYtZt represents the gyroscope coordinate system. Its three axes, respectively, represent the three sensitive axes of the gyroscope. In measuring the flying attitude of aircraft, the North-Up-East coordinate system is usually selected as the coordinate navigation system. N, S, and E are used to represent the north axis, celestial axis, and east axis of the coordinate system, respectively.

##### 2.2. Attitude Determination Model of a Gyroscope

A special aircraft’s attitude in flight can be expressed by its pitch angle, yaw angle, and roll angle in the North-Up-East coordinate system. The pitch angle is the angle between the special aircraft axis and the horizontal plane, the yaw angle is the angle between the special aircraft axis projected on the horizontal plane and the north axis, and the roll angle is the rotation angle of the special aircraft around its special aircraft axis (the positive and negative of the three attitude angles are subject to the right-hand rule). The special aircraft’s attitude in the North-Up-East coordinate system during flight can be obtained as the transformation mode in Figure 2.

In the above figure, firstly, the special aircraft’s coordinate system is completely coincident with the North-Up-East coordinate system. The angle *β* is rotated around the *y*-axis. The angle *α* is rotated around the *z*-axis. Finally, the angle *γ* is rotated around the *x*-axis to obtain the special aircraft’s flight attitude in the North-Up-East coordinate system.

The three axes of the gyroscope can measure three angular velocities of special aircraft in flight, represented by *ω*x, *ω*y, and *ω*z (the positive and negative of the three angular velocities obey the right-hand rule). Among them, *ω*x is the angular velocity of the *y*-axis and *z*-axis rotating around the *x*-axis, *ω*y is the angular velocity of the *x*-axis and *z*-axis rotating around the *y*-axis, and *ω*z is the angular velocity of the *x*-axis and *y*-axis rotating around the *z*-axis. The following formula can transform the angular momentum measured by the gyroscope and the attitude angular velocity of the aircraft in the North-Up-East coordinate system:

They are pitch angular velocity, yaw angular velocity, and roll angle velocity of the aircraft. Through the above formula, the mathematical expressions of three attitude angular velocities can be obtained as follows:

The pitch angle, yaw angle, and roll angle can be obtained by numerical integration of the pitch angular velocity, yaw angle velocity, and roll angular velocity, respectively. The mathematical model is expressed as

##### 2.3. Geomagnetic Attitude Determination Model

As the earth’s necessary energy field, the geomagnetic field is an essential inherent resource on the earth. The geomagnetic intensity at any point on the earth’s surface is determined by the geomagnetic elements, which provides a useful reference for geomagnetic navigation. When the flight distance of the aircraft is less than 30 km, the geomagnetic field intensity and direction of the launch point and landing point do not change much, so the geomagnetic intensity and direction of the launch point are selected to approximately replace the magnetic field intensity and direction in the flight process. According to the longitude, dimension, and height of the launch position, the magnetic inclination angle and magnetic declination angle of the geomagnetic vector in the North-Up-East coordinate system can be calculated by using the world geomagnetic field model, and then the component of the geomagnetic vector in the three axes of the North-Up-East coordinate system is obtained, which is expressed by , , and , as follows:

In the above formula, is the strength of the geomagnetic field, and are the dip angle and declination angle, respectively. The magnetic inclination angle is positive above the horizontal plane, and the magnetic declination angle is positive on the left side of the north axis. Referring to the coordinate system transformation in the previous section, the azimuth of the geomagnetic sensor coordinate system relative to the North-Up-East coordinate system during the flight of special aircraft can be expressed as follows:

The component of the geomagnetic vector on the three axes of the geomagnetic sensor can be obtained from the above formula. The mathematical model is expressed as follows:

The component of the geomagnetic vector on the sensitive axis can be measured by the three axes of the geomagnetic sensor. The ratio of to in formula (6) can be used to analyze whether the special aircraft is in the blind area of the geomagnetic sensor. The relationship between roll angle, pitch angle, and yaw angle can be obtained by formulas (7) and (8) as follows:

#### 3. Filter Design

##### 3.1. UKF Algorithm

In integrated navigation, Kalman filter (KF), extended Kalman filter (EKF), and Unscented Kalman filter (UKF) are commonly used for optimal attitude estimation of aircraft. Kalman filter can only be applied to a linear system, but in integrated navigation, the state model and observation model are often nonlinear systems, so the application range of KF is limited. For nonlinear systems, EKF is often used in past filtering algorithms. EKF approximates the nonlinear model to a linear model by the first- or second-order expansion of the Taylor series and then uses KF for linear filtering. However, EKF has apparent defects. Firstly, the higher-order term is ignored in Taylor expansion, which inevitably leads to the filter divergence. Secondly, the Jacobian matrix and Hessian matrix are involved in linearization, which has a large amount of calculation and is prone to errors. So far, there are many improved methods of EKF, such as the iterative extended Kalman filter (EIEKF) [13] and improved extended Kalman filter (NIEKF) [14], which cannot effectively solve the defects of EKF.

British scientist Julier and Uhlmann [15] proposed a UKF algorithm at the end of the last century, making up for the defects in EKF. Unscented transformation (UT) is used in UKF. Based on ensuring the mean and covariance, the linear transformation is applied to each sigma point based on ensuring the mean and covariance by selecting a set of sigma points After calculating the weight of each point, the transformed mean and covariance can be approximately obtained. Since the approximation accuracy of the UT transform can reach the second order or an even higher order of EKF, the estimation accuracy of UKF is higher than that of EKF [16].

##### 3.2. Application of UKF in Attitude Measurement

In the geomagnetic/gyroscope attitude measurement system, the high spin of special aircraft exceeds the measurement range of the gyroscope roll angle speed, so the three-axis gyroscope only needs *y*-axis and *z*-axis in practical work. In this paper, we choose the calculation formula of the gyroscope for the pitch angle and yaw angle as the state model. The *x*-axis output equation of the geomagnetic sensor is the observation equation to estimate the pitch angle and yaw angle of special aircraft. The flow chart of the Unscented Kalman filter is shown in Figure 3.

Since the UKF algorithm is suitable for discrete models and the sampling interval is small, it is necessary to discretize the state model and the observation model concerning the sampling time. In the state model, the pitch angle and yaw angle are calculated by numerical integration. Therefore, assuming that the special aircraft’s angular velocity change in the sampling time is uniform, a state model like formula (10) can be obtained.

In the above formula, is the sampling interval and is the white Gaussian noise in the state model. Let , and then the above formula can be rewritten as follows:

In the observation model, since the geomagnetic component of the Xc axis of the geomagnetic sensor has a nonlinear function relationship with pitch angle and yaw angle, the observation model can be written as follows:

where is the magnitude of the geomagnetic component measured by the Xc axis of the current geomagnetic sensor and is the white Gaussian noise in the measurement process of the geomagnetic sensor. The specific steps to calculate the estimated value in the UKF algorithm are as follows: (1)Select initial value:(2)Calculate sigma point

where is the scale factor, the expression is , is the number of sampling points, and is also the scale factor. The calculation formula is; determines the distribution state of sigma points around the estimated value of and generally takes a small value. The value of is related to the number of state variables. (3)Time renewal equation:(4)Measurement renewal equation:

where is the weight, and the formula is

#### 4. Simulation Experiment and Result Analysis

To verify the effectiveness of the algorithm, this paper takes the actual flight trajectory data of the special aircraft as the theoretical truth value and takes the flight path data into formula (6), adds the Gaussian white noise as the output value of the geomagnetic sensor *x*-axis, and takes it as the output value of the filter. The test site took place in Chengdu (E30.67°, N104.07°), the geomagnetic intensity is 50986.1 nT, the magnetic dip is -48.17° (the horizontal plane is positive upward), and the magnetic declination is 2.33° (north by the west is positive) according to the world geomagnetic model. Since the special aircraft takes off via the launching device, the aircraft’s initial attitude is the launching attitude. The initial conditions of the simulation experiment are shown in Table 1.

Figures 4 and 5, respectively, reflect the changes of pitch angle and yaw angle before and after filtering, as well as the real value. Figure 6 selects the pitch angle variation curve before and after filtering when the special aircraft’s flight time is between 30 s and 31 s. Figures 7 and 8, respectively, reflect the error changes of the pitch angle and yaw angle before and after filtering. Comparing the pitch angle and yaw angle change curves before and after filtering, the change curve after UKF is smoother. The accuracy of the pitch angle and yaw angle can be controlled between -0.2° and 0.4°. It can be seen that the systematic error of the pitch angle and yaw angle is significantly reduced after UKF is used to estimate the pitch angle and yaw angle in the flight process of the special aircraft, which effectively suppresses the error accumulation, improves the dynamic performance of the system, and proves the three-axis geomagnetic transmission The feasibility of the combination of the sensor and three-axis gyroscope is discussed.

**(a) Before filtering**

**(b) After filtering**

**(a) Before filtering**

**(b) After filtering**

Figure 9 shows the estimation error of the roll angle. The difference between the roll angle calculated by the geomagnetic sensor and gyroscope and the real rolling angle of special aircraft is used to verify the accuracy of the roll angle calculated by a combination of geomagnetic sensors and gyroscopes. Figure 9(a) shows the curve of the roll angle error calculated by the combination of a nonfiltered geomagnetic sensor and gyroscope. Figure 9(b) shows the roll angle’s error curve calculated by combining the output data of the geomagnetic sensor and gyroscope after UKF processing. Due to the influence of the magnetic measurement blind area, this paper compares the roll angle error of the projectile flying time between 30 s and 40 s as shown in Figure 10. It can be seen from the figure that the roll angle calculation error outside the magnetic measurement blind area can be controlled between 0° and 0.1° which more intuitively reflects that the roll angle accuracy of the combined calculation of the geomagnetic sensor and gyroscope after passing through UKF has been improved.

**(a) Before filtering**

**(b) After filtering**

**(a) Before filtering**

**(b) After filtering**

#### 5. Conclusion

In this paper, based on the three-axis geomagnetic sensor and three-axis gyroscope measurement information, a mathematical model for measuring special aircraft flight attitude by combining a geomagnetic sensor and gyroscope is established which can effectively solve the flight attitude of special aircraft. According to the gyroscope and geomagnetic sensor’s output expression, this paper proposes using UKF to estimate the pitch and yaw angles of a special aircraft in-flight process and get the more accurate pitch angle and yaw angle. Then, the roll angle is calculated by the geomagnetic sensor. Finally, the simulation model is established by using the real flight trajectory data and MATLAB to verify the feasibility and feasibility of the attitude calculation algorithm effectiveness. The experimental results show that after UKF processing, the pitch angle and yaw angle calculation error of the combined measurement system of the gyroscope and geomagnetic sensor can be controlled between 0.2° and 0.4°, and the roll angle calculation error outside the magnetic measurement blind area can be controlled between 0° and 0.1°, which meets the requirements of the aircraft attitude measurement. Our future work will focus on the optimization of attitude measurement algorithms and precise navigation control of aircraft.

#### Data Availability

For the detailed experimental data, please contact the corresponding author.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.