bundles / scipy 1.17.1 / scipy / spatial / transform / _rotation_spline / RotationSpline
class
scipy.spatial.transform._rotation_spline:RotationSpline
Signature
class RotationSpline ( times , rotations ) Members
Summary
Interpolate rotations with continuous angular rate and acceleration.
Extended Summary
The rotation vectors between each consecutive orientation are cubic functions of time and it is guaranteed that angular rate and acceleration are continuous. Such interpolation are analogous to cubic spline interpolation.
Refer to [1] for math and implementation details.
Parameters
times: array_like, shape (N,)Times of the known rotations. At least 2 times must be specified.
rotations: `Rotation` instanceRotations to perform the interpolation between. Must contain N rotations.
Methods
__call__
Examples
from scipy.spatial.transform import Rotation, RotationSpline import numpy as np✓
times = [0, 10, 20, 40] angles = [[-10, 20, 30], [0, 15, 40], [-30, 45, 30], [20, 45, 90]] rotations = Rotation.from_euler('XYZ', angles, degrees=True)✓
spline = RotationSpline(times, rotations)
✓angular_rate = np.rad2deg(spline(times, 1)) angular_acceleration = np.rad2deg(spline(times, 2)) times_plot = np.linspace(times[0], times[-1], 100) angles_plot = spline(times_plot).as_euler('XYZ', degrees=True) angular_rate_plot = np.rad2deg(spline(times_plot, 1)) angular_acceleration_plot = np.rad2deg(spline(times_plot, 2))✓
import matplotlib.pyplot as plt
✓plt.plot(times_plot, angles_plot) plt.plot(times, angles, 'x') plt.title("Euler angles")✗
plt.show()
✓
plt.plot(times_plot, angular_rate_plot) plt.plot(times, angular_rate, 'x') plt.title("Angular rate")✗
plt.show()
✓
plt.plot(times_plot, angular_acceleration_plot) plt.plot(times, angular_acceleration, 'x') plt.title("Angular acceleration")✗
plt.show()
✓
Aliases
-
scipy.spatial.transform.RotationSpline