ADCS.CONOPS.goals.attitude_goal module

class ADCS.CONOPS.goals.attitude_goal.Attitude_Goal[source]

Bases: Goal

Abstract base class for attitude-based pointing goals.

This class specializes Goal for goals whose primary output is a desired spacecraft attitude expressed as a reference quaternion. Subclasses define a desired reference attitude \(\mathbf{q}_{\mathrm{ref}}\) as a function of the current orbital state.

The reference mapping implemented by subclasses takes the form

\[G_{\mathrm{att}}(\mathcal{O}(t)) = \left( \mathbf{q}_{\mathrm{ref}}, \boldsymbol{\omega}_{\mathrm{ref}} \right)\]

where \(\mathbf{q}_{\mathrm{ref}} \in \mathbb{R}^4\) is a unit quaternion representing the desired body-to-inertial rotation and \(\boldsymbol{\omega}_{\mathrm{ref}} \in \mathbb{R}^3\) is the corresponding reference angular velocity.

This class additionally provides a common quaternion-based attitude error computation suitable for feedback control laws.

Subclasses must implement to_ref().

See also

Goal, GoalList

error(q, body_boresight, os0)[source]

Compute the quaternion-based attitude error vector.

Let \(\mathbf{q}\) denote the current spacecraft attitude quaternion and \(\mathbf{q}_{\mathrm{ref}}\) the reference attitude returned by to_ref(). The attitude error quaternion is defined as

\[\mathbf{q}_{\mathrm{err}} = \mathbf{q}^{-1} \otimes \mathbf{q}_{\mathrm{ref}}\]

where \(\otimes\) denotes quaternion multiplication.

To enforce the shortest-rotation convention, the quaternion is negated if its scalar component is negative:

\[\mathbf{q}_{\mathrm{err}} \leftarrow -\mathbf{q}_{\mathrm{err}} \quad \text{if} \quad q_{\mathrm{err},0} < 0\]

The returned error vector is the vector part of the error quaternion:

\[\mathbf{e} = \begin{bmatrix} q_{\mathrm{err},1} & q_{\mathrm{err},2} & q_{\mathrm{err},3} \end{bmatrix}^{\mathsf{T}}\]

This representation is commonly used for small-angle feedback control laws.

The body-frame boresight argument is accepted for interface compatibility but is not used in this computation.

Parameters:
  • q (numpy.ndarray) – Current spacecraft attitude quaternion.

  • body_boresight (numpy.ndarray) – Boresight direction expressed in the spacecraft body frame.

  • os0 (Orbital_State) – Current orbital state.

Returns:

Vector part of the quaternion attitude error.

Return type:

numpy.ndarray

to_ref(os0)[source]

Generate a reference attitude and angular velocity.

Subclasses must implement this method to compute a desired reference quaternion and angular velocity based on the current orbital state.

This method is expected to return

\[\mathbf{q}_{\mathrm{ref}} \in \mathbb{R}^4, \quad \boldsymbol{\omega}_{\mathrm{ref}} \in \mathbb{R}^3\]

with \(\lVert \mathbf{q}_{\mathrm{ref}} \rVert = 1\).

Parameters:

os0 (Orbital_State) – Current orbital state.

Returns:

Reference attitude quaternion and reference angular velocity.

Return type:

Tuple[numpy.ndarray, numpy.ndarray]