#### Abstract

The aim of this work is to test an algorithm to estimate, in real time, the attitude of an artificial satellite using real data supplied by attitude sensors that are on board of the CBERS-2 satellite (China Brazil Earth Resources Satellite). The real-time estimator used in this work for attitude determination is the Unscented Kalman Filter. This filter is a new alternative to the extended Kalman filter usually applied to the estimation and control problems of attitude and orbit. This algorithm is capable of carrying out estimation of the states of nonlinear systems, without the necessity of linearization of the nonlinear functions present in the model. This estimation is possible due to a transformation that generates a set of vectors that, suffering a nonlinear transformation, preserves the same mean and covariance of the random variables before the transformation. The performance will be evaluated and analyzed through the comparison between the Unscented Kalman filter and the extended Kalman filter results, by using real onboard data.

#### 1. Introduction

The attitude of a spacecraft is defined by its orientation in space related to some reference system. The importance of determining the attitude is related not only to the performance of attitude control but also to the precise usage of information obtained by payload experiments performed by the satellite. The attitude estimation is the process of calculating the orientation of the spacecraft in relation to a reference system from data supplied by attitude sensors. Chosen the vector of reference, an attitude sensor measures the orientation of these vectors with respect to the satellite reference system [1]. Once these one or more vectors measurements are known, it is possible to compute the orientation of the satellite processing these vectors, using methods of attitude estimation. There are several methods for determining the attitude of a satellite. Each method is appropriate to a particular type of application and meets the needs such as available time for processing and accuracy to be attained. However, all methods need observations that are obtained by means of sensors installed on the satellite. The sensors are essential for attitude estimation, because they measure its orientation relative to some referential, for example, the Earth, the sun, or a star. In this work, the satellite attitude is described by Euler angles, due to its easy geometric interpretation, and the method to estimate the attitude used is the Unscented Kalman Filter. This method is capable of performing state estimation in nonlinear systems, besides taking into account measurements provided by different attitude sensors. In this work there were considered real data supplied by gyroscopes, infrared Earth sensors, and digital sun sensors. These sensors are on board of the CBERS-2 satellite (China-Brazil Earth Resources Satellite), and the measurements were collected by the Satellite Control Centre of INPE (Brazilian Institute for Space Research).

#### 2. Representation of Attitude by Euler Angles

The attitude of an artificial satellite is directly related to its orientation in space. Through the attitude one can know the spatial orientation of the satellite, since in most cases it can be considered as a rigid body, where the attitude is expressed by the relationship between two coordinate systems, one fixed on the satellite and another associated with a reference system, for example, inertial system [2]. For a good performance of a mission it is essential that the satellite be stabilized in relation to a specified attitude. The attitude stabilization is achieved by the on-board attitude control, which is designed to acquire and maintain the satellite in a predefined attitude. The CBERS-2 attitude is stabilized in three axes nominally geo-pointed and can be described with respect to the orbital system. In this reference system, the movement around the direction of the orbital velocity is called *roll*. The movement around the direction normal to the orbit is called *pitch*, and finally the movement around the direction Nadir/Zenith is called *yaw*. To transform a vector represented in a given reference to another it is necessary to define a matrix of direction cosines (), where its elements are written in terms of Euler angles (, , ) [3]. The rotation sequence used in this work for the Euler angles was the 3-2-1, where the coordinate system fixed in the body of the satellite (, , ) is related to the orbital coordinate system (, , ) through the following sequence of rotations: (i)1st rotation of an angle (*yaw* angle) around the axis,(ii)2nd rotation of an angle (*roll* angle) around an intermediate axis ,(iii)3rd rotation of an angle (*pitch* angle) around the -axis.

The matrix obtained through the 3-2-1 rotation sequence is given by where is the matrix of direction cosines with , , and .

By representing the attitude of a satellite with Euler angles, the set of kinematic equations are given by [4] where is the orbital angular velocity and , , and are the components of the angular velocity on the satellite system.

#### 3. The Measurements System of Satellite

In order to estimate the satellite attitude accurately, several types of sensors, including gyros, earth sensors, and solar sensors, are used in the attitude determination system. The equations of these sensors are introduced here.

