{'fraction_non_alphanumeric': 0.05154173655012256, 'fraction_numerical': 0.02219068507289382, 'mean_word_length': 3.862923462986198, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Novel Attitude Representation in View of Spacecraft Attitude Reconstruction using Temperature Data

There are various different attitude representations that describe the orientation of a rigid body in space and allow the transformation between different coordinate systems. Among others, they differ in number of variables, uniqueness of the representation and their continuity. However, in spite of some of them being based on angles, none of them constitutes a simple representation of an angle between two arbitrary vectors. We tackle this issue by proposing a novel attitude representation that directly incorporates the desired angle. The usefulness of this representation is demonstrated in the attitude reconstruction from temperature data, which then leads to an order reduction of a non-linear system.


INTRODUCTION
The attitude defines the orientation of a rigid body in space. The three dimensional set of attitudes is the set of all 3 × 3 orthogonal matrices with determinant equal to one. Since this space is non-euclidean and it uses nine parameter to define a set of dimension three, there exists a number of other attitude representations Shuster et al. (1993); Chaturvedi et al. (2011);Stuelpnagel (1964); Markley and Crassidis (2014); Mortensen (1968); Wie and Barba (1985); Wen and Kreutz-Delgado (1991). Finding the most suitable representation depends on application specific requirements, e.g. the number of variables, uniqueness and the existence of singularities. Attitude representations of dimension three such as Euler angles have the advantage of using the minimal number of variables. However, they suffer from singularities which in this context is a phenomenon called gimbal lock. Furthermore, the same attitude can be described by different Euler angle representations and they do not establish a continuous evolution of these angles if multiple full rotations occur. Quaternions tackle these issues by introducing a fourth variable and a norm constraint. This fixes the continuity and singularity issue. Also, every attitude is represented by (only) exactly two quaternions with opposite sign. There exist many other attitude representations, each with benefits and drawbacks with respect to the points previously discussed. The choice of an attitude representation often is a matter of preference.
The second author gratefully acknowledges the financial support from European Union Horizon 2020 research and innovation program, Marie Skłodowska-Curie grant agreement No. 824046.
In this paper, we introduce a novel attitude representation which facilitates finding the solution of a non-linear system incorporating quantities that depend on the angle of two vectors given in different frames. The representation is motivated by the temperature evolution of a spacecraft as it depends on the angle between the surface normal and the source of heat. This evolution is used in a variety of works to determine the attitude of the spacecraft Labibian et al. (2017Labibian et al. ( , 2018; Khaniki and Karimian (2016). The proposed transformation simplifies the reconstruction. The motivating system is introduced in Section 3. The new transformation is derived in Section 4. Major properties are discussed in Section 5. The usefulness is shown resorting to the motivating system in Section 6.

NOTATION
Throughout this paper we use quaternions and their algebra to introduce the new attitude representation. Most of the notation is borrowed from Markley and Crassidis (2014). Let denote the i-th unit sphere with · the Euclidean norm. Let I n denote the identity matrix of dimension n ∈ N and e i the i-th unity vector of appropriate size. With a slight abuse of notation, we let q denote either a unit quaternion, i.e. q ∈ S 3 , or the function q : S 2 × (−π, π] → S 3 mapping a rotation vector r ∈ S 2 and angle φ ∈ (−π, π] onto the corresponding quaternion, i.e. q(r, φ) := r 1 sin( φ 2 ) r 2 sin( φ 2 ) r 3 sin( φ 2 ) cos( φ 2 ) .
Let q 1:3 denote the first three entries of q and q 4 the fourth entry. We extend the definition to arbitrary vectors r ∈ R 3 with q(r, φ) := q r r , φ . The matrices represent the cross product matrix and the matrix used later to introduce the quaternion multiplication and the quaternion dynamics. We denote by A the function which maps any attitude representation onto its rotation matrix allowing to transform a vector from one coordinate system into another. In particular, we use symbol A as a function of q with A(q) := (q 2 4 − q 1:3 2 )I 3 − 2q 4 [q 1:3 ×] + 2q 1:3 q 1:3 (1) and also as a function of r ∈ R 3 and φ ∈ (−π, π], i.e. A(r, φ) := A(q(r, φ)). A (q) marks the transpose of A(q).
(7) Finally, we write arccos to denote the inverse of the cosine function with the image [0, π].

MOTIVATION: ATTITUDE RECONSTRUCTION USING TEMPERATURE MEASUREMENTS
Determining the position or the attitude of a spacecraft based on temperature data is a vivid subject of research Labibian et al. (2017Labibian et al. ( , 2018; Khaniki and Karimian (2016); Gourabi et al. (2019). We focus on the problem of attitude estimation and illustrate the advantages of the transformation to be proposed by considering an earth orbiting spacecraft in the earth's shadow. We follow the notations and models used in Posielek (2019) and shall consider only infrared irradiation acting on the spacecraft. Then the temperature dynamics are governed bẏ where γ, δ ∈ R are parameters, r ⊕ ∈ R is the earth mean radius, r(t) ∈ R 3 is the position of the spacecraft in earthcentered inertial frame (ECI), n ∈ S 2 is the normal of the spacecraft surface in body frame and T ∈ R is the temperature of the surface. The variable z denotes any attitude representation of the body frame with respect to the ECI. This might be any of the common representations such as quaternions, Euler angles or rotation matrices. The matrix A(z) ∈ SO 3 denotes the corresponding rotation matrix for the chosen attitude representation. In the following sections, we often omit the argument of r(t) to allow a more compact notation.
On the one hand, it can be seen that the common attitude representations yield cumbersome expressions for r A (z)n which incorporate in general all variables of z. Indeed, using standard quaternion variables (1) leads to On the other hand, expression r r A (z)n is equivalent to the cosine of the angle θ between r and n in ECI coordinates. Naturally, this raises the question if there exists an attitude representation (θ, ϑ 1 , ϑ 2 ) which incorporates θ as one of its variables in order to facilitate the dynamics by using r A (z) n = r cos(θ) instead of (9). This representation is introduced in the next section.

MAIN CONTRIBUTION: IRRADIATION ANGLE TRANSFORMATION
We derive the new attitude representation via the two mappings l r,n 1 : q → (θ, ϑ 1 , ϑ 2 ) and l r,n 2 : (θ, ϑ 1 , ϑ 2 ) → q. The superscripts shall suggest that these mappings change dependent on the vectors r and n. We define the mappings for normalised r, n ∈ S 2 . For not normalisedr,n ∈ R 3 , the mapping lr ,n 1 is defined by the mapping l r,n 1 with r =r r and n =n n . As motivated in the previous section, this representation shall incorporate θ as its first variable, which is the angle between two normalised vectors r, n ∈ S 2 given in different frames that form a linear space of dimension two. Since the attitude space is of dimension three, it is natural to define two additional angles ϑ 1 , ϑ 2 for allowing to describe every attitude by the three angles (θ, ϑ 1 , ϑ 2 ). For a reference attitude representation we use quaternions. Thus, in order to show that the three angles (θ, ϑ 1 , ϑ 2 ) are a valid attitude representation, we need to show that for every quaternion q there exists one unique angle triple (θ, ϑ 1 , ϑ 2 ). Then the corresponding mapping l r,n 1 is bijective and an inverse mapping l r,n 2 exists. Additionally, these mappings need to fulfill certain continuity conditions to render the attitude representation usable.
We start by deriving l r,n 2 : (θ, ϑ 1 , ϑ 2 ) → q, i.e. the function that maps every angle set (θ, ϑ 1 , ϑ 2 ) onto its quaternion q ∈ S 3 . These steps are illustrated in Figure 1 and define the function l r,n 2 . First the rotation axis v := n×r n×r and the angle φ := arccos(n r) are used to rotate n on r, i.e. (1). Then, a rotation is carried out to achieve the desired angle θ. Define the vector n θ,0 := A (e i × r, θ) A (v, φ) n (11) where e i is the first unit vector if r / ∈ span{e 1 }, otherwise it is the second unit vector. By definition and using (6), it is clear that r n θ,0 = cos(θ). The vector n θ,ϑ1 is defined by a rotation of ϑ 1 around the r axis, hence n θ,ϑ1 := A (r, ϑ 1 ) n θ,0 .
Note that we have so far deliberately not given the domain and the image of l r,n 2 . It is clear that the image is a subset of the quaternion space because the definition of l r,n 2 (θ, ϑ 1 , ϑ 2 ) is merely a result of a quaternion product which retains the norm condition. The domain is obtained when deriving the inverse transformation. Recall that the original motivation for these three angles is that the first angle θ is the angle between r and n transformed into the same frame as r . This property and a helpful equation for the rotation axis n θ,ϑ1 are shown in the following lemma. Lemma 2. The quaternion l r,n 2 (θ, ϑ 1 , ϑ 2 ) described by the rotation resulting from the three angles θ, ϑ 1 , ϑ 2 leads to an angle θ between r and transformed n, i.e. r A (l r,n 2 (θ, ϑ 1 , ϑ 2 )) n = cos(θ) (14) where A (l r,n 2 (θ, ϑ 1 , ϑ 2 )) n = n θ,ϑ1 .
It remains to show that for every attitude q, there is one unique angle set (θ, ϑ 1 , ϑ 2 ). We do so by introducing l r,n 1 and show that it is the inverse mapping of l r,n 2 . For a quaternion q we define the angle θ along (14) as θ := arccos(r A (q) n) . Consequently, the domain of θ is chosen to be [0, π]. It is clear that for n q := A (q) n the equations r n θ,0 = r n q (15a) n θ,0 n θ,0 = n q n q (15b) hold. Now we calculate the angle ϑ 1 rotating n θ,0 on n q around the rotation axis r, i.e. n q = A (r, ϑ 1 ) n θ,0 . Note that this equation is equivalent to (12). Since (15) holds, the angle ϑ 1 can be obtained using Rodrigues' formula ϑ 1 := atan2 (r × n θ,0 ) n q , n θ,0 n q − (r n θ,0 ) 2 . Then ϑ 1 is obtained using the atan2 function which maps the two arguments to an angle in (−π, π] and defines the domain of ϑ 1 . Note that for θ = 0 and θ = π, both arguments are identical to zero which is where atan2 is undefined. This singularity will be discussed in detail in the next section. For our application, we define atan2 to be identical zero into order to allow a definition on complete [0, π]. For calculating ϑ 2 , we use (13) and definē It can be seen that this quaternion describes a rotation around the ±n q axis since = A (q) n = n q . This makes the first three entries of the quaternion describe the n q axis, i.e.q 1:3 q1:3 = ±n q or the unit quaternion andq 1:3 = 0. The angle ϑ 2 results from ϑ 2 := +2 arccos(q 4 ), ifq 1:3 q1:3 ∈ {0, n q } −2 arccos(q 4 ), ifq 1: The result of this definition is an angle ϑ 2 ∈ (−2π, 2π] which is chosen to be the domain of ϑ 2 . These steps define the mapping l r,n 1 . Definition 3. For two vectors r, n ∈ S 2 the attitude given by q is transformed into the three angles using the mapping l r,n ϑ 2 := +2 arccos(q 4 ), ifq 1:3 q1:3 = n q −2 arccos(q 4 ), otherwise with the rotation axes n q := A(q) n, n θ,0 := A (e i × r, θ) r and the quaternion describing the rotation around the n q axis asq := q −1 (r, ϑ 1 ) ⊗ q −1 (e i × r, θ) ⊗ q −1 (v, φ) ⊗ q with rotation axis and angle v := n×r n×r , φ := arccos(n r).
Proof. By the transparent way of defining the functions l r,n 1 and l r,n 2 it is clear that they are corresponding inverses for θ not identical to zero or π.

PROPERTIES OF THE MAPPINGS
In this section we discuss some of the properties of the attitude representation and their mappings. Step 1: Rotate with φ around v.
This rotates r on n.
e i × r Step 2: Rotate with θ around e i × r.
This rotates r on n θ;0 .
Step 4: Rotate with # 2 around n θ;#1 . The result is the desired attitude. divided into four steps to map the three angles (θ, ϑ 1 , ϑ 2 ) to a quaternion. Each step changes the current attitude using a single rotation. The starting attitude for Step 1 corresponds to the identity quaternion. In all steps the rotations are illustrated showing the resulting normal vector after the rotation. The normal vector in Step 4 remains unchanged after the rotation. The explicit depiction of the current attitude using a coordinate system is omitted to make the illustration clearer.

Underlying System of Equations
First, we summarise the three equations that are the basis for the two mappings. Remark 5. The attitude representation is based on the three equations r A (q) n = cos(θ) A (q) n = A (r, ϑ 1 )A (e i × r, θ) r q = q(v, φ)⊗q (e i ×r,θ)⊗q(r, ϑ 1 )⊗q(n θ,ϑ1 ,ϑ 2 ) with the rotation axis and angles as in Definition 3.

Singularities
It is well known that the attitude space is of dimension three. Attitude representations that use only three variables come with the disadvantage of having singularities while representations with more than three variable have additional constraints. The proposed attitude representation has only three variables, but a singularity occurs when the angle θ is identical to zero or π. In this case, ϑ 1 and ϑ 2 have the same rotation axis, namely r. Proposition 6. For θ = 0 and θ = π it holds l r,n 2 (0, ϑ 1 − ϑ 2 , ϑ 2 ) = l r,n 2 (0, ϑ 1 , 0) (17) l r,n 2 (π, ϑ 1 + ϑ 2 , ϑ 2 ) = l r,n 2 (π, ϑ 1 , 0) .
The second and third equation follow from the fact that n q = n θ,0 = r and that we have defined atan2 to be zero for two arguments identical to zero. The same calculations can be made for θ = π and −r.
Note that these singularities make l r,n 1 not surjective and l r,n 2 not injective which is why invertibility was only stated for the sets without these singularities in the previous section.

Augmentation of the Mappings
The mappings l r,n 1 and l r,n 2 can be augmented easily for r ∈ span{n}. In this case we define any vector which is perpendicular to r as v = e i × r with any unity vector e i / ∈ span{n} and proceed as usual.
On the other hand, the domain of l r,n 2 for ϑ 2 is chosen in the definition of the mappings to have the form (−2π, 2π]. This is done to achieve the bijectivity on the quaternion space. However, restricting this domain to (−π, π] is sufficient to represent all orientations because ±q describe the same orientation and (19b) allows the transformation into the reduced domain.
We summarise the smoothness properties as follows. Proposition 8. The function l r,n 2 is smooth everywhere while l r,n 1 is only smooth on S 3 \ Q dc .
Proof. The definition of l r,n 2 is the result of a composition of smooth functions. Thus l r,n 2 is smooth Amann and Escher (2005). Also the smoothness of l r,n 1 is the result of the individually composed functions. Possible discontinuities are induced by atan2 and the piecewise definition of ϑ 2 . Indeed the discontinuities due to atan2 at θ ∈ {0, 2π} can be shown using two simple sequences and the property (18). The same can be done for the singularities at ϑ 1 = π and ϑ 2 = 2π and the properties (20).

Dynamics
Considering the three angles as functions of time we may define their dynamics by using either of the functions l r,n 1 , l r,n 2 and the quaternion dynamics from Markley and Crassidis (2014), i.e. q = 1 2 Ξ (q) ω .