The Attitude Signal Processing of Four Rotor Aircraft based on a Kalman Filter

This paper puts forward use of a Kalman filter algorithm to improve the accuracy and the stability of a four rotor aircraft control. The algorithm principle used covariance to estimate the system’s optimal output. The flight and control theory of a four rotor aircraft was first analyzed; furthermore, it was found that the attitude angle had the biggest influence on its control. Then the Kalman filter model was established for processing attitude angle information from gyro and accelerometer sensors. Finally, the algorithm was compared with a complementary filter. The flight conditions were simulated in different flight environments; it is shown that the Kalman filter algorithm can improve the precision and real time in attitude angle acquisition.


INTRODUCTION
A four rotor aircraft has advantages of simple structure and easy control as an aircraft that can hover, take-off and land vertically [9][10][11]. It can be applied widely in civilian and military conditions. The structure and principle of a four rotor aircraft is not complex, and it has been preliminarily applied in some areas. However, owing to the problems of control precision and aircraft stability, its work environment and volume are extremely limited. At present the volume of four rotor aircraft is not large, and it cannot run in adverse conditions such as windy days or it will experience control problems because of low control precision. The low control precision has become a critical factor in restricting its development. So studying its control precision is very significant.
In regard to the problem of control precision, both domestic and foreign scholars have done a lot of research. Reference [1] established a pose estimation algorithm based on an improved particle filter of important density optimization function. With the mechanical model and backstepping controller, it filters the four rotor aircraft's attitude signals. Reference [2] applied a complementary filter algorithm by reducing the processor speed and accuracy requirements and achieved a small four rotor aircraft attitude signal solution. References [1] and [2] achieved some good effects in obtaining accurate attitude signals for four rotor aircraft. But weather has a great impact in the signal acquisition process, and the volume of aircraft is limited. The precision will be greatly reduced with the increase of volume, so the control precision needs to be further improved. Reference [3] put forward a combination of adaptive moving average processes with a multiple model Kalman filter to efficiently filter a digital Fiber Optic Gyroscope (FOG) signal. Reference [4] put forward an unscented Kalman filter to improve the filter accuracy, aiming at the error of attitude signal. Although the filter accuracy was improved in references [3] and [4], the algorithms are both complex and difficult to realize. If we want to apply them in a four rotor aircraft, we must simplify the algorithm.
In practical operations, the poor integrity of information acquisition is the key reason for the poor precision and stability of the aircraft. The attitude information of four rotor is obtained through a gyroscope sensor; the obtained data cannot be accurately expressed because of the interference of zero drift of the gyroscope sensor itself and the effect of the noise and the interference of external environment. Thus, the control precision and stability are greatly reduced. The true value filtered out by the signal contains noise, while the Kalman filter is an effective filter algorithm [12][13]. Because of the high computational intensity of the Kalman filter, it is not applied in the early period when the chip operates lowly. With the decline of chip costs and the improvement of computational speed, a Kalman filter is a better filter method. This paper first establishes the state equation, which describes the information acquisition process of a four rotor aircraft attitude angle, then the data obtained from the accelerometer and gyroscope, respectively, as a Kalman filter, and the value of the observation and state estimation. Kalman gain is calculated by the covariance of two values. Finally, the state observation and state estimation optimal value is acquired by the estimation equation, filtering the noise. We proved the superiority of the Kalman filter compared to other commonly used filter methods through the simulation [14][15][16].

