ADCS.helpers.animations.godot.interp module

ADCS.helpers.animations.godot.interp.hermite_position(t, r, v, t_new)[source]

Cubic Hermite interpolation of position using the sampled velocity.

Linear interpolation of position cuts the chord of the orbit, an error of about a dθ²/8: ~1 m at 1 s sampling and ~1 km at 30 s in LEO, which is visible next to a metre-sized spacecraft. The Hermite error scales as a dθ⁴/384: ~1e-10 m at 1 s and ~2 cm at 30 s.

Parameters:
  • t (ndarray) – Sample times [s], strictly increasing, shape (N,).

  • r (ndarray) – Positions, shape (N, 3).

  • v (ndarray) – Velocities in position units per second, shape (N, 3).

  • t_new (ndarray) – Query times inside [t[0], t[-1]], shape (M,).

Returns:

Interpolated positions, shape (M, 3).

Return type:

ndarray

ADCS.helpers.animations.godot.interp.interp_quat(t, q, t_new)[source]

Slerp a quaternion time series onto new times (shortest arc per interval).

Parameters:
  • t (ndarray) – Sample times, strictly increasing, shape (N,).

  • q (ndarray) – Unit quaternions at t, shape (N, 4).

  • t_new (ndarray) – Query times inside [t[0], t[-1]], shape (M,).

Returns:

Interpolated unit quaternions, shape (M, 4).

Return type:

ndarray

ADCS.helpers.animations.godot.interp.quat_continuity(q)[source]

Flip quaternion signs so consecutive rows lie in the same hemisphere.

q and -q are the same rotation, but component-wise interpolation or plotting across a sign flip produces a spurious tumble. Each row is negated when its dot product with the (already corrected) previous row is negative.

Parameters:

q (ndarray) – Quaternions, shape (N, 4).

Returns:

Sign-continuous copy, shape (N, 4).

Return type:

ndarray