Unscented Kalman Filter for Determination of Spacecraft Attitude Using Different Attitude Parameterizations and Real Data

AbstrAct: The non-linear estimators are certainly the most important algorithms applied to real problems, especially those involving the attitude estimation of spacecraft. The purpose of this paper was to use real data of sensors to analyze the behavior of Unscented Kalman Filter (UKF) in attitude estimation problems when it is represented in different ways and compare it with the standard estimator for non-linear estimation problems. The robustness of the estimation was performed when this was subjected to imprecise initial conditions. The attitude parametrization was described in Euler angles, quaternion and quaternion incremental. The satellite China-Brazil Earth Resources Satellite and measurements provided by the Satellite Control Center of the Instituto Nacional de Pesquisas Espaciais were considered in the study. The results indicate that the behaviors for both estimators were equivalent for such parameterizations under the same conditions. However, comparing the Unscented Kalman Filter with the standard filter for non-linear systems, Extended Kalman Filter (EKF), it was observed that, in the presence of inaccurate initial conditions, the Unscented Kalman Filter presented a fast convergence whereas Extended Kalman Filter had problems and only converged later on.


IntroductIon
The basic principle of state estimators is to produce a state estimate of the dynamic system at the current time using the knowledge of measurements at the current time and an estimate of the state at the previous time with knowledge of error associated with the system.There are several estimation methods, each one being suitable for a particular type of application.Thus, it is necessary to evaluate the processing time and accuracy to be reached.The method to estimate the attitude used is Unscented Kalman Filter (UKF), since this estimator is capable of performing state estimation in non-linear systems, besides taking into account measurements provided by different attitude sensors.This paper considers real data supplied by gyroscopes, Earth sensors and solar sensors, which are on board of the China-Brazil Earth Resources Satellite (CBERS-2).

representatIon of attItude
The attitude of a spacecraft is defined as its orientation with respect to some reference frame, and, for a successful mission, it is essential that the satellite is stabilized in a determined attitude.The attitude of a rigid body in three-dimension space can be represented in different ways, among which Euler angles and quaternions have been highlighted.The attitude of CBERS-2 satellite is stabilized in three axes called geo-pointed and can be described with respect to the orbital system.In this reference system, the motion around the direction of the orbital velocity is called roll; the motion around the direction normal to the orbit is called pitch; and the motion around the direction nadir/zenith is called yaw.Defining the state vector composed by Euler angles (ϕ, θ and ψ) and the componentes of the gyros bias (ε x , ε y , ε z ), and assuming that ϕ and θ are small angles, the differential equations of state for attitude and bias of the gyros are modeled as follows (Silva et al. 2014): Given that the gyro dataset is at a fixed rate and the angular velocity of the spacecraft system is constant throughout the sampling interval, a solution to q is presented by (Wertz 1978): where: ϕ, θ and ψ are the attitude angles obtained by some estimation process; ω 0 is the orbital angular velocity; ω x , ω y and ω z are the components of the angular velocity ω on the satellite system.The rotation sequence used in this paper for the Euler angles was the 3-2-1.

representAtion of Attitude by QuAternions
The quaternion is a four-dimensional vector, defined as (Markley et al. 2005): with where: n is the Euler axis and φ is the rotation angle.Because a four-dimensional vector is used in the description of three dimensions, the quaternion elements cannot be independent and should comply with the constraint q T q = 1.
The parcel of attitude shown by Eq. 1 is represented by quaternions as: where: Δt is the sampling interval; q(t) is the quaternion at time t; q(t + Δt) is the quaternion propagated to the next time t + Δt; and Φ q is the transition matrix that moves the system from time t to t + Δt.
The transition matrix is given by: where: Ω is the 4 × 4 antisymmetric matrix (Lefferts et al. 1982).

