# In-Orbit Attitude Determination of the UVSQ-SAT CubeSat Using TRIAD and MEKF Methods
## 2 UVSQ-SAT Attitude Determination Considerations
### Theoretical Approach of the Method  
The instruments and the reference frames are described in the previous section. It is now possible to present the different inputs required for attitude determination. Those inputs are the nadir direction, the Sun line-of-sight (LOS), the magnetic field vectors, and the gyrometer data. We suppose that those vectors are defined as follows (Equation (6a-c)):  
\[\mathbf{\hat{S}}(\mathbf{t}) =\mathbf{S}(\mathbf{t})+\boldsymbol{\eta}_{\mathbf{S}}(\mathbf{t}) \tag{6a}\] \[\mathbf{\hat{N}}(\mathbf{t}) =\mathbf{N}(\mathbf{t})+\boldsymbol{\eta}_{\mathbf{N}}(\mathbf{t})\] (6b) \[\mathbf{\hat{B}}(\mathbf{t}) =\mathbf{B}(\mathbf{t})+\boldsymbol{\eta}_{\mathbf{B}}(\mathbf{t}) \tag{6c}\]  
where \(\mathbf{\hat{S}}(\mathbf{t})\), \(\mathbf{\hat{N}}(\mathbf{t})\), and \(\mathbf{\hat{B}}(\mathbf{t})\) are the Sun LOS, the nadir direction, and the magnetic field vectors retrieved from the instruments on-board the satellite, respectively. \(\mathbf{S}(\mathbf{t})\), \(\mathbf{N}(\mathbf{t})\) and \(\mathbf{B}(\mathbf{t})\) are the true Sun LOS, the true nadir direction, and the true magnetic field vectors, respectively. \(\boldsymbol{\eta}_{\mathbf{S}}(\mathbf{t})\), \(\boldsymbol{\eta}_{\mathbf{N}}(\mathbf{t})\), and \(\boldsymbol{\eta}_{\mathbf{B}}(\mathbf{t})\) are the three zero-mean Gaussian noises that we assume for the three vectors. According to Table 1, the use of a nadir direction in an eclipse to determine the satellite attitude is not common. In an eclipse, Table 1 shows that the most common idea is to rely only on magnetometer and gyrometer measurements. Indeed, we know that the gyrometer can be very noisy and inaccurate [21]. However, the UVSQ-SAT is equipped with the infrared sensors presented in Section 2. Thus, those infrared sensors will help to determine the nadir direction from the terrestrial infrared radiations.  
The three-axis rate from the gyrometer is defined with \(\hat{\boldsymbol{\omega}}(\mathbf{t})\) as follows (Equation (7a,b)):  
\[\hat{\boldsymbol{\omega}}(\mathbf{t})=\boldsymbol{\omega}(\mathbf{t})+ \boldsymbol{\beta}(\mathbf{t})+\boldsymbol{\eta}_{\omega}(\mathbf{t}) \tag{7a}\] \[\hat{\boldsymbol{\beta}}(\mathbf{t})=\boldsymbol{\eta}_{\beta}( \mathbf{t}) \tag{7b}\]  
where \(\boldsymbol{\omega}(\mathbf{t})\) is the true rate, \(\boldsymbol{\beta}(\mathbf{t})\) is the drift, and \(\boldsymbol{\eta}_{\omega}(\mathbf{t})\) and \(\boldsymbol{\eta}_{\beta}(\mathbf{t})\) are the zero-mean Gaussian noises.  
As the measurements from the gyrometer are conducted with respect to an inertial reference frame, this is defined as (Equation (8))  
\[\boldsymbol{\omega}_{\text{{B/I}}}=\boldsymbol{\omega}_{\text{{B/OC}}}+ \boldsymbol{\omega}_{\text{{OC/I}}} \tag{8}\]  
where \(\boldsymbol{\omega}_{\text{{OC/I}}}\) is the rate from the body frame with respect to the inertial frame that is equal to \(\boldsymbol{\omega}_{0}\) the orbital angular velocity along the axis orthogonal to the orbital plane. \(\boldsymbol{\omega}_{0}\) is computed from the mean motion given at each time. This information is contained in a list of orbital elements for a given point in time called a two-line element set (retrieved by the NORAD). The angular velocity with respect to the orbital frame is computed at each time given the attitude matrix at that time with respect to the orbital frame in Equation (9).  
\[\boldsymbol{\omega}_{\text{{B/O}}}=\boldsymbol{\omega}_{\text{{B/I}}}-A_{ \text{O}\to\text{B}}\boldsymbol{\omega}_{\text{{O/I}}}=\boldsymbol{\omega}_{ \text{{B/I}}}-A_{\text{O}\to\text{B}}\boldsymbol{\omega}_{0} \tag{9}\]where \(A_{O\xrightarrow{}B}\) is the rotation matrix from the local orbital frame to the body reference frame. The changes in the reference frame presented are directly related to the description of the reference frames in Section 2.2.1. The choice of the inertial reference frame to use has been meticulously made to facilitate the calculations in Equation (9).