Cubic Spline Interpolation
三次样条插值AdvancedConnecting a sequence of waypoints into a smooth curve, continuous in both position and velocity, using piecewise cubic polynomials.
Cubic spline interpolation is a classic numerical-analysis method: given a sequence of waypoints, each pair of adjacent points is connected by a cubic polynomial segment q(t) = a₀ + a₁t + a₂t² + a₃t³, requiring position and velocity (first derivative) to be continuous where segments meet; a standard cubic spline also requires acceleration (second derivative) to be continuous, plus boundary conditions — a natural spline sets the second derivative to zero at both ends, a clamped spline instead specifies the velocity at both ends. Compared to fitting all points with a single high-degree polynomial, it avoids the Runge phenomenon's wild oscillation. In robotics it's commonly used to interpolate the sparse waypoints from a planner or a policy into the dense commands a controller needs each cycle. If only the position and velocity at the start and end of each segment are given, acceleration may still jump between segments, corresponding to a large jerk that causes an impact — which is when quintic polynomials are used instead.
ExampleA joint moving from 0 to 1 radian in 2 seconds, starting and ending at zero velocity, gives a single-segment cubic polynomial q(t) = 3(t/2)² − 2(t/2)³, with peak velocity of 0.75 rad/s at the midpoint, t = 1 second. ROS 2's joint_trajectory_controller picks its interpolation method based on what's given in the waypoints: linear interpolation for position alone, cubic spline once velocity is also given, and quintic spline once acceleration is given too.
- Also called
- Cubic Spline
- Related
- Trajectory Interpolation · Quintic Polynomial Interpolation · Waypoint · Time Parameterization · Minimum-Jerk Trajectory · Jerk
- Sources
- Wikipedia: Spline interpolation
ros2_control: joint_trajectory_controller 轨迹表示与插值 (Chinese)