Testing sinusoidal S-curves

My main goal here was to keep a simple mechanism to be easy to calculate and able to be included into 8-bit firmware like Marlin. Which by the way already has support for s-curves for quite a while (at least on this mod for Ultimaker).

So the goal is to have a function f(t) that will map the speed at each given moment but in a way that the maximum speed will be reached at the same time as it would using a uniform acceleration, so the rest of the math and motion planning is not affected. In doing so, the peak acceleration is going to be higher than that when using uniform acceleration. However, if that is a problem it is ok to reduce the maximum acceleration so the system can work flawlessly.

I have tested a couple of functions, both based on sinusoidal functions, the former is:
f(t)=V*(1-cos(PI*(t/t1))/2 (where V is max speed and t1 marks the end of the S-curve ramping up). It is the dotted-green curve below. The shape of the acceleration for this speed pattern is the dotted-pink curve.


The second candidate is the solid-red curve, that is smoother on the edges but has a higher slope in the middle. That is the function f(t)=V*(2*PI*t/t1-sin(2*PI*t/t1))/2/PI. The shape of the acceleration for this speed pattern is the solid-blue curve. 

So I did some tests on a sample one-axis machine, running dcservo and moving a bit of liquid that should give us an idea of the vibration each one of the motion patterns will create (I am using the ramp of the trapezoidal motion as control case here).

The following video shows the result, running a random sequence of movements, all with the same maximum speed. Acceleration is modulated in a way that for each case, the same amount of time (t1) is needed for reaching the desired maximum speed.

 

While the code is not thoroughly tested but more alpha code, it is available here.



Comments

Khalid Khattak said…
Wonderful work...

Popular posts from this blog

VFD control with Arduino using RS485 link

4xiDraw: Another pen plotter

One Arduino controlling two brushless DC motors