4
$\begingroup$

I've got a 1D signal (position of a servo motor over time) and I've extracted 'peaks'/'key' positions picking running average "local extrema" points.

Below is are 2 plots from 2 servos and the white markers indicate key positions I'd like to interpolate between:

Servo ZeroX

I've played with linear interpolation, but the motion looks robotic. I'd like to get a more natural/smoother motion and I imagine it's posible by using bezier interpolation between two key points. These two points would be the start and end point of the bezier I imagine, but I need to solve/find out the 'anchor' points as well. Since I have all the points I can get the velocities as well I imagine, but not sure how to plug them into the equation.

Any idea on how I can find the other two members of a bezier equation for easing/smooth interpolation ?

Also, since I'm new to this: is my approach ok ? Is there a simpler solution I'm missing ?

$\endgroup$
  • $\begingroup$ Have you looked on spline interpolation? You need to specify only the known points and their distances. These "piece-wise" polynomials can be computed for any segment of your dataset (the border ones need to be treated differently) and smooth transition between any adjacent segments are guaranteed. $\endgroup$ – Libor Aug 29 '12 at 10:18
4
$\begingroup$

When you talk about bezier curves, it sounds like you think about them from an "illustrator" point of view, which is not totally right when it comes to spline interpolation (most probably what you are looking for).

Splines are piecewise curves that pass thrhough points. Bezier curves are third degrees splines between two points, and a series of them can form what "looks like" a single curve in a drawing aplication, but are actually lots of individual curves tied together (it counts as if the intermediate knots are doubled).

Illustration concepts aside, I think you could choose any 1-D spline interpolator from some popular library. I use Python, so I'd go with Scipy, take a look:

http://docs.scipy.org/doc/scipy/reference/interpolate.html#d-splines

$\endgroup$
  • $\begingroup$ ALGLIB - another library that support spline interpolation out of the box (C++, C#, VB.NET, CPython, IronPython). $\endgroup$ – Libor Sep 3 '12 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.