II. FLIGHT THEORY OF FOUR ROTOR AIRCRAFT
For four rotor aircraft, the four Brushless DC Motors are mounted in an "X" type rigid cross structure; the motor drives the rotor's rotation to complete the various flight motions.. The propeller can be divided into the left propeller, the right propeller, the front propeller, and the back propeller. The front and back propellers rotate clockwise, while the left and right propellers are counterclockwise. It is depicted in in Figure 1.
By controlling the speed and rotation direction of the propeller, the four rotor aircraft can achieve hover movement, vertical movement, pitch movement, roll and yaw movement.
In the flight process of the four rotor aircraft, the data of the flight control is mainly obtained from the accelerometer and gyroscope. What the accelerometer provides is the angle, which are the three axes of the accelerometer to the vertical direction. And what the gyroscope obtains is the  Figure 1. Four rotor aircraft's schematic diagram angular velocity; we can also find the angle value by integrals. The aircraft can reach a predetermined flight state according to the difference between the two sensor angle values and the aircraft control algorithm. But actually, there is an existing accumulated drift error due to the inherent characteristics of a gyroscope and the influence of temperature, integral processes. Moreover, long work time will lead to a significant error in the output data of the accelerometer; thus, its dynamic performance is bad. The output data are not accurate and are easily affected by the influence of acceleration. The control effect is not accurate if we do not filter the influence.

III. THE ATTITUDE ESTIMATION BASED ON KALMAN FILTER
The common filter methods include the particle filter, mean filter, complementary filter, and Kalman filter. The Kalman filter is an algorithm to estimate the system's minimum covariance to the filter [6].
The Kalman filter includes a prediction state and an update state. The prediction state predicts the now moment state according to the previous moment state. The update state process determines the optimal state of the moment according to the observed values and predicted valuesthat is the filtered value [5]. The specific principle of the Kalman filter as follows: First, due to the change of the sensor, the measured angle value is discrete; it can be seen as a discrete control process system. The system can be described by a linear differential equation: The measurement system is expressed by the following equation: In the last two equations, ( ) x k is the system state of k moment, and ( ) u k is the system control variable of k moment. Both A and B are the system parameters; for the multiple model system, they are matrixes. The measured value of the moment k is ( ) z k , H is the measurement system parameters; for the multiple model system, H is a matrix. ( ) w k and ( ) v k are noise of process and measurement, respectively, and are generally assumed as Gaussian white noise. Their covariances are Q and R respectively.
The Kalman filter algorithm estimates the optimization of the system output based on the covariance. Assuming that the system state is k , according to the model of the system, we can predict the current system state based on the state of the last moment: In (3), ( | 1) x k k ! is the value based on the forecast of the last moment. ( 1| 1) x k k ! ! is the optimal result on the state of the last moment; ( ) u k is the current state control variable of the system. If there is no control variable, it will be 0.
The Kalman filter algorithm is on the basis of the estimated minimum covariance of the system, we need to update the covariance, which corresponds to ( | 1) x k k ! .
We use P for covariance: In (4), ( | 1) P k k ! is the covariance corresponding to the covariance for the system processing. The above equations (3) and (4) are the state prediction, that is, part of the prediction of the Kalman filter algorithm.
In the condition of having predicted the results, collecting the measured value of the current state according to the Kalman filter algorithm, and then combining the predicted values with the measured values, we can get the optimal estimates ( | ) x k k of the current state: In the equation, the Kalman Gain is kg : In the Kalman filter, the update process is measured by the Kalman Gain calculated in each circulation. The Kalman Gain is regarded as the input in the updating state estimation model. The Kalman Gain determines the optimal balance of the process error and measurement error.
Through a Kalman filter calculation, once we have the optimal estimates ( | ) x k k of the current state to make the Kalman filter run until the end of the system process, we still need to update the covariance corresponding to ( | ) x k k on the base of k time, so the Kalman filter algorithm is calculating circularly: In the equation, the value of matrix I is all of 1; for the single model and single measurement, I =1. When the system moves into the state of 1 . The above equations (5), (6), and (7) constitute the update process, achieving the status update. So the algorithm can calculate circularly.
In the process of obtaining the estimation of a four rotor attitude angle in flight, we regarded the data obtained from accelerometer as observation and the data obtained from gyroscope as estimation. We used the Kalman filter algorithm for data fusion and the data estimation to approximate the real value. Filtering out the noise impact of zero bias, we obtained the optimal input data.

