1 Introduction

Spacecraft attitude control can be obtained by adopting several actuation mechanisms. Among them electromagnetic actuators are widely used for generation of attitude control torques on satellites flying in low Earth orbits. They consist of planar current-driven coils rigidly placed on the spacecraft typically along three orthogonal axes, and they operate on the basis of the interaction between the magnetic dipole moment generated by those coils and the Earth magnetic field. In fact, the interaction with the Earth field generates a torque that attempts to align the total magnetic dipole moment in the direction of the field. Magnetic actuators, also known as magnetorquers, have the important limitation that control torque is constrained to belong to the plane orthogonal to the Earth magnetic field. As a result, usually actuators of a different type accompany magnetorquers to provide full three-axis control. Moreover, magnetorquers are often used for angular momentum dumping when reaction or momentum-bias wheels are employed for accurate attitude control (see [11, Chapter 7]). Lately, attitude stabilization using only magnetorquers has been considered as a feasible option especially for low-cost micro- and nano-satellites and for satellites with a failure in the main attitude control system. As a result, several papers have been dedicated to the design of stabilizing control laws in such a setting. In some of those works stability is achieved in the case of inertial pointing (see, e.g. [2, 4, 5, 7]), whereas in other papers it is achieved for Earth (or nadir) pointing spacecraft (see, e.g. [6, 8, 12, 16, 17]). In all of the cited papers PD-like control algorithms are employed. In [2, 4, 5, 16] the corresponding scalar control gains are determined substantially on a trial-and-error basis. In [6, 7, 12] the scalar gains are selected so to maximize the degree of stability of the closed-loop system. In [8, 17] matrix gains are employed and are determined by solving linear quadratic regulator problems.

In the present work, attitude stabilization of an Earth-pointing spacecraft using only magnetorquers is considered, and a stabilizing PD-like control law is applied. Matrix gains are employed since they provide more degrees of freedom in the control action with respect to scalar gains. The matrix gain selection is performed through the use of a result on periodic linear quadratic regulators presented in [13]. The proposed approach is more promising than those in [8, 17].

2 Mathematical Model and Control Law

2.1 Coordinate Frames

To describe the attitude dynamics of a rigid Earth-pointing spacecraft in a circular orbit, and to represent the geomagnetic field, it is useful to introduce the following reference frames:

  1. 1.

    Geocentric inertial frame \(\mathcal {F}_i\). A commonly used inertial frame for Earth orbits is the Geocentric Inertial Frame, whose origin is in the Earth center, its \(x_i\) axis is the vernal equinox direction, the \({x_i y_i}\) plane is the Earth equatorial plane, and consequently the \(z_i\) axis coincides with the Earth axis of rotation and points northward (see [11, Sect. 2.6.1]).

  2. 2.

    Orbital frame \(\mathcal {F}_o\). The origin of this frame, also called local vertical local horizontal (LVLH), is in the satellites center of mass. The \(x_o\) axis is along the spacecraft velocity. The \(z_o\) axis points to the Earth center, and the \(y_o\) axis, perpendicular to the orbit plane, completes the right-handed frame.

  3. 3.

    Spacecraft body frame \(\mathcal {F}_b\). The origin of this frame coincides with the satellite center of mass. Its axes are principal axes of inertia for the spacecraft.

The Earth-pointing objective is having \(\mathcal {F}_{\rm{b}}\) aligned with \(\mathcal {F}_{\rm{o}}\).

The notation used throughout the paper is presented in Table 1.

Table 1 Notation

2.2 Attitude Kinematics

Since in this work we deal with an Earth-pointing problem, the focus will be on the kinematics of the satellite with respect to the orbital frame. Let

$$\begin{aligned} q=\left[ q_1\ q_2\ q_3\ q_4\right] ^T=\left[ q_v^T\ q_4\right] ^T \end{aligned}$$

with \(\Vert q\Vert =1\), be the quaternion representing rotation of \(\mathcal {F}_{\rm{b}}\) w.r.t. \(\mathcal {F}_{\rm{o}}\). Then, the corresponding attitude matrix that transforms vectors of coordinates in \(\mathcal {F}_{\rm{o}}\) into vectors of coordinates in \(\mathcal {F}_{\rm{b}}\) is given by