##### 3.1. The Model for Gyros

The advantage of a gyro is that it can provide the angular displacement and/or angular velocity of the satellite directly. However, gyros have an error due to drifting, meaning that their measurement error increases with time. In this work, the rate-integration gyros (*RIGs*) are used to measure the angular velocities of the *roll*, *pitch*, and *yaw* of the satellite. The mathematical model of the RIGs is [4]
where are the angular displacement of the satellite in a time interval , and are components of *bias* of the gyroscope.

Thus, the measured components of the angular velocity of the satellite are given by where is the output vector of the gyroscope, and represents a Gaussian white noise process covering all the remaining unmodelled effects:

##### 3.2. The Measurement Model for Infrared Earth Sensors (IRESs)

One way to compensate for the drifting errors present in gyros is to use the earth sensors. These sensors are located on the satellite and aligned with their axes of *roll* and *pitch*. In the work, two earth sensors are used, with one measuring the *roll* angle and the other measuring the *pitch* angle. In principle, an earth sensor cannot measure the *yaw* angle. The measurement equations for the earth sensors are given as [5]
where and are the white noise representing the small remaining misalignment, installation, and/or assembly errors assumed to be gaussian:

##### 3.3. The Measurement Model for Digital Solar Sensors (DSSs)

Since an earth sensor is not able to measure the *yaw* angle, the solar sensors are used by the Attitude Control System in order to overcome this problem. However, these sensors do not provide direct measurements but coupled angle of *pitch* () and *yaw* (). The measurement equations for the solar sensor are obtained as follows [5]:
when , and
when , where and are the white noise representing the small remaining misalignment, installation, and/or assembly errors assumed Gaussian:
The conditions are such that the solar vector is in the field of view of the sensor, and , , and are the components of the unit vector associated to the sun vector in the satellite system and given by
where , , and are the components of the sun vector in the orbital coordinate system and , , and are the Euler angles-estimated attitude.

#### 4. Attitude Estimation Methods

The goal of an estimator is to calculate the state vector (attitude) based on a set of observations (sensors) [6]. In other words, it is an algorithm capable of processing measurements to produce, according with a given criterium, a minimum error estimate of the state of a system. In this paper, the real-time estimator used to estimate the satellite attitude is a variant of the Kalman filter, applied to problems that present some nonlinearity. This estimator is described as follows.

##### 4.1. Unscented Kalman Filter

The basic premise behind the Unscented Kalman Filter (UKF) is that it is easier to approximate a Gaussian distribution than it is to approximate an arbitrary nonlinear function. Instead of linearizing to first order using Jacobian matrices, the UKF uses a rational deterministic sampling approach to capture the mean and covariance estimates with a minimal set of sample points. The nonlinear function is applied to each point, in turn, to yield a cloud of transformed points. The statistics of the transformed points can then be calculated to form an estimate of the nonlinearly transformed mean and covariance. We present an algorithmic description of the UKF omitting some theoretical considerations, left to [7, 8].

Consider the system model given by where is the state vector and is the measurement vector. We assume that the process noise and measurement-error noise are zero-mean Gaussian noise processes with covariances given by and , respectively. In this work the state vector at time is defined by the Euler angles and gyro biases:

Performing the necessary simplifications (small Euler angles) in the set of (2.2), the attitude angles and gyro angular velocity biases are modelled as follows:

Given the state vector at step , we compute a collection of sigma-points, stored in the columns of the sigma point matrix , where is the dimension of the state vector. In our case, , so is a matrix. The columns of are computed by in which , is the th column of the matrix square root of .

Once computed, we perform the prediction step by first predicting each column of through time by using where is differential equation defined in (2.2) or (4.3). In our formulation, we perform a numerical Runge-Kutta integration.

With being calculated, the *a priori* state estimate is
where are weights defined by

As the last part of the prediction step, we calculate the *a priori* error covariance with
where is the process error covariance matrix, and the weights are defined by
where is a scaling parameter which determines the spread of the sigma points and is a parameter used to incorporate any prior knowledge about the distribution of [9].

