# UAV Attitude Angle Measurement Method Based on Magnetometer-Satellite Positioning System
## 1 Introduction  
With the advancement of technology, the performance and reliability of microelectromechanical systems (MEMS) have been considerably improved, and the cost of manufacturing and application has also been considerably reduced [1, 2]. Therefore, various types of MEMS sensors with small sizes, low power consumption, and low cost are widely used in domains such as navigation [1], aviation [3], weapon equipment [4], and robotics [5]. Although MEMS devices have many advantages, they also have problems such as large accumulated errors and serious zero drift caused by long-term operations. Additionally, they are susceptible to carrier motion acceleration and magnetic field environment interference, resulting in low accuracy of measurement results, poor stability and poor reliability [6, 7]. When UAVs make large maneuvers, the gyroscope and accelerometer also face problems such as insufficient anti-overload ability [8, 9]. Therefore, for UAV attitude measurement, several researchers have investigated the use of a magnetometer and other sensors to measure the fusion to improve the reliability and measurement accuracy of the measurement program. One of the most commonly used methods is the combination of a magnetometer and satellite system to measure the attitude angle of a UAV.  
A magnetometer is a device that uses the Earth's magnetic field to attain relatively stable magnetic field strength and direction characteristics in a large range of values to measure the motion parameters of moving objects. The measurement signal of the satellite system can provide geographic coordinates to determine the reference information of the local magnetic field strength and eliminate magnetometer drift, interference errors, and other issues. Therefore, the combination of a magnetometer and satellite system to measure the attitude angle can satisfy large-scale, long-term, and high-precision measurement requirements in engineering applications [10; 11]. However, in practical applications, the method of measuring the attitude angle by the fusion of magnetometer and satellite positioning information leads to problems such as the influence of three-axis sensitivity deviation, zero-point deviation, environmental influence, measurement error, and other factors, resulting in a certain error in measurement accuracy. Demanding requirements such as high accuracy and high reliability, make it difficult to meet engineering requirements [12; 13]. To improve the measurement accuracy [14], a complementary filtering method [15], Kalman filter [16], and gradient descent method [17] have been extensively studied, and a series of good results have been achieved in practical applications. However, these research results may lead to problems such as reduced attitude angle measurement accuracy and slow error convergence under conditions such as large maneuvering flight and strong magnetic interference, which can cause carrier oscillation and spin, thereby affecting flight safety. In view of the above problems, the Kalman filter method can eliminate the measurement noise of different sensors and can estimate and compensate for the error of the sensor. It is one of the most commonly used filtering methods in engineering applications.  
In this study, we aim to address the problems of external interference and measurement errors in magnetometer-satellite systems in engineering applications. To achieve this, we established an error model of the combined measurement program and analyzed the impact of measurement accuracy. Based on the calibration of the magnetometer through the least squares fitting algorithm, an interference compensation algorithm and a continuous-discrete Kalman filter algorithm based on the current model were proposed. Finally, UAV attitude angle measurements were conducted and accurate results were achieved.