Star Coffee Writing about stuff, working in public

Spacecraft Attitude Dynamics and Control - Notes

Attitude Representation

Euler Angles

Angular velocity:

ω=Sθ˙ \vec \omega = S \dot{\vec \theta}

If C=Rx(θ3)Ry(θ2)Rz(θ1),\textbf C = \textbf R_x(\theta_3) \textbf R_y(\theta_2) \textbf R_z(\theta_1),

ω=Sθ˙=[θ˙300]+Rx(θ3)[0θ˙20]+Rx(θ3)Ry(θ2)[00θ˙1] \vec \omega = S \dot{\vec \theta} = \begin{bmatrix} \dot \theta_3 \\ 0 \\ 0 \end{bmatrix} + \textbf R_x(\theta_3) \begin{bmatrix}0 \\ \dot \theta_2 \\ 0 \end{bmatrix} + \textbf R_x(\theta_3) \textbf R_y(\theta_2) \begin{bmatrix} 0 \\ 0 \\ \dot \theta_1 \end{bmatrix}

Angle-Axis

DCM from parameters:

CBA=cosϕ+(1cosϕ)aasin(ϕ)a× \textbf C_{BA} = \cos \phi + (1 - \cos \phi) a a^\intercal - \sin (\phi) a^\times

Parameters from DCM:

cosϕ=12(C11+C22+C331)=12(σ1) \cos \phi = \frac{1}{2} \left( C_{11} + C_{22} + C_{33} -1 \right) = \frac{1}{2}(\sigma - 1) a={12sinϕ[C23C32C31C13C12C21]σ1,3[±1+C112±1+C222±1+C332]σ=1indeterminateσ=3 \vec a = \left\{ \begin{aligned} &\frac{1}{2 \sin \phi} \begin{bmatrix} C_{23} - C_{32} \\ C_{31} - C_{13} \\ C_{12} - C_{21} \end{bmatrix} &\sigma \neq -1,3 \\ &\begin{bmatrix} \pm \sqrt{\frac{1 + C_{11}}{2}} \\ \pm \sqrt{\frac{1 + C_{22}}{2}} \\ \pm \sqrt{\frac{1 + C_{33}}{2}} \end{bmatrix} &\sigma = -1 \\ &\text{indeterminate} &\sigma=3 \end{aligned} \right.

Angular velocity:

a˙=12[a×cot(ϕ2)a×a×]ω \dot{\vec a} = \frac{1}{2} \left[ \vec a^\times - \cot \left(\frac{\phi}{2} \right) \vec a^\times \vec a^\times \right] \vec \omega ϕ˙=aω \dot \phi = \vec a^\intercal \vec \omega

Quaternions

DCM from parameters:

CBA=(η2ϵϵ)+2ϵϵ2ηϵ× \textbf C_{BA} = (\eta^2 - \vec \epsilon ^\intercal \vec \epsilon) + 2 \vec \epsilon \vec \epsilon^\intercal - 2 \eta \vec \epsilon^\times

Parameters from axis-angle:

η=cosϕ2ϵ=asinϕ2 \begin{aligned} \eta &= \cos \frac{\phi}{2} \\ \vec \epsilon &= \vec a \sin \frac{\phi}{2} \end{aligned}

Parameters from DCM:

η=±121+C11+C22+C33ϵ=14η[C23C32C31C13C12C22] \begin{aligned} \eta &= \pm \frac{1}{2} \sqrt{1 + C_{11} + C_{22} + C_{33}} \\ \vec \epsilon &= \frac{1}{4\eta} \begin{bmatrix} C_{23} - C_{32} \\ C_{31} - C_{13} \\ C_{12} - C_{22} \end{bmatrix} \end{aligned}

Angular velocity:

ϵ˙=12(ϵ×+η)ωη˙=12ϵω \begin{aligned} \dot{\vec \epsilon} &= \frac{1}{2}(\vec \epsilon^\times + \eta) \vec \omega \\ \dot \eta &= - \frac{1}{2} \vec \epsilon^\intercal \vec \omega \end{aligned}

Attitude Dynamics

Euler's equation is defined as:

M=Jω˙+ω×Jω \vec M = \mathbf{J} \dot{\vec \omega} + \vec \omega^\times \mathbf{J} \vec \omega

Assuming principal axis rotations, the equation can be expanded to:

Mx=Jxω˙x(JyJz)ωyωzMy=Jyω˙y(JzJx)ωxωzMz=Jzω˙z(JxJy)ωxωy \begin{aligned} M_x &= J_x \dot \omega_x - (J_y - J_z) \omega_y \omega_z \\ M_y &= J_y \dot \omega_y - (J_z - J_x) \omega_x \omega_z \\ M_z &= J_z \dot \omega_z - (J_x - J_y) \omega_x \omega_y \end{aligned}

Linearized form plant model:

G(s)=1Js2 G(s) = \frac{1}{Js^2}

Euler Angle Attitude Representation

Rate of change for 321 Euler angle rotation:

[ϕ˙θ˙ψ˙]=[1sin(ϕ)tan(θ)cos(ϕ)tan(θ)0cos(ϕ)sin(ϕ)0sin(ϕ)sec(θ)cos(ϕ)sec(θ)][ωxωyωz]=[ωx+ωztan(θ)cos(ϕ)+ωytan(θ)sin(ϕ)ωycos(ϕ)ωzsin(ϕ)ωzsec(θ)cos(ϕ)+ωysec(θ)sin(ϕ)] \begin{align*} \begin{bmatrix} \dot \phi \\ \dot \theta \\ \dot \psi \end{bmatrix} &= \begin{bmatrix} 1 & \sin(\phi) \tan(\theta) & \cos(\phi) \tan(\theta) \\ 0 & \cos(\phi) & -\sin(\phi) \\ 0 & \sin(\phi) \sec(\theta) & \cos(\phi) \sec(\theta) \end{bmatrix} \begin{bmatrix} \omega_x \\ \omega_y \\ \omega_z \end{bmatrix} \\ &= \begin{bmatrix} \omega_x + \omega_z \tan(\theta) \cos(\phi) + \omega_y \tan(\theta) \sin(\phi) \\ \omega_y \cos(\phi) - \omega_z \sin(\phi) \\ \omega_z \sec(\theta) \cos(\phi) + \omega_y \sec(\theta) \sin(\phi) \end{bmatrix} \end{align*}

State vector:

u=[ϕθψωxωyωz] u˙=[ϕ˙θ˙ψ˙ω˙xω˙yω˙z]=[ωx+ωztan(θ)cos(ϕ)+ωytan(θ)sin(ϕ)ωycos(ϕ)ωzsin(ϕ)ωzsec(θ)cos(ϕ)+ωysec(θ)sin(ϕ)[Mx+(JyJz)ωyωz]/Jx[My+(JzJx)ωxωz]/Jy[Mz+(JxJy)ωxωy]/Jz] \displaystyle \vec u = \begin{bmatrix} \phi \\ \theta \\ \psi \\ \omega_x \\ \omega_y \\ \omega_z \end{bmatrix} \; \; \; \dot{\vec u} = \begin{bmatrix} \dot \phi \\ \dot \theta \\ \dot \psi \\ \dot \omega_x \\ \dot \omega_y \\ \dot \omega_z \end{bmatrix} = \begin{bmatrix} \omega_x + \omega_z \tan(\theta) \cos(\phi) + \omega_y \tan(\theta) \sin(\phi) \\ \omega_y \cos(\phi) - \omega_z \sin(\phi) \\ \omega_z \sec(\theta) \cos(\phi) + \omega_y \sec(\theta) \sin(\phi) \\ \left[ M_x + (J_y - J_z) \omega_y \omega_z\right]/J_x \\ \left[ M_y + (J_z - J_x) \omega_x \omega_z \right]/J_y \\ \left[ M_z + (J_x - J_y) \omega_x \omega_y \right]/J_z\end{bmatrix}

Quaternion Attitude Representation

u=[qω]=[q0q1q2q3ωxωyωz] \displaystyle \vec u = \begin{bmatrix} \vec q \\ \vec \omega \end{bmatrix} = \begin{bmatrix} q_0 \\ q_1 \\ q_2 \\ q_3 \\ \omega_x \\ \omega_y \\ \omega_z \end{bmatrix} u˙=[12(q1ωxq2ωyq3ωz)12(q0ωx+q2ωzq3ωy)12(q0ωyq1ωz+q3ωx)12(q0ωz+q1ωyq2ωx)[Mx+(JyJz)ωyωz]/Jx[My+(JzJx)ωxωz]/Jy[Mz+(JxJy)ωxωy]/Jz] \displaystyle \dot{\vec u} = \begin{bmatrix} \frac{1}{2}(-q_1 \omega_x - q_2 \omega_y - q_3 \omega_z) \\ \frac{1}{2}(q_0 \omega_x + q_2 \omega_z - q_3 \omega_y) \\ \frac{1}{2}(q_0 \omega_y - q_1 \omega_z + q_3 \omega_x) \\ \frac{1}{2}(q_0 \omega_z + q_1 \omega_y - q_2 \omega_x) \\ \left[ M_x + (J_y - J_z) \omega_y \omega_z\right]/J_x \\ \left[ M_y + (J_z - J_x) \omega_x \omega_z \right]/J_y \\ \left[ M_z + (J_x - J_y) \omega_x \omega_y \right]/J_z \end{bmatrix}

Attitude Control

PD Control

Frequency domain definition:

Mc=(Kp+sKd)Δθ~HC=Kp+sKd \begin{aligned} M_c &= (K_p + sK_d) \tilde{\Delta \theta} \\ H_C &= K_p + sK_d \end{aligned}

Time-domain definition:

Mc=KpΔθ+KdΔθ˙=Kp(θrefθ)+Kd(θ˙refθ˙) M_c = K_p \Delta \theta + K_d \Delta \dot \theta = K_p (\theta_\text{ref} - \theta) + K_d (\dot \theta_\text{ref} - \dot \theta)

Defining gains in terms of natural frequency and damping ratio:

Kp=Jωn2 K_p = J \omega_n^2 Kd=2Jωnζ K_d = 2 J \omega_n \zeta

Quaternion Feedback Control

Control law:

u=Kqerr,vCωerr \vec u = - \mathbf K \vec q_{\text{err}, v} - \mathbf C \vec \omega_\text{err}

Known formulations:

K=KI, C=diag(C1,C2,C3), K,Ci>0 \mathbf K = K \mathbf I, \; \mathbf C = \text{diag}(C_1, C_2, C_3), \; K, C_i > 0 K=Kqerr,s3I, C=diag(C1,C2,C3) \mathbf K = \frac{K}{q_{\text{err}, s}^3} \mathbf I, \; \mathbf C = \text{diag}(C_1, C_2, C_3) K=Ksign(qerr,s)I, C=diag(C1,C2,C3) \mathbf K = K \text{sign}(q_{\text{err}, s}) \mathbf I, \; \mathbf C = \text{diag}(C_1, C_2, C_3) K=[αJ+βI]1, K1C0, α,β0 \mathbf K = \left[ \alpha \mathbf J + \beta \mathbf I \right]^{-1}, \; \mathbf K^{-1} \mathbf C \leq 0, \; \alpha, \beta \leq 0

Eigen-axis rotations:

u=Kqerr,vCωerr+ω×Jω \vec u = - \mathbf K \vec q_{\text{err}, v} - \mathbf C \vec \omega_\text{err} + \vec \omega^\times \mathbf J \vec \omega
CC BY-SA 4.0 Michal Jagodzinski. Last modified: May 09, 2024.
Website built with Franklin.jl and the Julia programming language.