To compute the correction step, we first must transform the columns of through the measurement function to . In this way

With the mean measurement vector , we compute the *a posteriori* state estimate using
where is the Kalman gain. In the UKF formulation, is defined by
where
where represents the measurement error covariance matrix.

Finally, the last calculation in the correction step is to compute the *a posteriori* estimate of the error covariance given by

#### 5. Results

Here, the results and the analysis from the algorithm developed to estimate the attitude are presented. To validate and to analyze the performance of the estimators, real sensors data from the CBERS-2 satellite were used (see [10, 11]). The CBERS-2 satellite was launched on October 21, 2003. The measurements are for the month of April 2006, available to the ground system at a sampling rate of about 8.56 sec. The algorithm was implemented through MATLAB software. To check the performance the UKF, their results were compared with the estimated attitude by the more conventional EKF (Extended Kalman Filter), considering the following set of initial conditions:(i)initial attitude: deg;(ii)initial *bias* of gyro: deg/hour, and deg/hour, deg/hour;(iii)initial covariance (): = (0.5 deg)^{2} (error related to the attitude), and = (1 deg/hour)^{2} (error related to the drift of gyro);(iv)observation noise covariance (): = (0.3 deg)^{2} (sun sensor), are = (0.03 deg)^{2} (earth sensor);(v)dynamic noise covariance (): = (0.1 deg)^{2} (noise related to the attitude), = (0.01 deg/hour)^{2}, and = (0.005 deg/hour)^{2} (noise related to the drifting of gyro).

The real measurements obtained by the attitude sensors (digital sun sensors, infrared Earth sensors, and gyroscopes) are shown in Figure 1.

**(a)**

**(b)**

**(c)**

In Figures 2 and 3 are observed the behavior of attitude and the *biases* of gyro during the period analyzed. The average estimated values for the axes of *roll* and *pitch*, considering the Unscented Kalman Filter, are in the order of −0.47 deg and −0.45 deg, respectively, and their standard deviations are about 0.02 deg. For the *yaw* axis the estimate seems not to behave randomly and its average estimated value is about −1.47 deg with standard deviation 0.3 deg. The attitude estimated by the extended Kalman filter had their values for the axes *roll* and *pitch* in the order of about −0.49 deg and −0.43 deg with standard deviation about 0.05 deg. For the axis *pitch*, its average value is −1.42 deg and standard deviation is 0.36 deg.

**(a)**

**(b)**

**(c)**

**(a)**

**(b)**

**(c)**

Figures 4 and 5 present the standard deviations for both estimators for the attitude and the bias of the gyro. It is observed that the attitude standard deviations and the standard deviations of the gyro bias decrease with a tendency to stabilize around a value for both filters. However, the graphs show the superiority of UKF, because in most cases it works within a range of protection better than the EKF.

**(a)**

**(b)**

**(c)**

**(a)**

**(b)**

**(c)**

In Figures 6 and 7, we can see that the residues of sun sensors and Earth sensors have the same behavior for both estimators. For the Earth sensors, the residuals obtained by the both estimators are smaller and show a tendency to zero mean. However, the residues of UKF are still lower, being at about −0.009 deg for and 0.004 deg for . Already the residues of the EKF are approximately 0.01 deg and −0.027 deg for and , respectively.

**(a)**

**(b)**

**(a)**

**(b)**

These results seem consistent because in this case it is not possible to compare the estimated values with true values, since these values are not known.

#### 6. Final Comments

In this paper, the Unscented Kalman Filter estimator applied in nonlinear systems was presented for use in real-time attitude estimation. The main objective was to estimate the attitude of a CBERS-2 like satellite, using real data provided by sensors that are on board of the satellite. To verify the consistency of the estimator, the attitude was estimated by two different methods. The usage of real data from on-board attitude sensors poses difficulties like mismodelling, mismatch of sizes, misalignments, unforeseen systematic errors, and postlaunch calibration errors. However, it is observed that, although the EKF and UKF have roughly the same accuracy, the UKF leads to a convergence of the state vector faster than the EKF. This fact was expected, since the UKF prevents the linearizations needed for EKF, when the system has some nonlinearity in their equations.