SLERP#

ahrs.common.quaternion.slerp(q0: ndarray, q1: ndarray, t_array: ndarray, threshold: float = 0.9995) ndarray#

Spherical Linear Interpolation between two quaternions.

Return a valid quaternion rotation at a specified distance along the minor arc of a great circle passing through any two existing quaternion endpoints lying on the unit radius hypersphere.

It returns as many rotations between q0 and q1 as elements in t_array.

Based on the method detailed in [Wiki_SLERP].

Parameters:
  • q0 (numpy.ndarray) – First endpoint quaternion.

  • q1 (numpy.ndarray) – Second endpoint quaternion.

  • t_array (numpy.ndarray) – Array of weights to interpolate to. Values closer to 0.0 are closer to first quaternion, and values closer to 1.0 are closer to second quaternion.

  • threshold (float, default: 0.9995) – Threshold to closeness of interpolation.

Returns:

q – New array of quaternions representing the interpolated rotations.

Return type:

numpy.ndarray