# UAV Attitude Angle Measurement Method Based on Magnetometer-Satellite Positioning System
## 5 Measurement Error Compensation Based on Kalman Filter Algorithm  
### \"Current\" Statistical Motion Model  
To eliminate the measurement error of the magnetometer and satellite positioning system, the Kalman filter algorithm is used. The Kalman filter is an effective method of handling measurement errors of dynamic system data, which can considerably improve the accuracy of dynamic measurements. Therefore, Kalman filter technology has been widely used in dynamic positioning. In the method of combining a magnetometer and satellite positioning to measure attitude data, the state equation of the sensor is continuous, but the measurement equation is discrete. In other words, the measurement information of the sensor is obtained by sampling from the state equation of the sensor in a certain time interval. Therefore, after eliminating the measurement error, a continuous-discrete system model must be established. According to the actual characteristics of the combined attitude measurement of the magnetometer and satellite positioning system, a continuous state model of the following form is established:  
\[ \begin{bmatrix}\dot{x}(t)\\ \ddot{x}(t)\\ \dddot{x}(t)\end{bmatrix} = \begin{bmatrix}0&1&0\\ 0&0&1\\ 0&0&-N\end{bmatrix}\begin{bmatrix}x(t)\\ \dot{x}(t)\\ \dot{x}(t)\end{bmatrix} + \begin{bmatrix}0\\ 0\\ 1\end{bmatrix} \omega(t) \tag{34}\]  
where \(x\) is the state quantity, which is the spatial position of the satellite measurement system. For the magnetometer, it is the change equation of the local geomagnetic intensity in each axis. \(N\) is the rate of change of each state, and \(\overline{\omega}\) represents various interference noises for each state. Equation (34) presents greater difficulties in practical applications. First, the carrier does not move at a standard constant velocity or with constant acceleration, and there is a certain model error. In addition, the magnetic intensity model of each axis must rely on the shooting direction and attitude data of the missile, which are difficult to obtain quickly and accurately. Therefore, there are several limitations in the practical engineering application of the motion model of Equation (34). In order to solve this problem, in this study, we use the \"current\" statistical model to optimize the motion model. When a state changes at a certain rate, the change in the rate value at the next moment should be limited, and can only be within the neighborhood of the current value. The \"current\" statistical model describes the changes in the current probability density of a state with an appropriate function distribution, and its mean value is the predicted value of the \"current\" rate. The random rate change can also satisfy the first-order time correlation characteristics on the time axis. The \"current\" statistical model is essentially a non-zero mean time-dependent model. Based on the \"current\" statistical model, we can write:  
\[\tilde{x}(t)=\widetilde{\omega}(t)+\sigma(t) \tag{35}\]  
\[\dot{\omega}(t)=-N\omega(t)+\omega(t) \tag{36}\]  
where \(\widetilde{\omega}(t)\) is the \"current\" average value of the rate of change, which can be regarded as constant within the same sampling period of the sensor. Hence,  
\[\varpi_{1}(t)=\widetilde{\omega}(t)+\sigma(t)=\tilde{x}(t) \tag{37}\]  
\[\dot{\varpi}_{1}(t)=\dot{\widetilde{\omega}}(t)+\dot{\sigma}(t) \tag{38}\]  
In the same sampling period, we can consider that \(\dot{\widetilde{\omega}}(t)=0\). Then, \(\dot{\varpi}_{1}(t)=\dot{\varpi}(t)\). \(\varpi(t)=\varpi_{1}(t)-\dot{\widetilde{\omega}}(t)\) can be obtained from Equation (29), and FFF can be obtained by substituting this equation and Equation (28) into \(\widetilde{\omega}_{1}(t)=\widetilde{\omega}(t)\). \[\dot{\varpi}_{1}(t)=-N\varpi_{1}(t)+N\widetilde{\omega}(t)+\omega(t) \tag{39}\]  
which is expressed as:  
\[\dddot{x}(t)=-N\tilde{x}(t)+N\widetilde{\omega}(t)+\omega(t) \tag{40}\]  
This is the state equation, which is the \"current\" statistical model of mobile carriers. At this time, Equation (34) is expressed as:  
\[\left[