representAtion of Attitude by QuAternion incrementAl
A different approach to represent the attitude is by quaternion incremental, where the quaternion is obtained by (Crassidis et al. 2007;VanDyke et al. 2004): where: q is the estimated unit quaternion and δq(φ) is a unit quaternion expressing the rotation from q to the true attitude q, parameterized by a three-component vector in terms of φ.
The supporting idea is that the three-vector δX will be estimated and the correctly normalized four-component q provides a globally non-singular attitude representation.In this way, Eq. 7 shows that δq(φ) X q is the estimate of the true attitude quaternion q.The main advantages of this option are that q is a unit quaternion by definition, the covariance matrix has the minimum dimensionality, and the three-vector δX (3) never approaches a singularity, since it represents only small attitude errors.For small-angle approximation, the quaternion incremental is represented by (Crassidis et al. 2007): unmodelled effects.
the meAsurement model for infrAred eArth sensors The Infrared Earth Sensors (IRES) are located on the satellite and aligned with its axes of roll and pitch, providing direct measurements of these angles.The measurement equations for the Earth sensors are given by (Lopes and Kuga 2005): The quaternion incremental between the quaternion "measured" and the estimated quaternion follows Eq. 7 and is defined by: the MeasureMents systeM of satellIte The attitude of spacecraft can be determined by one or by a combination of several types of sensors.This section presents the mathematical models of the sensors that are on board the CBERS-2 satellite, which are responsible for the measures used in the estimation process.

the meAsurement model of gyroscope
The advantage of using gyro measures is that it can provide the angular displacement and/or angular velocity of the satellite directly.However, gyros have an error due to drifting (bias), meaning that their measurement error increases with time.The rate-integration gyros (RIGs) are used to measure the angular velocities of the roll, pitch and yaw axes of the satellite.The mathematical model of the RIGs is (Lopes and Kuga 2005): where: ΔΘ are the angular displacements of the satellite in a time interval Δt.Thus, the measured components of the angular velocity of the satellite are given by: where: g is the output vector of the gyroscope; η represents a Gaussian white noise process covering all the remaining where: ν ϕ and ν θ represent the Gaussian white noise related to small remaining effects of misalignment during installation and/or assembly of sensors.

the meAsurement model for digitAl sun sensors
The Digital Sun Sensors (DSS) do not provide direct measurements but coupled angles of pitch (α θ ) and yaw (α ψ ).The measurement equations for the sun sensor are established as follows (Lopes and Kuga 2005): where: S x , S y and S z are the components of the unit vector associated to the sun vector in the satellite system; the Gaussian white noises are represented by να ψ and να θ and represent small effects of misalignment during installation and/or during sensor assembly.

attItude estIMatIon Based on non-lInear KalMan fIlter
The state of non-linear estimator covered in this study was UKF.The UKF uses the unscented transformation which calculates a set of samples, or sigma points, defined from the a priori mean and covariance of the state (VanDyke et al. 2004).The sigma points undergo the non-linear transformation, and the posterior mean and covariance of the state results from the transformed sigma points.where: f represents the non-linear vector function of state x with dimension n; y is the vector of sensor measurement with dimension m; h is the function associated with the model of sensors shown by Eqs. 12 and 13; η and ν represent the process and measurement noise with Gaussian white noise and covariances given by Q and R respectively.
In this paper, the state vector is composed by attitude and bias of gyro.The two forms used here are shown by Eqs. 1 and 4.
Given the state vector at step k − 1, we compute a collection of sigma-points, stored in the columns of the n × (2n + 1) sigma point matrix χ k-1 in which n is the dimension of the state vector.In our case, n = 6 for Euler angles parameterization, Eq. 1, or n = 7 for quaternion parameterization, Eq. 4. The columns of χ k-1 are computed by (Julier and Uhlmann 2004): where: λ ∈ R; P is the covariance of the state estimation error; √(n + λ)P k-1 ) is the ith column of the matrix square root of (n + λ)P k-1 .