$$\begin{aligned} C(q)=\left( q_4^2-q_v^T q_v\right) I_{3}+2 q_v q_v^T-2 q_4 q_v^{\times } \end{aligned}$$
(1)

(see [15, Sect. 5.4]) where \(I_{3 \times 3}\) is the \(3 \times 3\) identity matrix, and the notation \(v^{\times }\) for \(v = [v_1 \ v_2 \ v_3]^T\) represents the skew symmetric matrix

$$\begin{aligned} v^{\times } = \left[ \begin{array}{rcl} 0 &{} -v_3 &{} v_2\\ v_3 &{} 0 &{} -v_1\\ -v_2 &{} v_1 &{} 0 \end{array} \right] \end{aligned}$$
(2)

so that for \(w = [w_1 \ w_2 \ w_3]^T\), it occurs that \(v \times w= v^{\times }w\). The attitude kinematics is given by (see [15, Sect. 5.5.3])

$$\begin{aligned} \begin{array}{rcl} \dot{q}_v &{}=&{} \frac{1}{2}(q_v^{\times } + q_4 I_{3 \times 3}) \omega ^b_{\rm{bo}}\\ \dot{q}_4 &{}=&{} -\frac{1}{2}q_v^T \omega ^b_{\rm{bo}} \end{array} \end{aligned}$$
(3)

Clearly

$$\begin{aligned} \omega _{\rm{bo}}^b=\omega _{\rm{bi}}^b-\omega _{\rm{oi}}^b \end{aligned}$$
(4)

Moreover, since a circular orbit is considered, then \(\omega _{\rm{oi}}^o=[0\ -n\ 0]^T\) where n is the constant orbital rate, and consequently

$$\begin{aligned} \omega _{\rm{oi}}^b=C(q)\omega _{\rm{oi}}^o \end{aligned}$$
(5)

2.3 Attitude Dynamics

The attitude dynamics can be expressed in body frame as

$$\begin{aligned} J \dot{\omega }_{\rm{bi}}^b = - \omega _{\rm{bi}}^b \times J \omega _{\rm{bi}}^b + T^b_{\rm{gg}} + T^b_{coils} + T_{\rm{dist}} \end{aligned}$$
(6)

where \(J=\mathrm {diag}[J_x, J_y, J_z]\) is the inertia matrix of the spacecraft, \(T^b_{\rm{gg}}\) is the gravity gradient torque, \(T^b_{coils}\) is the external torque induced by magnetic coils, and \(T_{\rm{dist}}\) is a disturbance torque.

The gravity gradient torque in body coordinates is given by (see [15, Sect. 6.10])

$$\begin{aligned} T^b_{\rm{gg}}=3 n^2 \hat{z}_{\rm{o}}^b \times J \hat{z}_{\rm{o}}^b \end{aligned}$$
(7)

where \(\hat{z}_{\rm{o}}^b\) denotes the unit vector corresponding to the \(z_{\rm{o}}\)-axis of \(\mathcal {F}_{\rm{o}}\) resolved in body frame which can be expressed as

$$\begin{aligned} \hat{z}_{\rm{o}}^b = C(q) e_3 \end{aligned}$$

where

$$\begin{aligned} e_3=\left[ \begin{array}{c} 0\\ 0\\ 1 \end{array} \right] \end{aligned}$$
(8)

The spacecraft is equipped with three magnetic coils aligned with the \(\mathcal {F}_{\rm{b}}\)-axes which generate the following magnetic control torque

$$\begin{aligned} T^b_{\rm{coils}}=m_{\rm{coils}} \times b^b=-\left( b^b\right) ^{\times }\ m_{\rm{coils}} \end{aligned}$$
(9)

where \(m_{\rm{coils}}\) is the vector obtained by stacking the magnetic moment of the three coils, and \(b^b\) is the geomagnetic field at the spacecraft expressed in \(\mathcal {F}_{\rm{b}}\). Clearly, the relation between \(b^b\) and \(b^o\) is given by

$$\begin{aligned} b^b=C(q) b^o \end{aligned}$$
(10)

For what follows, it useful to rewrite Eq. (6) in terms of \(\omega _{\rm{bo}}^b\) instead of \(\omega _{\rm{bi}}^b\). For that purpose note that from (4) and (5) it follows that \(\omega _{\rm{bi}}^b=\omega _{\rm{bo}}^b+C(q)\omega _{\rm{oi}}^o\) where \(\omega _{\rm{oi}}^o= [0\ -n\ 0]^T\) is constant. Thus, the following holds

