pytransform3d.rotations.quaternion_gradient

pytransform3d.rotations.quaternion_gradient(Q, dt=1.0)[source]

Time-derivatives of a sequence of quaternions.

Note that this function does not provide the exact same functionality for quaternions as NumPy’s gradient function for positions. Gradients are always computed as central differences except the first and last gradient. We additionally accept a parameter dt that defines the time interval between each quaternion. Note that this means that we expect this to be constant for the whole sequence.

Parameters
Qarray-like, shape (n_steps, 4)

Quaternions to represent rotations: (w, x, y, z)

dtfloat, optional (default: 1)

Time interval between steps. If you have non-constant dt, you can pass 1 and manually divide angular velocities by their corresponding time interval afterwards.

Returns
Aarray-like, shape (n_steps, 3)

Angular velocities in a compact axis-angle representation. Each angular velocity represents the rotational offset after one unit of time.

Examples using pytransform3d.rotations.quaternion_gradient