Attitude

bsk_rl.utils.attitude: Attitude dynamics related utilities.

hill_frame_attitude(r_N: Iterable[float], v_N: Iterable[float], spin_config: dict[str, Any] | None = None) → tuple[ndarray, ndarray][source]

Creates an initially nadir-pointing attitude with configurable body spin.

The body frame is initially aligned with the Hill frame and points nadir. Spin rates in “spin_config” are specified in degrees per second.

Parameters:
  • r_N (Iterable[float]) – [m] Inertial position of the spacecraft.

  • v_N (Iterable[float]) – [m/s] Inertial velocity of the spacecraft.

  • spin_config (dict[str, Any] | None) – Body spin relative to the Hill frame. type can be “fixed” with a rate, or “uniform” with low and high rate bounds. axis can be “radial”, “tangential”, “normal”, “velocity”, “random”, or a three-element Hill-frame vector. Defaults to zero spin about the radial axis.

Returns:

Initial body attitude MRPs and body angular rate (sigma_BN, omega_BN_B).

Raises:

ValueError – If an input is not a three-vector, the orbit does not define a Hill frame, or the spin configuration is invalid.

Return type:

tuple[ndarray, ndarray]

random_tumble(maxSpinRate: float = 0.001)[source]

Generate a spacecraft random tumble with uniformly sampled conditions.

Parameters:

maxSpinRate (float) – [rad/s] Maximum spin rate.

Returns:

  • sigma_bn: [rad] Initial spacecraft attitude.

  • omega_bn: [rad/s] Initial spacecraft angular velocity.

Return type:

tuple