$$\begin{aligned} \dot{\omega }_{\rm{bi}}^b=\dot{\omega }_{\rm{bo}}^b+ \dot{C}(q)\omega _{\rm{oi}}^o \end{aligned}$$
(11)

Since

$$\begin{aligned} \dot{C}(q)=-(\omega _{\rm{bo}}^b)^{\times }C(q) \end{aligned}$$

(see [10, Sect. 1.4.1]) then

$$\begin{aligned} \dot{C}(q)\omega _{\rm{oi}}^o= & {} -\left( \omega _{\rm{bo}}^b\right) ^{\times }C(q)\omega _{\rm{oi}}^o=-\left( \omega _{\rm{bo}}^b\right) ^{\times } \omega _{\rm{oi}}^b\nonumber \\= & {} \omega _{\rm{oi}}^b \times \omega _{\rm{bo}}^b=(C(q)\omega _{\rm{oi}}^o)^{\times } \omega _{\rm{bo}}^b \end{aligned}$$
(12)

Thus, from Eqs. (6)–(12) obtain

$$\begin{aligned} J \dot{\omega }_{\rm{bo}}^b= & {} \left( -J(C(q) \omega _{\rm{oi}}^o)^{\times } - \left( \omega _{\rm{bo}}^b\right) ^{\times } J \right. \nonumber \\&\left. +(J C(q) \omega _{\rm{oi}}^o)^{\times }-(C(q)\omega _{\rm{oi}}^o)^{\times } J \right) \omega _{\rm{bo}}^b \nonumber \\&- \left( C(q) \omega _{\rm{oi}}^o\right) ^{\times } J C(q) \omega _{\rm{oi}}^o \nonumber \\&+ 3 n^2 \left( C(q) e_3 \right) ^{\times } J C(q) e_3 \nonumber \\&- (C(q) b^o)^{\times }\ m_{\rm{coils}} + T_{\rm{dist}} \end{aligned}$$
(13)

Let \(b^i\) be the geomagnetic field at spacecraft expressed in inertial frame \(\mathcal {F}_i\) and let \(R_{\rm{oi}}\) be the rotation matrix that transforms vectors of coordinates in \(\mathcal {F}_i\) into vectors of coordinates in \(\mathcal {F}_{\rm{o}}\). Note that \(b^i\) and \(R_{\rm{oi}}\) vary with time at least because of the spacecraft motion along the orbit. Then

$$\begin{aligned} b^o(t)=R_{\rm{oi}}(t)b^i(t) \end{aligned}$$
(14)

which shows explicitly the dependence of \(b^o\) on t. To study Eq. (13) it is important to characterize the time-dependence of \(b^o(t)\), which corresponds to characterizing the time-dependence of \(b^i(t)\) and \(R_{\rm{oi}}(t)\). By adopting the so-called dipole model of the geomagnetic field (see [14, Appendix H]), and letting \(R_{\rm{orbit}}\) denote the radius of the circular orbit, obtain:

$$\begin{aligned} b^i(t)=\frac{\mu _m}{R_{\rm{orbit}}^3}\left[ 3 \left( \left( \hat{m}^i(t)\right) ^T \hat{r}^i(t)\right) \hat{r}^i(t) - \hat{m}^i(t) \right] . \end{aligned}$$
(15)

In equation (15), \(\mu _m\) is the total dipole strength, \(r^i(t)\) is the spacecraft position vector resolved in \(\mathcal {F}_i\), and \(\hat{r}^i(t)\) is the vector of the direction cosines of \(r^i(t)\). The components of vector \(\hat{m}^i(t)\) are the direction cosines of the Earth magnetic dipole expressed in \(\mathcal {F}_i\), which is set equal to

$$\begin{aligned} \hat{m}^i(t) = \left[ \begin{array}{c} \sin (\theta _m) \cos (\omega _{e}t + \alpha _0) \\ \sin (\theta _m) \sin (\omega _{e}t + \alpha _0) \\ \cos (\theta _m) \end{array}\right] , \end{aligned}$$
(16)

