1 Introduction

The knowledge of the satellite space orientation (attitude) is important for a satellite mission. Every spacecraft carries a payload that must be directed in some way, and the performance of this payload will depend directly on the ability to know the spacecraft attitude. Therefore, the choice of appropriate determination methods of the attitude is fundamental for the missions. The attitude determination process must take into account a suite of attitude sensors of the appropriate accuracy and a attitude determination method that uses the data from those sensors. The used methods of attitude estimation include the filters and state smoothing. The problem of state smoothing is a logical extension of the filtering, which is the class methods to compute the best estimate of the state of a system given by the dynamics model of the system and a set of observations. For a given fixed time interval, \(t_{1},t_{2},\ldots ,t_{N}\), the main difference between optimal filtering and state smoothing is that the first type estimators allow to estimate the best state at time \(t_{k}\) given all the observations from \(t_{1}\) to \(t_{k}\). However, the state smoothers allow to find the best estimate at time \(t_{k}\) using all the observations corresponding to the analyzed interval from \(t_{1}\) to \(t_{N}\) with \(t_{k} \le t_{N}\), as shown in Fig. 1.

Fig. 1
figure 1

Adapted from Sarkka (2013)

Illustration of the filtering method versus smoothing method.

This article concentrates the studies on optimal techniques of estimation applied to nonlinear problems. Due to nonlinearity of the dynamic system and the observations, the estimator used to determine the “forward” estimates in time is the unscented Kalman filter—UKF (Crassidis and Markley 2003). The estimated results are saved and used by the Rauch–Tung–Striebel smoother—RTS (Sarkka 2013) of fixed-interval (“backwards” estimate in time) in order to obtain the refined state estimate. The fixed-interval smoothing is usually used for offline data reduction to obtain refined estimates of better quality than those obtained by online filters, since they incorporate the information contained in all measurements in the range.

2 Formulation of the attitude estimation problem

Consider the following nonlinear discrete-time stochastic system (Psiaki and Wada 2007)

$$\begin{aligned} { \left. \begin{array}{llllll} \dot{\mathbf {x}}_{k+1} &{}=&{} \mathbf {f}_{k}(\mathbf {x}_{k},\mathbf {\eta }_{k}), &{} &{} k = 0,1,\ldots N-1 \\ \mathbf {y}_{k+1} &{}=&{} \mathbf {h}_{k+1}(\mathbf {x}_{k+1},\mathbf {\nu }_{k+1}), &{} &{} k = 0,1,\ldots N-1\\ \end{array} \right. } \end{aligned}$$
(1)

where \(\mathbf {x}_{k}\) is the n-dimensional system state vector at time \(k \), \(\mathbf {f}_{k}\) is the n-dimensional dynamic nonlinear transition function, \(\mathbf {y}_{k+1}\) is the m-dimensional nonlinear sensor measurement vector at time \(k +1\), \(\mathbf {h}_{k+1}\) is the m-dimensional nonlinear measurement function, N is the terminal sample, and \(\mathbf {\eta }_{k}\) and \(\mathbf {\nu }_{k+1}\) represent the process and measurement noise with Gaussian white noise and covariances given by \(\mathbf {Q}\) and \(\mathbf {R}\), respectively.

In this paper, the system given by Eq. (1) will be associated with the characteristics of the CBERS-2 satellite. The attitude of CBERS-2 satellite is stabilized in three axes and can be described with respect to the orbital system \(Ox_{o}y_{o}z_{o}\). 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, and is represented by Euler angles \(\phi \), \(\theta \) and \(\psi \), respectively. In this work, the state vector will be composed of attitude angles (\(\phi \), \(\theta \), \(\psi \)) and, due to the use of gyroscope observations (Rate Integration Gyros), by the components of the gyros biases (\(\varepsilon _{x}\), \(\varepsilon _{y}\), \(\varepsilon _{z}\)). The use of gyros measurements allows the substitution of the dynamic equations by simple kinematic equations which, for the CBERS-2 satellite, are represented by Fuming and Kuga (1999):

