Re: cubic interpolator.



Tom Freedy wrote:

>   Sorry for the newbie question, can someone tell me
> how the cubic interpolator works?

Each trajectory cycle, the trajectory planner computes the next point on
the path, based on the type of motion segment (linear, circular arc),
feed, accel/decel, etc. The time for the trajectory cycle is set in the
.ini file by [TRAJ] CYCLE_TIME, typically 0.010 (10 milliseconds). Each
time this happens, the trajectory point is run through the inverse
kinematics function to generate the corresponding axis points. For a
machine tool there is no change. For a robot, XYZ don't correspond
directly to motors 123, so the inverse kinematics function does some
work. Regardless, at the end of each trajectory cycle, there is a new
set of axis points.

There is a interpolator for each axis, and each point from the new set
is appended to its associated axis interpolator. This is because the
axis controller runs at a higher frequency than the trajectory planner.
The cycle time for the axis controllers is in the .ini file as [AXIS_#]
CYCLE_TIME, typically 0.001 (1 millisecond), 10 times as often as the
trajectory cycle.

Since the trajectory planner and axis controllers all run in one piece
of code (in emc/src/emcmot/emcmot.c), what happens is the whole loops
runs at the fastest rate, and the trajectory calculations are done once
every Nth time through the loop. All the axis calcs are run at the rate
of the fastest, instead of trying to slow some of the slower ones down
by only running them every other cycle, etc. It's simpler that way.

The axis controller is where PID servo control is done, or the frequency
generator for steppers is loaded. Every one of the non-trajectory
cycles, the interpolator generates an in-between point from the last
axis point to the most recent axis point.

There are many types of interpolation that can be done:

0-order interpolation, in which the same point is used over and over
again, until the next trajectory point is computed, at which time the
new one is used over and over again. At the transition, there are jumps
in position, speed, and acceleration.

First-order interpolation, in which the in-between points fall
proportionally between the end points. At the transition, position is
continuous but there is a jump in speed, and acceleration has large
spikes.

Second-order (quadratic) interpolation, in which the in-between points
fall on a curve between the end points. At the transition, position is
continuous, and at one side (just preceding or just following the
transition), speed can be continuous. Since there's no point in only
having speed continuity half of the time, second-order interpolation is
not of practical use.

Third-order (cubic) interpolation, in which the in-between points fall
on a curve between the end points. At the transition, position and speed
are continuous, but there is a jump in acceleration, and jerk (the
change in acceleration per change in time) has large spikes.

Fourth-order (quartic) interpolation, in which the in-between points
fall on a curve between the end points. At the transition, position and
speed are continuous, and at one side (just preceding or just following
the transition), acceleration can be continuous. Since there's no point
in only having acceleration continuity half of the time, fourth-order
interpolation (like second-order interpolation) is not of practical use.
Neither are any other even-order interpolators.

Quintic interpolation, in which the in-between points fall on a curve
between the end points, like the cubic. At the transition, position,
speed, and acceleration are continuous. Jerk is bounded and doesn't have
spikes. This is the smoothest and we have code for this but haven't put
it in yet.

Each type of interpolation introduces a delay, and the higher the order,
the longer the delay. This is because the interpolating curve parameters
need to fit more input points, and they can't be constructed until all
the necessary points have been given to the interpolator. For 0th order
interpolation (no interpolation), there's no delay and you can use it
once you have a single point. For first order, you need to give it two
points in order to begin interpolating. For third (cubic), you need four
points, for fifth (quintic), you need six points, etc.

--Fred



Date Index | Thread Index | Back to archive index | Back to Mailing List Page

Problems or questions? Contact