where \(\theta _m\) is the dipole coelevation, \(\omega _{e}=360.99\) deg/day is the Earth average rotation rate, and \(\alpha _0\) is the right ascension of the dipole at time \(t=0\). We use \(\mu _m=7.746\ 10^{15}\) Wb m and \(\theta _m=170.0\) deg as reported in [9].

To characterize the time dependence of \(b^i(t)\) in (15), one needs to determine an expression for \(r^i(t)\) which is the spacecraft position vector resolved in \(\mathcal {F}_i\). Define a coordinate system \(x_p\), \(y_p\) in the orbital plane, whose origin is at the center of the Earth, and with the \(x_p\) axis coinciding with the line of nodes. Then, the position of satellite centre of mass is given by

$$\begin{aligned} \begin{array}{rcl} x^p(t) &{}=&{} R_{\rm{orbit}} \cos (nt + \phi _0)\\ y^p(t) &{}=&{} R_{\rm{orbit}} \sin (nt + \phi _0), \end{array} \end{aligned}$$
(17)

where \(\phi _0\) is the argument of the spacecraft at time \(t=0\). Let incl be the orbit inclination and let \(\varOmega\) denote the Right Ascension of the Ascending Node (RAAN) of the orbit (see [11, Sect. 2.6.2]). Then, the coordinates of the satellite center of mass in the inertial frame can be obtained as follows

$$\begin{aligned} r^i(t)= R_z(-\varOmega ) R_x(-incl) \left[ \begin{array}{c}x^p(t) \\ y^p(t) \\ 0\end{array}\right] \end{aligned}$$
(18)

where

$$\begin{aligned} R_x(\varphi )=\left[ \begin{array}{ccc}1 &{} 0 &{} 0 \\ 0 &{} \cos (\varphi ) &{} \sin (\varphi ) \\ 0 &{} -\sin (\varphi ) &{} \cos (\varphi ) \end{array}\right] \end{aligned}$$
(19)

is the rotation matrix corresponding to a rotation around the x-axis of magnitude \(\varphi\) and

$$\begin{aligned} R_z(\psi )=\left[ \begin{array}{ccc}\cos (\psi ) &{} \sin (\psi ) &{} 0 \\ -\sin (\psi ) &{} \cos (\psi ) &{} 0 \\ 0 &{} 0 &{} 1\end{array}\right] \end{aligned}$$
(20)

is the rotation matrix corresponding to a rotation around the z-axis of magnitude \(\psi\) (see [11, Sect. 2.6.2]).

Combining Eqs (15) - (20), the expression of \(b^i(t)\) can be easily obtained. Moreover, it holds that

$$\begin{aligned} R_{\rm{oi}}(t)=\left[ \begin{array}{ccc}0 &{} 1 &{} 0 \\ 0 &{} 0 &{} -1 \\ -1 &{} 0 &{} 0 \end{array}\right] R_z(nt+\phi _0) R_x(incl) R_z(\varOmega ) \end{aligned}$$

Then, by using Eq. (14), an explicit expression for \(b_{\rm{o}}(t)\) can be derived. It is easy to see that \(b_{\rm{o}}(t)\) can be expressed as a sum of sinusoidal functions of t having different frequencies since sinusoidal functions having angular frequencies n and \(\omega _e\) appear in the previous equations. In addition, if coelevation of the Earth magnetic dipole is approximated to \(\theta _m=180\) deg, which corresponds to having the Earth magnetic dipole aligned with the Earth rotation axis, then expression of \(b^o(t)\) simplifies as follows

$$\begin{aligned} b^o(t) = \frac{\mu _m}{R_{\rm{orbit}}^3} \left[ \begin{array}{c} \sin (incl) \cos \left( nt + \phi _0\right) \\ -\cos (incl) \\ 2 \sin (incl) \sin \left( nt + \phi _0\right) \end{array}\right] \end{aligned}$$
(21)

Thus, in the latter simplified scenario \(b^o(t)\) is periodic with period \(T_{\rm{orbit}}=2 \pi /n\).

2.4 Control Law

The control objective is driving the spacecraft so that \(\mathcal {F}_{\rm{b}}\) is aligned with \(\mathcal {F}_{\rm{o}}\). From (1) it follows that \(C(q)=I_{3 \times 3}\) for \(q=[q_v\ q_4]^T=\pm \bar{q}\) where \(\bar{q}= [0\ 0\ 0\ 1]^T\). Thus, the control objective can be equivalently stated as having that \(q_v \rightarrow 0\) and \(\omega _{\rm{bo}}^b \rightarrow 0\).