time updAte step
Once χ k-1 is computed, we perform this first step by predicting each column of χ k-1 through time by Δt, using: where: f is the differential equation defined in Eqs. 1 or 4, depending on the selected parameterization.
In the formulation with Euler angles, Eq. 1, the integration of the state is made via Runge-Kutta.With (χ k ) i calculated, the a priori state estimate and the a priori error covariance are: With the mean measurement vector y k , we compute the a posteriori state estimate using: where: K k is the Kalman gain.In the UKF formulation, K k is defined by: where where: R k represents the measurement error covariance matrix.
Finally, the last calculation in the step is the a posteriori estimate of the error covariance given by: results The results presented below compares the satellite attitude and the estimated gyro bias considering the estimators UKF and Extended Kalman Filter (EKF).For this, it is used real data of sensors on board the CBERS-2 satellite.Results obtained in previous studies, like Garcia et al. (2012Garcia et al. ( , 2014)), are used to compare the different parameterizations.The CBERS-2 satellite was launched on October 21 st , 2003.The measurements were collected in April 22 nd , 2006, available to the ground system at a sampling rate of about 8.56 s.The algorithm was implemented through MATLAB software.The Attitude Control System (ACS) on board the satellite has full access to sensor measurements sampled at a rate of 4 Hz for the three gyros, to axes x, y and z of the satellite; 1 Hz for the two IRES; and 0.25 Hz for both DSS.However, due to limitations, the telemetry system can only acquire telemetries from sensors at 9-s sampling rate when the satellite passes over the tracking station.This means that the ground system does not have the full set of measurements that are available to the ACS on board.In total, we have a set of 54 measurements from 13h46min25s until 13h55min27s, and the measurements are spaced by 10 s on average.The measures of DSS and IRES are presented in Fig. 1, and the measures of gyroscope are presented in Fig. 2.These measures were provided by the Satellite Control Center of the Instituto Nacional de Pesquisas Espaciais (INPE).The set of initial conditions used by the algorithms is presented in Tables 1 to 3  (UKFe) were used as reference (Garcia et al. 2012).The term "error" in this paper means that the estimated attitude by the different approaches is close to the reference.Figures 3 to 6 show the difference between the state estimated by the UKF when the attitude is represented via Euler angles (UKFe) and the estimated state: (1) via quaternions (q) and quaternion incremental (qi) Figs. 3 and 4; (2) through EKF with Euler angles, q and qi, Figs. 5 and 6.Figures 3a and 3b show that the roll and pitch estimated by UKF with quaternion incremental (qi) get close to the reference, when compared with results obtained by quaternion (q).The reason for the results with quaternions being more distant from the results of attitude via

Error in ϕ [deg]
Time UFKe-UFKq UFKe-UFKqe UFKe-UFKqi Euler angles can be justified by the need to reduce the order of the covariance matrix (7 to 6) during the estimation process.For yaw angle, Fig. 3c, we can notice an approximate behavior for the two approaches (q and qi) in relation to the reference (Euler angles).However, it is not possible to verify the tendency of error converging to zero in the proposed dataset.A larger measurement dataset is necessary to evaluate such behavior.When the UKF estimator is compared with the EKF estimator it was observed a similar behavior between both for the roll and pitch angles,

Error in ε x [deg/h]
Figs. 5a and 5b.For the yaw angle, significant differences were not observed between Extended Kalman Filter with quaternion (EKFq) and Extended Kalman Filter with quaternion incremental (EKFqi) compared to UKFe, Fig. 5c.The mean and standard deviation of error for the estimated attitude related to the reference are presented in Table 4.With respect to estimated bias, it is not possible to observe the convergence of algorithms for the set of measures used in the study, Fig. 4.However, it is noted that the order of the error associated with the results obtained by EKFq and EKFqi is the same when compared with the Extended Kalman Filter with Euler angles (EKFe), Fig. 6.
For the same parameterization attitude, UKFe and EKFe estimators have shown the same behavior.considerations can be better evaluated in Table 5.

