archimedes.spatial.quaternion_kinematicsΒΆ

archimedes.spatial.quaternion_kinematics(
q: ndarray,
w: ndarray,
baumgarte: float | None = None,
) ndarrayΒΆ

Quaternion kinematical equations

If the rotation represents the attitude of a body B relative to a frame A, then w should be the body relative angular velocity, i.e. Ο‰_B.

The derivative is computed using quaternion kinematics:

dq/dt = 0.5 * q βŠ— [0, Ο‰]

where βŠ— is the quaternion multiplication operator.

The method optionally support Baumgarte stabilization to preserve unit normalization. For a stabilization factor Ξ», the full time derivative is:

dq/dt = 0.5 * q βŠ— [0, Ο‰] - Ξ» * (||q||Β² - 1) * q

Parameters:
  • q (array_like, shape (4,)) – Unit quaternion representing rotation, in the format [q0, q1, q2, q3] where q0 is the scalar part.

  • w (array_like, shape (3,)) – Angular velocity vector in body frame.

  • baumgarte (float, optional) – Baumgarte stabilization factor. If not None, Baumgarte stabilization is applied to enforce unit norm constraint. Default is None (no stabilization).

Returns:

Time derivative of the quaternion.

Return type:

np.ndarray, shape (4,)