In this paper the following control law is considered

$$\begin{aligned} m_{\rm{coils}} = - b^b \times \left( K_p q_v + K_d \omega ^b_{\rm{bo}}\right) \end{aligned}$$
(22)

with \(K_p\) and \(K_d\) being 3 \(\times\) 3 matrices. It is a PD-like control law in which the cross product with \(b^b\) guarantees that \(m_{\rm{coils}}\) is orthogonal to \(b^b\). This is useful since a component of \(m_{\rm{coils}}\) parallel to \(b^b\) does not provide any contribution to \(T_{\rm{coils}}\) (see Eq. (9)).

Note that employing matrix gains \(K_p\) and \(K_d\) provides more degrees of freedom to the control action with respect to adopting scalar gains as in [2, 4,5,6,7]. Those additional degrees can be beneficial to the stabilizing action considering that, in the general case, the dynamics about each single body axis are different and are coupled. On the other hand, selecting appropriate values for two 3 \(\times\) 3 matrix gains is clearly more challenging than doing it for two scalar gains.

3 Gain Selection

The goal of this section is presenting a systematic method for determining effective values for the 3 \(\times\) 3 matrix gains \(K_p\) and \(K_d\).

Neglect disturbance torque by setting \(T_{\rm{dist}}=0\), and rewrite control law in Eq. (22) in the following equivalent forms

$$\begin{aligned} m_{\rm{coils}}= & {} - \left( b^b\right) ^{\times } \left( K_p q_v + K_d \omega ^b_{\rm{bo}}\right) \nonumber \\= & {} - \left( C(q)b^o\right) ^{\times } \left( K_p q_v + K_d \omega ^b_{\rm{bo}}\right) \end{aligned}$$
(23)

The resulting closed-loop system is given by Eqs. (3) (13) (23). To determine its linear approximation about \((q, \omega _{\rm{bo}}^b)=(\bar{q}, 0)\), consider its restriction to the open set \(\mathbb {S}^{3+} \times \mathbb {R}^3\) where

$$\begin{aligned} \mathbb {S}^{3+}=\left\{ q \in \mathbb {R}^4\ |\ \Vert q\Vert =1,\ q_{4}>0\right\} \end{aligned}$$
(24)

On the latter set the following holds

$$\begin{aligned} q_{4}=\left( 1-q_{v}^T q_{v}\right) ^{1/2} \end{aligned}$$
(25)

Then, the restriction is given by the reduced order system obtained considering the following equation

$$\begin{aligned} \begin{array}{rcl} \dot{q}_{v}= & {} \frac{1}{2} \left[ \left( 1-q_{v}^T q_{v} \right) ^{1/2} I_{3 \times 3} + q_{v}^{\times } \right] \omega ^b_{\rm{bo}} \end{array} \end{aligned}$$
(26)

along with the equations obtained from Eqs. (13) and (23) replacing C(q) with \(C_v(q_{v})\) which is given by

$$\begin{aligned} C_v\left( q_{v}\right) =\left( 1-2 q_{v}^T q_{v} \right) I+2 q_{v} q_{v}^T-2 \left( 1- q_{v}^T q_{v} \right) ^{1/2} q_{v}^{\times } \end{aligned}$$
(27)

Considering that \(b^o\) changes with time (see Eq. (14)), the linear approximation of the latter restriction around \((q_v,\omega ^b_{\rm{bo}})=(0, 0)\) can be represented as the following linear time-varying system (see also [8, 17])

$$\begin{aligned} \dot{x} = A x + B(t)u \end{aligned}$$
(28)

subject to state-feedback

$$\begin{aligned} u=-Kx \end{aligned}$$
(29)

In the above equations \(x=[q_v^T \ (\omega ^b_{\rm{bo}})^T]^T\)