robustness test
The performance of UKF is evaluated by comparing the estimated attitude with Euler angles by EKF and UKF estimators when both are subjected to imprecise initial conditions.In the first column of Fig. 7, we considered the initial values of attitude components very distant from true values, with roll, pitch and yaw equal to 10 deg each.It is known that expected values are close to zero, approximately -0.5, -0.45 and -1.5 deg to the set of measurements on test.The other conditions were kept constant.It is observed that, even taking longer, the EKF still converges to the expected value of the attitude (approximately -0.5 deg for roll and pitch and -1.5 deg for yaw), unlike UKF, which converges instantaneously.We also notice an incompatibility of attitude errors estimated by EKF (covariance) UKFq/EKFq: Quaternions; UKFqi/EKFqi: Quaternion incremental; UKF with Euler angles -UKFe: Reference value.because the estimated attitude is far from the expected value of convergence and the EKF assumes small errors (sigma).This behavior is observed until the EKF reaches convergences and its errors remain around the ones obtained by UKF.In the second column of Fig. 7, it is considered the radically incorrect value of 20 deg for initial angles of roll, pitch and yaw.It clearly appears that the UKF converges in the initial stages, unlike the behavior obtained by the EKF, which is clearly different in roll.This case shows that, for degraded initial conditions, the linearizations performed in EKF are not effective, causing the filter to lose its capacity to accurately estimate the state of the system during the considered period.On the other hand, UKF is converged clearly, showing its robustness and superior performance in this situation.
processing time: unscented KAlmAn filter versus extended KAlmAn filter A quantitative analysis of the processing time spent by the CPU in the estimation process for different representations of attitude (Euler angles, quaternions and quaternions incremental) is held.We know that the amount of time is not an absolute indicator.However, even if quantitative, this analysis aids in assessing the applicability of UKF in problems in which the estimation is processed in real time, since this algorithm expands the number of vectors from state n to 2n + 1 of same dimension.Table 6 shows the CPU time spent to process the measurements from the sensors in different approaches used to estimate attitude.The average of 100 runs was calculated for each filter in each parameterization.We remember that the programs were coded in MATLAB language in an Intel Core i3 with 3 GB of dynamical memory, running Windows 7, 64 bits version.
It may be noted that, although the processing time consumed by UKF is greater than that by the EKF, the increase is not proportional to the number of points generated in the UKF (note that UKF works with 2n + 1 vectors of dimension n (6 or 7), unlike the EKF, which uses only a vector of dimension n).In all cases, the CPU expense via UKF is not 3 times the CPU expense via EKF.This time is still suitable for processing in real time, preserving the UKF advantage of being a more robust algorithm (see Fig. 7) and less prone to divergence due to non-linearities.In EKF, we note that the processing time is independent of the formulation adopted.In UKF, it is noticeable that the formulation via the Euler angles has higher computational expense, since this method requires numerical integration of the attitude dynamics.The lower expense occurs in the formulation via quaternion incremental, where the dynamic approach is obtained analytically and the state vector is reduced to dimension n = 6.

fInal coMMents
The UKF was tested through diferent parameterizations of attitude, using real data supplied by attitude sensors that are on board the CBERS-2 satellite.Results obtained in previous studies served as a reference for comparisons between parameterizations.The attitude estimated by UKF was adequate when compared to the EKF.This is expected because the best performance of the UKF is based on inaccurate measurements of observations, estimated state errors or even systems involving highly nonlinear equations, which is not the purpose of this study.However, the UKF was more consistent in comparison to EKF, since the results indicated that the performance of UKF far exceeds the conventional EKF for large initialization errors.The time spent in the estimation process for the UKF was higher compared to the EKF, but the processing time was adequate for realtime applications.Among the parameterizations considered, the quaternion incremental provided a smaller CPU load, reducing the dimension of the state vector, and its dynamic model equations are linear.

Unscented
Kalman Filter for Determination of Spacecraft Attitude Using Different Attitude Parameterizations and Real Data representAtion of Attitude by euler Angles for Determination of Spacecraft Attitude Using Different Attitude Parameterizations and Real Data Consider the system model given by: meAsurement updAte step To compute this step, first we must transform the columns of χ k through the measurement function to Y k .In this way:

Unscented
Kalman Filter for Determination of Spacecraft Attitude Using Different Attitude Parameterizations and Real Data

figure 3 .
figure 3. Comparison between attitude estimated by UKFe and different attitude parametrizations.

figure 4 .
figure 4. Comparison between bias estimated by UKFe and different attitude parametrizations.

figure 6 .
figure 6.Comparison between bias estimated by UKFe and EKF with different attitude parametrizations.

table 3 .
.To analyze the algorithm performance with different parametrizations, the values obtained by UKF and Euler angles Values of the diagonal of the error observation matrix R.

table 2 .
Values of the diagonal of the initial covariance matrix P 0 .

table 1 .
Initial conditions of attitude and bias of gyroscope.

table 5 .
Mean and standard deviation of error from estimated bias of gyro by different approaches.

table 4 .
Mean and standard deviation of estimated attitude error by different approaches.Kalman Filter for Determination of Spacecraft Attitude Using Different Attitude Parameterizations and Real Data figure 7. Attitude estimated by EKF and UKF with Euler angles considering initial conditions of ϕ, θ, ψ: 10 deg (first column) and 20 deg (second column).

table 6 .
Estimated processing time of measures of attitude sensors by UKF and EKF.