Abstract
In this paper we discuss an extended kalman filter with novel magnetic vector measurement model for attitude estimation of unmanned aerial vehicles (UAVs). As MARG (Magnetic, Angular Rate and Gravity) sensors are used, this extended kalman filter selects attitude error and angular rate drift as the filter states, and performs the information fusion using the magnetic and gravity vector respectively measured by the three-axis accelerometer and the three-axis magnetometer. We propose a new method of magnetic vector fusion different from the past ones. Firstly, the measured earth magnetic vector is transformed from body frame to local frame using estimate direction cosine matrix. And then the innovation is carefully constructed using the cross product between measured vector and referenced earth magnetic vector, which is different from the past vector subtract way. Finally, the measurement model of magnetic vector and equations of kalman filter is presented. Proposed algorithm is implemented on the Cortex-M4 microprocessor platform and experiments is taken relied on three-axis turntable. The results show that the proposed method has a lower computational cost than the past methods, and is able to track the attitude of motions precisely.
Introduction
Since the Apollo mission in the 1960s, extended kalman filter (EKF) has long been applied to the attitude estimation and navigation of vehicles [1]. At present, due to the advantages of no singularity and less computation, many quaternion-based extended kalman filtering methods have been applied to attitude estimation of various types of aircraft [2, 3]. Otherwise, with further consideration on non-linear and non-Gaussian situations, filtering methods that are better suited to strong nonlinear or non-Gaussian systems are widely studied. Such as the unscented kalman filter (UKF) and the cubature kalman filter (CKF) that can better deal with nonlinear situations than EKF [4, 5, 6], and the particle filter (PF) that can be applied to non-Gaussian systems [7]. But these advance methods also lead to higher computational cost than traditional EKF. Especially in high dynamic systems such as hyper-sonic vehicles, in order to constrain the coning errors and sculling errors in strap down inertial navigation calculations, high attitude updating frequencies are required. However, the on-board embedded computers are not very capable good support for high-frequency (more than 100 Hz) calculations of UKF, CKF or PF algorithms. Therefore, in engineering practice, extended kalman filter is still the first choice for many engineers. Besides Kalman filter there is an alternative approach to attitude estimation treats the disturbance as unknown deterministic signals and seeks to optimize some measure of size of these signals. The most prominent techniques in this domain are complementary filter [8] and minimum-energy filter [9].
This paper focuses on attitude estimation of UAVs using MARG sensors which are composed of three-axis magnetometer, accelerometer and gyroscope. In this problem, extended kalman filter using attitude error as states is considered as a standard solution [10, 11]. According to the terminology in [12], the process of kalman filter can be divided into two steps: time update (prediction) and measurements update (correction). In these conventional solutions, the time update process usually uses the angular rates information measured by the three-axis gyroscope to update the state and the covariance matrix of the filter, and then the gravity and magnetic field vectors measured by the three-axis accelerometer and magnetometer are used for the measurement update process. In the prediction step, these methods have a similar form, and in the correction step, there are several different approaches. A class of approach is updating measurements by directly using of the measured gravity and magnetic field vectors [13], and either batch or sequential update method can be adopted. In batch update method, the calculation of the kalman gain and covariance matrix only needs to do once. But this method involves calculating the inverse of a matrix has the same dimension with the measurement vector (e.g. a 6 by 6 matrix). In sequential update method we do not need to perform matrix inverse calculation, but the kalman gain and covariance matrix have to calculate the same number as the dimension of measurement vector times. In addition, the covariance matrix of measurement noise is required to be a diagonal matrix to realize the sequential method. Otherwise some extra operation must be taken to transform the covariance matrix of measurement noise to a diagonal matrix. In general, people are more willing to use a sequential approach. This class of measurement update approach can directly employ the original noise information of sensors to construct the matrix R, which is used to calculate the kalman gain. So the parameters of kalman filter with this kind of measurement update approach is easily determined and adjusted. Another class of approach is to first determine an attitude parameter using the measured gravity and magnetic field vectors, and then use this attitude parameter for measurement update process [14, 15]. At present, methods of determining attitude by two vectors include: QUEST algorithm by solving a optimization problem [16], TRIAD algorithm for calculating direction cosine matrix (DCM) using vectors’ geometric property [17], algebraic analysis method [18] and so on. Similarly, this class of approach can also be updated using either batch or sequential methods. This kind of approach can reduce the dimension of the measurement model but requires additional attitude determination calculations. Furthermore, the covariance matrix of attitude measurement noise derived from this approach cannot be obtained through the original measurement noise of sensors, which can only be determined empirically. Thus increasing the difficulty of adjusting the filter parameters.
Aiming at the problems of the above two class of measurement update approaches, we improved the measurement model of MARG sensors. On the one hand, it reduces the dimension of measurement model and thus reduces the computational cost of measurement update process. On the other hand, it makes the measurement noise of sensors keep their physical meanings, which makes the covariance matrix of measurement noise of filter easy to determine and adjust. The rest of paper is organized as follows: In Section 2, the coordinate systems, attitude parameters and measurement models are presented; Section 3 describes the traditional extended kalman filter equations based on the rotation vector and MARG sensors; then in Section 4 the improvement of measurement model is presented; the fifth section presents experiments of proposed method and methods in [17, 11] for comparison. The results show that the proposed method has less computational time consuming and the higher estimation accuracy than conventional methods.
Notation and definitions
Utilizing unit-quaternion to represent the attitude of vehicles has the advantages of no singularity, less calculation and dynamic equation in linear form. Unit-quaternion is a four components vector defined as
Let
The conjugate of quaternion
where
In this paper, the unit-quaternion is used to describe the attitude of the body frame (b frame) with respect to the local tangent-plane frame (l frame). The details of frame definitions can be found in [19]. Use
Another useful attitude parameter is rotation vector. A rotation vector can be defined as
When the length of rotation vector is small it can be approximated as follow formula:
Let
Rotation vector based attitude error representations
The true attitude of UAV can be expressed as follow:
where
Therefore, the task of designing the attitude estimation kalman filter is to use the predicted attitude estimation
and
The predicted attitude estimation can be calculate by Eq. (3):
where
where
The state vector of the extended kalman filter is chosen to be
And details about the derivation of above formula can be found in [11].
Then we can write the state transition matrix from time
where
It should be noted that in this paper, subscript
with
The angle random walk variance
In MARG sensors frame, the magnetometer, gyro and accelerometer measurement models can be represent as follow:
Two class of measurement models mentioned in Section 1 have been described in detail in past papers. In [1], the TRIAD method for calculating the attitude DCM using measured gravity and magnetic field vector is presented. By converting the attitude DCM to quaternion, a four-dimension measurement model is build and then the correction process is update based on the model. The literature [11] gives a method of kalman filter measurement update directly using vectorial measurements, and then obtains a six-dimension measurement model. This paper will not go into details about these existing methods.
In fact, when we build different measurement model, it results in different measurement matrix
As we have discussed,
It is easy to see that when using the measurement model in [17], the dimension of the measured vector is 4. But the noise of the measurement model is the noise of each quaternion component and can not be determined by accelerometer and Magnetometer measurement noise directly. And when we use the measurement model in [11], the dimension of the measurement vector is 6, which will consume more computations. However, the noise of the measurement model is the original noise of accelerometer and magnetometer, so it can be directly determined.
The novel model based measurements update
We will derive a novel measurement model of MARG sensors. Firstly, let us recall the accelerometer model in Eq. (3.3), by combining with the error representation of the DCM it leads:
where
Where
is the estimation of gravity vector projected in body frame. Therefore, the measurement matrix of accelerometer measurement is
And the innovation generated by accelerometer measurement is
where
Operation 1: Substitute the error rotation vector using Operation 2: Set the third component of vectors to zero on each side of equation.
The design of “Operation 2” is depend on the physical meaning of the Eq. (28). On both side of this equation is a three components vector, which represent the local magnetic field vector projected in north, east and down, respectively. As we can determine the yaw of the UAV just using north and east magnetic values, the magnetic field component in down direction is redundant, and thus we set it to zero. Another advantage of this operation is that we need not to calculate the vertical component of the local geomagnetic field vector. Note that
To simplify writing, we define
After defining the following vectors,
we apply a cross product of vector
And then the measurement matrix of magnetometer is
And the innovation is
Note that the measurement noise become to
Based on the above derivations, the novel measurement model reduces the dimension from [11]’s 6 to 4, and compare to [17] the measurement noise auto-covariance matrix can be determined directly, which allows the user tuning the filter parameters conveniently. When taking batch operations, the proposed method only need to compute the inverse and multiplications of 4 by 4 matrix, while the [11]’s method must compute a 6 by 6 matrix’s inverse. Because of the computational complexity of inverse operation of p-th order matrix is p
Experiments
In this section, we will verify the performance of the proposed method in two aspects: the first is the precision of attitude estimation, and the second is the computational cost. As a comparison, the same experiment is carried out on the extended Kalman algorithm based on the TRIAD measurement model in [17] and based on the vector measurement model in [10], respectively. Algorithms are implemented in a self-developed embedded flight control system based on STM32F407 microprocessor, shown in Fig. 1.
Experiment hardwares: self-developed flight control system (left) and three-axis turntable (right).
The micro-processor is running at 168 MHz, and the three algorithm operating at 50 Hz. Furthermore, the on-chip timer is used to calculate the algorithm time-consuming. In experiment, we utilize both of step and sinusoidal motions in each axis by a three-axis turntable (see Fig. 1) to test the performance of methods. Specially, the step motion is from zero position to 45 degrees position in each axis, with the angular velocity of 300 degrees per second and the angular acceleration of 300 degrees per second. The amplitude of sinusoidal motion is 45 degrees, with roll and pitch at a frequency of 1 Hz and, limited to the capacity of turntable, yaw at a frequency of 0.25 Hz.
Our filter initial states are all set to zero, and the standard deviation of noises are set as follow: the gyro and gyro bias process noise is 0.03 rad/s and 0.0001 rad/s, respectively; the magnetometer measurement noise is 0.05 Tesla; the accelerometer measurement noise is 0.6 m/s
Roll step motion results.
Pitch step motion results.
Yaw step motion results.
Filtering error
Calculates consumption
Sinusoidal motion test results.
Figures 2–4 and Table 1 show the results of step motion test. From Figs 2 and 3, we can see that all the three methods can track the change of attitude without overshoot in roll and pitch axis. In contrast, the proposed method has the shortest adjustment time. In the yaw axis step experiment shown in Fig. 4, the TRIAD measurement model and the vector measurement model based methods appear overshoot as the torque motor of the turntable generates additional magnetic fields when activation, that affect the magnetic measurement significantly. In contrast, the proposed method, although fluctuating during the motor start-up, can still track changes in roll angle without overshooting. Figure 5 and Table 1 shows the results of the sinusoidal motion test, and it can be seen from the figure that all three methods can track the sinusoidal motion well, and the proposed method has high filtering accuracy. As can be seen from Table 2, the proposed method has the lowest computational cost, which is approximately 25% lower than the TRIAD-based method and 38% lower than the vector-based method. In addition, when applied to different real systems, both the proposed method and the vector-based method are capable of setting measurement noise directly from the sensor’s datasheet or actual measurement. However, TRIAD-based methods need long-term parameter adjustment based on speculation and experience to obtain satisfactory filtering effects.
Aiming at the attitude estimation problem of UAV, this paper firstly presents a extended Kalman filter that uses the attitude error described by the rotation vector and gyro drift as the state vector, and utilizes the gravity and magnetic field measurements for information fusion. And then by transforming the measured magnetic field vector in body frame to reference frame and applying the vector cross production, we propose a new measurement model using MARG sensors. The proposed method has three main advantages. First of all, it is not necessary to obtain the complete geomagnetic information in the location of the drone, which simplifies the complex calculation of the local reference geomagnetic field vector. Secondly, the magnetic field measurement model is also reduced from three-dimensional to one-dimensional, greatly reducing the amount of computation required for data fusion of the magnetic field; Finally, the original measurement noise information of sensors can be used directly to facilitate the determination and adjustment of the filter parameters. The algorithm was implemented on the Cortex-M4 microprocessor platform, and relied on three-axis turntable for experiments. The results show that the method proposed in this paper has a lower computational cost than the previous methods, and can estimate the attitude of the UAV in real time. Furthermore, we would try to improve the gravity measurement model to further reduction of the dimensions in future.