$$\begin{aligned} A= & {} \left[ \begin{array}{cc} 0_{3 \times 3} &{} \frac{1}{2} I_{3 \times 3} \\ A_{21} &{} A_{22} \end{array} \right] B(t) = \left[ \begin{array}{cc} 0_{3 \times 3} \\ -J^{-1} \left( (b^o(t))^{\times }\right) ^2 \end{array} \right] K=\left[ K_p \ \ K_d\right] \\ A_{21}= & {} \left[ \begin{array}{ccc} -8 n^2 \sigma _x &{} 0 &{} 0 \\ 0 &{} 6 n^2 \sigma _y &{} 0 \\ 0 &{} 0 &{} 2 n^2 \sigma _z\end{array}\right] \\ A_{22}= & {} \left[ \begin{array}{ccc} 0 &{} 0 &{} n \left( 1 - \sigma _x \right) \\ 0 &{} 0 &{} 0 \\ -n(1+\sigma _z) &{} 0 &{} 0\end{array}\right] \\ \sigma _x= & {} \frac{J_y-J_z}{J_x} \ \ \ \sigma _y=\frac{J_z-J_x}{J_y} \ \ \ \sigma _z=\frac{J_x-J_y}{J_z} \end{aligned}$$

For selecting matrix gains \(K_p\) and \(K_d\) (or equivalently matrix gain K), set the coelevation angle of the magnetic dipole that generates the geomagnetic field to \(\theta _m=180\) deg in which case \(b^o(t)\) is periodic with period \(T_{\rm{orbit}}=2 \pi /n\) (see Eq. (21)). As a consequence, system in Eq. (28) is periodic with period \(T_{\rm{orbit}}\), too. Then, matrix gain K is chosen so that the closed-loop system given by Eqs. (28) (29) is asymptotically stable and control (29) minimizes the following quadratic performance index

$$\begin{aligned} E \left\{ \int _0^{\infty } \left[ x^T(t) Q x(t) + u(t)^T R u(t) \right] \right\} \end{aligned}$$

where Q is a 6 \(\times\) 6 positive semidefinite matrix, R is a 3 \(\times\) 3 positive definite matrix, and the expectation operator \(E\{ \cdot \}\) is taken over the set of possible initial state \(x_0\) which is assumed to be a random variable having zero mean and known covariance \(X_0=E\{ x_0 x_0^T \}\) [13]. Note that parameter \(X_0\) can be used by the designer that has some a priori knowledge on the stochastic distribution of the initial state \(x_0\). If this type of information is not available, usually one sets \(X_0= \sigma _{0}^2 I_ {6 \times 6}\) in which \(\sigma _0>0\) is a design parameter. Clearly, matrices Q and R represent design parameters, too.

Remark 1

The periodic linear quadratic regulator problem considered in this work compares favorably to the linear quadratic regulator problem formulated in [8]. In fact, in [8] the time horizon is limited to only one orbital period whereas the effective maneuvering time can easily involve several orbital periods. In addition, the cost function adopted in [8] includes a penalty of the state at time \(t=T_{\rm{orbit}}\) which does not seem to have a clear physical meaning. Moreover, compared to the linear quadratic method presented in [17], the proposed approach has the advantage of adopting constant matrix gains \(K_p\) and \(K_d\) rather than time-varying ones which simplifies the practical implementation of the control law.

3.1 Solution to the Periodic Linear Quadratic Regulator Problem

Reference [13] shows that a matrix K that solves the periodic linear quadratic regulator problem just formulated, can be determined by solving an equivalent simpler optimization problem which can be formulated as follows. Consider the dynamic matrix of the closed-loop system in Eqs. (28) (29) which is equal to \(\bar{A}(t)=A-B(t) K\) and denote by \(\varPhi _{\bar{A}}(t,\tau )\) the corresponding transition matrix which is the solution of the following matrix differential equation

$$\begin{aligned} \frac{\partial \varPhi _{\bar{A}}}{\partial t}(t,\tau )=\bar{A}(t) \varPhi _{\bar{A}}(t,\tau ) \ \ \ \ \varPhi _{\bar{A}}(\tau ,\tau )=I_{6 \times 6} \end{aligned}$$

Moreover, denote by \(\varPsi _{\bar{A}}\) the monodromy matrix associated to \(\bar{A}(t)\) which is given by \(\varPsi _{\bar{A}}=\varPhi _{\bar{A}}(T_{\rm{orbit}},0)\). Then, it can be shown that K is an optimal point of the following optimization problem

$$\begin{aligned} \min _{K} \mathrm {trace}\left( P_0 X_0\right) \end{aligned}$$