$$\begin{aligned} { \left[ \begin{array}{c} \dot{\phi }\\ \dot{\theta }\\ \dot{\psi }\\ \end{array}\right] =\left[ \begin{array}{c@{\quad }c@{\quad }c} 1 &{} S(\phi )T(\theta ) &{} C(\phi )T(\theta )\\ 0 &{} C(\phi ) &{} -S(\phi )\\ 0 &{} S(\phi )/C(\theta ) &{} C(\phi )/C(\theta )\\ \end{array} \right] \left\{ \left[ \begin{array}{c} \omega _{x}\\ \omega _{y}\\ \omega _{z}\\ \end{array} \right] -R\left[ \begin{array}{c} 0\\ -\omega _{0}\\ 0\\ \end{array} \right] \right\} } \end{aligned}$$
(2)

where \(\omega _{0}\) is the orbital angular velocity, \(\omega _{x}\), \(\omega _{y}\), \(\omega _{z}\) are the components of the angular velocity on the satellite system Oxyz, and R is the transition matrix from the orbit reference coordinate system to the satellite body coordinate system obtained by a rotation sequence 321 (rotation of angles \(\psi \) of the axis \(z_{o}\), rotation of angles \(\theta \) of the axis \(y'\) and rotation of angles \(\phi \) of the axis x).

For the specific case of the CBERS-2 satellite, it is assumed that \(\phi \) and \(\theta \) are small angles, making it possible to perform simplifications (type: \(a\approx 0\), \(\sin (a)\approx a\), \(\cos (a)\approx 1\)) in Eq. (2). In this way, the equation of the state that composes the system represented in Eq. (1) is defined by

$$\begin{aligned} { \left[ \begin{array}{c} \dot{\phi }\\ \dot{\theta }\\ \dot{\psi }\\ \dot{\varepsilon }_{x}\\ \dot{\varepsilon }_{y}\\ \dot{\varepsilon }_{z}\\ \end{array}\right] _{k+1}=\left[ \begin{array}{c} \omega _{0} \sin \psi + \omega _{x} + \theta \omega _{z}\\ \omega _{0} \cos \psi + \omega _{y} + \phi \omega _{z}\\ \omega _{0} (\theta \sin \psi - \phi \cos \psi ) + \omega _{z} + \phi \omega _{y}\\ 0\\ 0\\ 0\\ \end{array} \right] _{k}+\eta _{k}\ } \end{aligned}$$
(3)

To ascertain the attitude of an artificial satellites, it is necessary to use the attitude sensors. In this work, real measurements of Infrared Earth Sensors (IRES) and Digital Solar Sensors (DSS) are used. The IRES sensors measure the modifications of the angles \(\phi \) (\(\phi _E\)) and \(\theta \) (\(\theta _E\)) and their observations are modeled by Garcia et al. (2016)

$$\begin{aligned} { \left. \begin{array}{ccccc} \phi _{E} &{}=&{} \phi &{}+&{} \nu _{\phi _{E}}\\ \theta _{E} &{}=&{} \theta &{}+&{} \nu _{\theta _{E}}\\ \end{array} \right. } \end{aligned}$$
(4)

The DSS sensors indirectly measure the changes in the angles \(\psi \) (\(\alpha _\psi \))and \(\theta \) (\(\alpha _\theta \)) of the satellite. Such observations are modeled by

$$\begin{aligned} { \alpha _{\psi }=\tan ^{-1}\left( \frac{-S_{y}}{S_{x}\cos (60^{\circ })+S_{z}\cos (150^{\circ })}\right) +\nu _{\alpha _{\psi }} } \end{aligned}$$
(5)

when \(|S_{x}\cos (60^{\circ })+S_{z}cos(150^{\circ })|\ge \cos (60^{\circ })\), and

$$\begin{aligned} { \alpha _{\theta }=24^{\circ }-\tan ^{-1}\left( \frac{S_{x}}{S_{z}}\right) +\nu _{\alpha _{\theta }} } \end{aligned}$$

when \(\left| 24^{\circ }-\tan ^{-1}\left( \frac{S_{x}}{S_{z}}\right) \right| <60^{\circ }\), with \(S_x\), \(S_y\) and \(S_z\) being the components of the unit vector associated with the sun vector in the satellite system (Garcia et al. 2016).

The measurement equation that composes the system represented in Eq. (1) is defined by

$$\begin{aligned} { \left[ \begin{array}{c} \phi _E\\ \theta _E\\ \alpha _\psi \\ \alpha _\theta \\ \end{array}\right] _{k+1}=\left[ \begin{array}{c} \phi \\ \theta \\ \arctan \left( {\frac{-\,S_y }{S_x \,\cos \,60^{\circ }\,\,+\,\,S_z \,\cos \,150^{\circ }}} \right) \\ 24^{\circ }\,\,-\,\,\arctan \left( {\frac{S_x }{S_z }} \right) \\ \end{array} \right] _{k+1} + \nu _{k+1} }. \end{aligned}$$
(6)

3 Bayesian optimal filtering and smoothing equations

In general, the estimation problems involve the choice of algorithms which use the measurements obtained before and at the current time for computing the best estimate of the current state. This feature makes the algorithm able to obtain estimates in real time. However, in some cases there is no need for the algorithm to work online and the main concern is to get an estimate of the high-precision state. To do this, the smoothing uses all the measures of the interval considered to offer superior accuracy in the estimate of each instant.

Considering the superiority of the UKF compared to the other estimators (Garcia et al. 2016), and the problem of estimation of nonlinear state, in this paper will be used the combination of two techniques to estimate the attitude with high precision of a satellite. Initially, the UKF is used to obtain the forward state estimate in time. The UKF output is saved and used as input by the RTS fixed-range smoothing, which recalculates the estimate backwards in time. The algorithm that uses the combination of these two estimation techniques will be called Unscented Rauch–Tung–Striebel smoother (URTS). The formulations involved in the UKF and URTS algorithms will be presented below.

3.1 Forward estimation with unscented Kalman filter

The UKF uses a deterministic sampling approach where the state is represented using a minimal set of sample points (Wan and van der Merwe 2004). The filter is initialized with information from \(\hat{\mathbf {x}}_{0}\), \(\hat{\mathbf {P}}_{0}\), \(\mathbf {R}\) and \(\mathbf {Q}\) at the initial time \(k=0\). The next step of the filter is to propagate the state to the next instant and update the propagated state with the measurements of the current instant. This process is performed from \(k = 1,\ldots ,N\).

Before beginning the step of propagating the state, the initial sigma points are distributed as follows (Garcia et al. 2016; Wan and van der Merwe 2004):

$$\begin{aligned} { \left. \begin{array}{ccccc} \hat{{\varvec{\chi }}}_{0}^{(0)} &{}=&{} {\hat{\mathbf{x}}}_{0} &{} &{} \\ \hat{{\varvec{\chi }}}_{0}^{(i)} &{}=&{} {\hat{\mathbf{x}}}_{0} &{} \pm &{} \left( \sqrt{(n+\lambda ){\hat{\mathbf{P}}}_{0}}_{(i)}\right) i=1,\ldots 2n \\ \end{array} \right. } \end{aligned}$$
(7)

where \(\lambda \) \(\epsilon \) \(\mathbf {R}\), \((\sqrt{(n+\lambda )\mathbf {P}_{0}}_{i})\) is the ith column of the matrix square root of \((n+\lambda )\mathbf {P}_{0}\).

The next step of the filter is to propagate the sigma points through the dynamic model, given in Eq. (1):

$$\begin{aligned} { \left. \begin{array}{ccccc} \dot{\bar{{\varvec{\chi }}}}_{k}^{(i)} &{}=&{} f(\hat{{\varvec{\chi }}}_{k-1}^{(i)}) &{} i=0,\ldots 2n&{}\\ \mathbf {Y}_{k}^{(i)} &{}=&{} h(\bar{{\varvec{\chi }}}_{k}^{(i)}) &{} &{} \end{array} \right. } \end{aligned}$$
(8)

The state and measurement vector propagated and its covariances are obtained by

$$\begin{aligned} \bar{\mathbf {x}}_{k}= & {} \frac{\lambda }{(n+\lambda )}\bar{{\varvec{\chi }}}_{k}^{(0)}+ \sum _{i=1}^{2n} \frac{1}{2 (n+\lambda )}\bar{{\varvec{\chi }}}_{k}^{(i)} i=1,\ldots 2n \end{aligned}$$
(9)
$$\begin{aligned} \bar{\mathbf {y}}_{k}= & {} \frac{\lambda }{(n+\lambda )}\mathbf {Y}_{k}^{(0)}+\sum _{i=1}^{2n}\frac{1}{2(n+\lambda )} \mathbf {Y}_{k}^{(i)} \end{aligned}$$
(10)
$$\begin{aligned} \bar{\mathbf {{P}}}_{k}= & {} \frac{\lambda }{(n+\lambda )}[\bar{{\varvec{\chi }}}_{k}^{(0)}-\bar{\mathbf {x}}_{k}][\bar{{\varvec{\chi }}}_{k}^{(0)}-\bar{\mathbf {x}}_{k}]^\mathrm{T}+\sum _{i=1}^{2n}\frac{1}{2(n+\lambda )}[\bar{{\varvec{\chi }}}_{k}^{(i)}-\bar{\mathbf {x}}_{k}][\bar{{\varvec{\chi }}}_{k}^{(i)}-\bar{\mathbf {x}}_{k}]^\mathrm{T}+\mathbf {Q} \nonumber \\ \end{aligned}$$
(11)
$$\begin{aligned} \mathbf {P}_{k}^{yy}= & {} \frac{\lambda }{(n+\lambda )}[\mathbf {Y}_{k}^{(0)}-\bar{\mathbf {y}}_{k}][\mathbf {Y}_{k}^{(0)}-\bar{\mathbf {y}}_{k}]^\mathrm{T}+\sum _{i=1}^{2n} \frac{1}{2(n+\lambda )} [\mathbf {Y}_{k}^{(i)} - \bar{\mathbf {y}}_{k}][\mathbf {Y}_{k}^{(i)} - \bar{\mathbf {y}}_{k}]^\mathrm{T} + \mathbf {R}_{k} \nonumber \\ \end{aligned}$$
(12)
$$\begin{aligned} \mathbf {P}_{k}^{xy}= & {} \frac{\lambda }{(n+\lambda )}[\bar{{\varvec{\chi }}}_{k}^{(0)}-\bar{\mathbf {x}}_{k}][\mathbf {Y}_{k}^{(0)}-\bar{\mathbf {y}}_{k}]^\mathrm{T}+\sum _{i=1}^{2n} \frac{1}{2(n+\lambda )} [\bar{{\varvec{\chi }}}_{k}^{(i)}-\bar{\mathbf {x}}_{k}][\mathbf {Y}_{k}^{(i)} - \bar{\mathbf {y}}_{k}]^\mathrm{T} \end{aligned}$$
(13)

The step of updating the filter is obtained by calculating the gain matrix of Kalman \(\mathbf {K}\), given by

$$\begin{aligned} { \mathbf {K}_{k}=\mathbf {P}_{k}^{xy} [\mathbf {P}_{k}^{yy}]^{-1} } \end{aligned}$$
(14)

Then, the state estimate and state error covariance updates are

$$\begin{aligned} \hat{\mathbf {x}}_{k}= & {} \bar{\mathbf {x}}_{k}+\mathbf {K}_{k}(\mathbf {y}_{k}-\bar{\mathbf {y}}_{k}) \end{aligned}$$
(15)
$$\begin{aligned} {\hat{\mathbf{P}}}_{k}= & {} \bar{\mathbf {{P}}}_{k} - \mathbf {K}_{k}\mathbf {P}_{k}^{yy}\mathbf {K}_{k}^{T} \end{aligned}$$
(16)

The sigma-points are scattered again from the estimated state and covariance for the next step of the filter by

$$\begin{aligned} { \left. \begin{array}{ccccc} {\varvec{\hat{\chi }}}_{k}^{(0)} &{}=&{} {\hat{\mathbf{x}}}_{k} &{} &{} \\ {\varvec{\hat{\chi }}}_{k}^{(i)} &{}=&{} {\hat{\mathbf{x}}}_{k} &{} \pm &{} (\sqrt{(n+\lambda ){\hat{\mathbf{P}}}_{k}}_{(i)}) i=1,\ldots 2n \\ \end{array} \right. } \end{aligned}$$
(17)

As the objective of this paper is to estimate the state through smoothing processes, then in addition to the standard UKF equations will also be calculated the cross covariance matrix \(\mathbf {D}\). This matrix takes into account the estimated state at the current step and at the previous step. The cross covariance is obtained by Psiaki and Wada (2007):

$$\begin{aligned} { \mathbf {D}_{k}= \frac{\lambda }{(n+\lambda )}[\hat{{\varvec{\chi }}}_{k-1}^{(0)}-\hat{\mathbf {x}}_{k-1}][\bar{{\varvec{\chi }}}_{k}^{(0)}-\bar{\mathbf {x}}_{k}]^\mathrm{T}+\sum _{i=1}^{2n} \frac{1}{2(n+\lambda )} [\hat{{\varvec{\chi }}}_{k-1}^{(i)}-\hat{\mathbf {x}}_{k-1}][\bar{{\varvec{\chi }}}_{k}^{(i)}-\bar{\mathbf {x}}_{k}]^\mathrm{T} }\nonumber \\ \end{aligned}$$
(18)

During the estimation process with the UKF, the vectors \(\bar{\mathbf{x }}_{k}\), \(\hat{\mathbf{x }}_{k}\), and matrices \(\bar{\mathbf{P }}_{k}\), \(\hat{\mathbf{P }}_{k}\), \(\mathbf D _{k}\) are stored to serve as input to the smoothing process.

3.2 Backward estimation with RTS smoother

The RTS smoother is applied after the measurements have been processed forward by the UKF. The smoother is initialized from the last time step considering the following initial conditions: \(\mathbf x _{N}^{s}=\hat{\mathbf{x }}_{N}\), \(\mathbf P _{N}^{s}=\hat{\mathbf{P }}_{N}\). The recursive process runs backwards for \(k = N-1,\ldots ,0\), and computes the smoother gain \(\mathbf K _{k}^{s}\), the smoothed mean \(\mathbf x _{k}^{s}\) and the covariance \(\mathbf P _{k}^{s}\) as follows (Sarkka 2013):

$$\begin{aligned} \begin{aligned} \mathbf {K}_{k}^{s}&= \mathbf {D}_{k+1}[\bar{\mathbf {P}}_{k+1}]^{-1} \\ \mathbf {x}_{k}^{s}&= {\hat{\mathbf{x}}}_{k+1} + \mathbf {K}_{k}^{s}(\mathbf {x}_{k+1}^{s} - \bar{\mathbf {{x}}}_{k+1})\\ \mathbf {P}_{k}^{s}&= {\hat{\mathbf{P}}}_{k+1} + \mathbf {K}_{k}^{s}(\mathbf {P}_{k+1}^{s} - \bar{\mathbf {{P}}}_{k+1})[\mathbf {K}_{k}^{s}]^\mathrm{T} \end{aligned} \end{aligned}$$
(19)

4 Results using a truth-model simulation

A truth-model simulation has been used to provide data of testing for comparison of the performance between two estimation methods: Unscented Kalman filter and Unscented RTS Smoother. The simulations of ephemeris and telemetry have been carried out using as reference the CBERS-2 model (Carrara 2015) and the estimations were made using the Matlab software. The CBERS-2 has polar sun-synchronous orbit with an altitude of 778 km, crossing Equator at 10:30 AM in descending direction, frozen eccentricity and perigee at 90\(^\circ \) providing a global coverage every 26 days. The attitude sensors available are two DSS (Digital Sun Sensors), two IRES (Infrared Earth Sensor), and one triad of mechanical gyros. Table 1 shows the values used in the initialization of the UKF, as well as some parameters used in the simulation of the data.

Table 1 Initial conditions and simulation parameters

To evaluate the URTS smoothing behavior with respect to the UKF filter in attitude estimation problems involving non-linear systems, the estimated state and their respective variance are shown in Figs. 234 and 5. Figure 2 shows the attitude angles estimated (\(\phi \) = roll, \(\theta \) = pitch, \(\psi \) = yaw) by the UKF and the URTS smoother. It is observed that, at the beginning of the estimation process, the difference between the smoothed values and the real values is lower than that of the filtered values, but at the end of the estimation the estimated attitude and smoothed attitude tend to be of the same order of magnitude. To evaluate the accuracy of the estimated attitude obtained by smoothing and filtering, Table 2 shows the RMSE (Root Mean Squared Error) performance. The RMSE indicates how close the observed values are to the estimated values by model. In Table 2, the URTS smoother presented lower values of RMSE indicating better fit. RMSE is a good measure of how accurately the model predicts the response, and is an important criterion for fitting if the main purpose of the model is prediction. Figure 3 shows the estimated values for the gyro bias in the x, y, and z axes obtained by the filter and smoother, in addition to the true value obtained from the simulation. Figure 3 and Table 2 confirm the superiority of the URTS smoother because during the estimation period it remained closer to the true values.

Fig. 2
figure 2

Comparison of the attitude values: true attitude, attitude estimated by UKF and attitude estimated by URTS

Fig. 3
figure 3

Comparison of the gyro bias values: true gyro bias, gyro bias estimated by UKF and gyro bias estimated by URTS

Fig. 4
figure 4

UKF filter and URTS smoother variances for attitude

Fig. 5
figure 5

UKF filter and URTS smoother variances for gyro bias

Finally, a quantitative analysis of the processing time spent by the CPU in the estimation process is summarized in Table 3. The values shown in Table 3 were obtained from the implementation of the UKF and URTS algorithms in MATLAB language in an Intel Core i3 with 4GB of dynamical memory, running Windows 7, 64 bits version. For a more reliable estimation of the processing time, the average of 100 iterations for each algorithm was calculated. Note that, even with the increase in the number of observations of the sensors, the increase in CPU expense via URTS (UKF + RTS smoother) is approximately \(2\%\) of the time required to estimate the attitude via UKF. This corroborates the efficiency of the softener due to the precision gain of the estimates and the consequent consistency in the reconstitution of the estimated state.

Table 2 RMSE values of attitude and gyro bias

Figures 4 and 5 illustrate the convergence of covariances of the attitude and gyro bias during the estimation process for UKF filter and URTS smoother. The covariance of the smoother is always smaller than that of the filter, except for the final step, where the covariances are the same (initial condition of the smoother). The covariance of the gyro bias has imperceptible variation for both estimators as shown in Fig. 5, but it can still be affirmed about its convergence in the considered period. In the first step of the estimation, the covariance on the x-axis for the filter was 0.5000 deg/h, while for the softener was 0.4999 deg/h. The same is observed for the other axes.

Table 3 Estimated CPU time for processing different numbers of observations performed by the sensors using the UKF and URTS estimators

5 Conclusions

The purpose of this article was to analyze the efficiency of the attitude estimation by combining the results obtained by the unscented Kalman filter with the results obtained by the RTS smoothing, when a nonlinear state model is considered. The Unscented Kalman filter has been shown to be superior to the other nonlinear estimators regarding the processing time and accuracy of the estimated values, as seen in Garcia et al. (2016). The results obtained in this work showed that the combination of the sigma-points with the state smoothing technique achieves significant precisions in relation to the results obtained only by the UKF filter. This happens because the smoothing technique allows it to exploit the availability of additional data that comes after the sampling time at which a given state estimate applies. With the obtained results, it is concluded that in operations that do not require real-time requirements, the use of smoothing can be a useful resource for refinement of the estimates, thus allowing the reconstitution of the attitude with greater precision.