IV. THE SIMULATION VERIFICATION
To verify the effect of a Kalman filter, we compared the Kalman filter with a commonly used Mahony complementary filter. Some typical signals mixed with noise input Kalman and Mahony complementary filters, respectively, by using MATLAB. We found two comparison results of the two filter algorithms, and then the two types of filter algorithms were compared qualitatively under a simulation image. At the same time, to analyze two types of filter accuracy and real-time performance quantitatively, we calculated the variance of the original signal curve under two types of filters. We used the data of variance for accuracy and real-time performance analysis.

A. Step signal mixed with noise
It is generally believed that systematic working conditions are more serious and more representative under the action of a step function input. If the system can meet the requirements of the performance index under the action of a step function, the effect of other forms of performance can also meet the requirements. And because the step signal is very similar to many conditions of a four rotor aircraft under the impact of a state signal by accident while flying, (for example, a bird impact, an obstacle collision and so on), we adopted an added noise step signal as input into the system attitude angle data, comparing the two filter methods as follows: The results of the Kalman filter: We came to the conclusion by calculation that the variance of the added noise original signal curve is 0.8500 under the Kalman filter; however, under the traditional way of the Mahony complementary filter, the variance of the original signal curve was as much as 1.2317.

B. Sine signal mixed with noise
In that the four rotor aircraft is often affected by wind and airflow that lead to oscillation of the symmetry in the fuselage attitude during flight, to verify the filter effect of the Kalman filter under the symmetry shock signal, we specifically selected the typical sine signal mixed with noise as a signal input, comparing the two filter methods as follows: The results of the Kalman filter: We came to the conclusion by calculation that the variance of the added noise original sine signal curve is 1.1587 under the Kalman filter; however, under the traditional Mahony complementary filter, the variance of the original sine signal curve was as much as 1.7866.

C. Irregular signal mixed with noise
After the filter performance validation under the impact on behalf of the step signal and shocks representing a sine signal, to verify the accuracy of the Kalman filter and the real-time performance more accurately, we specifically PAPER THE ATTITUDE SIGNAL PROCESSING OF FOUR ROTOR AIRCRAFT BASED ON A KALMAN FILTER simulated the two types of filters in more harsh environments where the four rotor aircraft signal were mixed with random noise and clutter, taking it as a signal data input, comparing the two filter methods as follows: The results of the Kalman filter: We came to the conclusion by calculation that the variance of the added noise original irregular signal curve is 1.4899 under the Kalman filter; however, under the traditional Mahony complementary filter, the variance of the original sine signal curve was as much as 2.0127.
First, through simulation comparison, the filter effect of the Kalman filter and the complementary filter was compared in step signal, sine signal and clutter signal mixed with noise. Two curves were compared under the three kinds of signal close degrees. It can was determined that the traceability of the Kalman filter is better than the Mahony complementary filter. It was obvious that the Mahony complementary filter lagged behind the Kalman filter. Good traceability proved that the data processing had a good real-time performance. The real-time attitude angle data were vital to the real-time control of a four rotor aircraft. By comparing the Kalman filter and the complementary filter value and variance of the original value, we concluded that the variance of the Kalman filter is much smaller than the complementary filter in a typical impact, shock case, or under the condition of relatively poor comprehensive. Therefore, the accuracy of the Kalman filter is much better than the complementary filter. Accuracy is the key to data processing; only processing accurate data can guarantee the accuracy of the control strategy. So the Kalman filter method of high accuracy is conducive to improving the accuracy of the control. The simulation graph and calculating the variance proved qualitatively and quantitatively that the Kalman filter is better than the commonly used complementary filter method.

V. CONCLUSIONS
In this article, we integrated the attitude angle of the accelerometer and gyroscope by using a Kalman filter algorithm. It could overcome the shortcomings of inaccurate attitude angle measurement caused by the noise and zero drift of the sensors. Compared with the commonly used complementary filter, we concluded that both the accuracy and traceability of the Kalman filter are better, and it is favorable for controlling spacecraft's attitude changes in real time.