where \(P_0\) is the solution of the following discrete-time Lyapunov equation

$$\begin{aligned} P_0= \varPsi _{\bar{A}}^T P_0 \varPsi _{\bar{A}} + W \end{aligned}$$
(30)

in which W is obtained by solving the following periodic Lyapunov differential equation

$$\begin{aligned} \dot{Z} = \bar{A}\left( T_{\rm{orbit}}-t\right) ^T Z + Z \bar{A}\left( T_{\rm{orbit}}-t\right) + \bar{Q} \end{aligned}$$

with initial condition \(Z(0)=0_{6 \times 6}\) and setting \(W=Z(T_{\rm{orbit}})\). Matrix \(\bar{Q}\) appearing in the previous differential equation is given by \(\bar{Q} = Q + K^T R K\). The considered optimization problem is well defined if all eigenvalues of \(\varPsi _{\bar{A}}\) are within the open unit disk in the complex plane which is equivalent to requiring that closed-loop system in Eqs. (28) (29) is asymptotically stable [1]. In fact, the latter condition guarantees that the solution \(P_0\) of Eq. (30) exists and is unique. As a result, from a numerical point of view it is necessary to start the optimization procedure with an initial guess for K that renders the closed-loop system in Eqs. (28) (29) asymptotically stable.Footnote 1

4 Case Study

Fig. 1
figure 1

Tigrisat

For simulation consider Tigrisat, a 3U Cubesat (see Fig. 1) designed and manufactured at the School of Aerospace Engineering of Sapienza University of Rome. Its principal moments of inertia are as followsFootnote 2

$$J_{x} = J_{y} = 4.09 \cdot 10^{{ - 2}} \;{\text{kg}}\;{\text{m}}^{{\text{2}}} \quad J_{z} = 6.5 \cdot 10^{{ - 3}} \;{\text{kg}}\;{\text{m}}^{{\text{2}}}$$
(31)

The satellite follows a circular orbit having \(incl=97\) deg and altitude \(h=629\) km which corresponds to the following orbital period \(T_{\rm{orbit}}=5832\) sec [12]. The Right Ascension of the Ascending Node is equal to \(\varOmega =68.5\) deg, whereas the argument \(\phi _0\) of the spacecraft at time \(t=0\) (see Eq.(17)) has been randomly selected and set equal to \(\phi _0=1.60\) rad.

The approach described in Sect. 3 has been adopted for determining the matrix gains \(K_p\) and \(K_d\). The following design parameters have been selected for that purpose \(Q=X_0= I_{6 \times 6}\), \(R=I_{3 \times 3}\). The optimization procedure has been initialized by choosing \(K_p=300 \ I_{3 \times 3}\) and \(K_d= 1.8 \cdot 10^4 \ I_{3 \times 3}\). The initializing values have been chosen on a trial-and-error basis and are such that the characteristic multipliers of \(\bar{A}(t)\) have all negative real part. The optimization procedure determines the following optimal gains

$$\begin{aligned} K_p= & {} \left[ \begin{array}{ccc} 293.4863 &{} 0.5515 &{} -9.7049\\ -0.0069 &{} 299.8118 &{} -4.1120\\ 4.8505 &{} -0.1118 &{} 299.8613 \end{array}\right] \\ K_d= & {} \left[ \begin{array}{ccc} 1.8 \cdot 10^4 &{} 0 &{} 0 \\ 0 &{} 1.8 \cdot 10^4 &{} 0 \\ 0 &{} 0 &{} 1.8 \cdot 10^4 \end{array}\right] \end{aligned}$$

It can be verified that all characteristic exponents of closed-loop system in Eqs. (28) (29) have negative real part. Thus, the latter linear system is asymptotically stable. As a result, \((q,\omega ^b_{\rm{bo}})=(\bar{q}, 0)\) is a (locally) exponentially stable equilibrium of closed-loop system in Eqs. (3) (13) (23).

Consider an initial condition characterized by attitude equal to the target attitude \(q(0)=\bar{q}\), and by the following initial angular velocity \(\omega _{\rm{bo}}^b(0)=[10^{-3} \ \ 10^{-3} \ \ 10^{-3}]^T\ \text {rad/s}\) due for example to an impact with an object.

