Cubic Splines in Joint Space
Cubic spline interpolation creates a smooth trajectory between two points by using a cubic polynomial to interpolate the position. This results in smooth position and velocity profiles. Note that if we also wanted a smooth acceleration profile, we would need to use a quintic spline. But a cubic spline is sufficient for smooth profiles. The cubic polynomial is defined as:
\[p(t) = a_0 + a_1 t + a_2 t^2 + a_3 t^3\]If we start with the boundary conditions:
\[p(0) = \theta_0, \quad p(T) = \theta_f, \quad \dot{p}(0) = 0, \quad \dot{p}(T) = 0\]then we can solve for the coefficients \((a_0, a_1, a_2, a_3)\) as follows:
\[a_0 = \theta_0, \quad a_1 = 0, \quad a_2 = \frac{3(\theta_f - \theta_0)}{T^2}, \quad a_3 = -\frac{2(\theta_f - \theta_0)}{T^3}\]A demonstration of this cubic spline interpolation is shown below. For comparison purposes, a discrete change in desired joint position (called a step input) as well as a linear interpolation between the start and end positions are also shown. You should be able to see that the cubic spline results in smooth position, velocity, and acceleration profiles compared to the other two methods.