Two simulation are performed for the closed-loop system. In the first one nominal conditions are considered by employing the nominal value \(J_{\rm{nom}}=\mathrm {diag}[J_x \ J_y \ J_z]\) for the spacecraft inertia matrix (see Eq. (31)), and by setting the dipole coelevation as \(\theta _m=180^{\circ }\), and the disturbance torque as \(T_{\rm{dist}}=0\). In the second simulation the following perturbations are introduced. For the spacecraft inertia matrix the following perturbed value is used

$$\begin{aligned} J_{pert}=\left[ \begin{array}{rrr} 4.086\ 10^{-2} &{} -1.399\ 10^{-5} &{} 1.151\ 10^{-3} \\ -1.399\ 10^{-5} &{} 4.090\ 10^{-2} &{} -4.177\ 10^{-4} \\ 1.151\ 10^{-3} &{} -4.177\ 10^{-4} &{} 6.544\ 10^{-3} \end{array}\right] \ \ \ \mathrm {kg }\ \mathrm {m}^{2} \end{aligned}$$

The dipole coelevation is set as \(\theta _m=170^{\circ }\) (see [9]), and the disturbance torque is set as \(T_{\rm{dist}} = m_0 \times b^{b}\) which represents the torque due to a residual dipole. A realistic magnitude for the residual dipole of a 3U cubesat is \(3 \cdot 10^{-4} \mathrm {\ A \ m}^2\). Moreover, since the residual dipole is typically normal to the electronic boards, it is mostly aligned along the longitudinal axis. Thus, for simplicity, the simulation is performed using a constant residual dipole equal to \(m_0=[0 \ 0 \ 3 \cdot 10^{-4}]^T \mathrm {\ A \ m}^2\). Note that the residual dipole torque is usually the largest among the disturbance torques acting on a nanosatellite flying in a low Earth orbit. Thus, for simplicity other disturbance torques such as those due to aerodynamic drag and solar radiation pressure, are not included in the simulation.

Corresponding simulation results are reported in Figs. 2, 3, 4.

Fig. 2
figure 2

Time histories of q in nominal conditions (solid lines) and in perturbed conditions (dashed lines)

Fig. 3
figure 3

Time histories of Euler angles in nominal conditions (solid lines) and in perturbed conditions (dashed lines)

Fig. 4
figure 4

Time histories of \(\omega ^b_{\rm{bo}}\) in nominal conditions (solid lines) and in perturbed conditions (dashed lines)

Fig. 5
figure 5

Time histories of \(m_{\rm{coils}}\) in nominal conditions (solid lines) and in perturbed conditions (dashed lines)

Plots of the Euler angles are included even if redundant since they are useful to quantify the error in steady-state. In nominal conditions convergence to the desired attitude is achieved within 5 orbital periods. Simulations with perturbed conditions show that the proposed attitude control system is able to compensate for the considered perturbations to a significant extent. As a matter of fact, in steady-state the maximum roll, pitch, and yaw error are, respectively, about 2°, 4°, and 5°.

The time histories of \(m_{\rm{coils}}\) in Fig. 5 show that the required maximum magnitude for the magnetic dipole generated by a single coil is lower that 4 10 -3 A m2. Such a magnitude can be easily achieved by Tigrisat that can generate dipoles up to 0.22 A m2 for \(m_{coils\ x}\) and 0.696 A m2 for \(m_{coils\ y}\) and \(m_{coils\ z}\)Footnote 3

The scope of the considered numerical study is limited. In fact, a more accurate study could consider a more realistic model for the geomagnetic field, a time-varying residual magnetic dipole, additional disturbance torques such as those due to aerodynamic drag and solar radiation pressure, and errors in attitude determination and in angular velocity sensors (see [3]). However, such more complete study goes beyond the scope of this work whose focus is mostly theoretical.

5 Conclusion

This work studies the problem of attitude stabilization of an Earth-pointing spacecraft using only magnetorquers. A PD-like control law with matrix gains is employed. The matrix gains selection is based on the numerical solution of a periodic linear quadratic problem. The periodic linear quadratic problem adopted in this paper compares favorably under several aspects to other linear quadratic regulator problems employed in existing works for gain selection. A case study illustrates the effectiveness of the proposed method considering a simplified simulation scenario. More accurate simulation environments are not considered since that would go beyond the scope of this work whose focus is mostly theoretical.