LinuxCNC S-Curve Accelerations

More
5 years 4 months ago #212013 by Becksvill
Replied by Becksvill on topic LinuxCNC S-Curve Accelerations
when your ready I have a 6 ton high speed cnc mill and can help out testing. really want to see jerk limited stuff come to linuxcnc!
The following user(s) said Thank You: arvidb

Please Log in or Create an account to join the conversation.

More
5 years 4 months ago #212022 by chris@cnc
Replied by chris@cnc on topic LinuxCNC S-Curve Accelerations

arvidb wrote:
But if you modify the calculated acceleration, then you also modify the speed of the tool in each instant in time, and thereby also its position at that time. If you multiply the preset (constant) acceleration value of the linear planner with a value < 1.0, then you will need to accelerate for a longer time to reach the target velocity.

Yes, the machine will no longer be precise. She will always be lagging behind. This type of acceleration is often used on toolchanger, tailstock or turretaxis. Everywhere there when the position does not have to be interpolated with a 2nd axis. Now if that is needed you can always install a servo that already has the function and do not have to make linuxcnc imprecise.
Of course, modifying the LinuxCNC's motion planner is always the better solution. Practically an incredibly complex job outside of my mind. Well then I don't want to keep you from work any longer.


Becksvill wrote:when your ready I have a 6 ton high speed cnc mill and can help out testing. really want to see jerk limited stuff come to linuxcnc!

Take a look in your servodriver manual. Maybe you find some acceleration parameter including s-curve, jerk limit, bell-shaped acceleration/deceleratio. Maybe it's enough for smooth operation.

Please Log in or Create an account to join the conversation.

More
5 years 4 months ago #212023 by arvidb
Replied by arvidb on topic LinuxCNC S-Curve Accelerations
Hehe, maybe I'm a bit of a perfectionist? ;) (Yes I am...)

But even if you did modify only the acc-cmd, how would you use it to control your machine? If I'm not mistaken, pretty much all configs use the motor-pos-cmd as the setpoint for the PID controller (that then outputs a velocity command to +/-10 V outputs, or to stepgens). So you really do need to have the pos-cmd itself change in a way that doesn't lead to infinite jerk.

Please Log in or Create an account to join the conversation.

More
5 years 4 months ago - 5 years 4 months ago #212025 by Grotius
Replied by Grotius on topic LinuxCNC S-Curve Accelerations
Hi,

The problem of c coding or mathematical knowledge is solved.
Attached a component that uses a scurve header only library.
#include "scurve.h" to your component or c code or c++ code.

I think with this example users can retrieve all the info related to the scurve's acc, dcc, timestamp points, etc.
For interpolating on arc's just give the arclenght to the function. And then interpolate the result to the arc bow.
This can be done by % pathlenght interpolation.

The output is printed with rtapi into the terminal. This is done by setting the debug to 1.

The function call from the component, wich is a line (path) of 100mm :
Code:
scurve(5, // velmax 1, // accmax 0, // vo 0, // ve 0, // xs 0, // ys 0, // zs 100, // xe 0, // ye 0, // ze 1, // time output resolution in sec, for example 0.001 is a point every ms 1); // debug 0 or 1

Rtapi result :


Now you can imagine what to do. Just play around with the code.
It has jerk, initial velocity and end velocity implemented. It has also a sampler if max velocity can not be reached.

Attached code is a "c kernel style" derivate from my original work at : github.com/grotius-cnc/S-curve-motion-pl...g/releases/tag/1.0.1

test.c
Warning: Spoiler!


scurve.h
Warning: Spoiler!
Attachments:
Last edit: 5 years 4 months ago by Grotius.
The following user(s) said Thank You: rodw

Please Log in or Create an account to join the conversation.

More
5 years 4 months ago #212027 by arvidb
Replied by arvidb on topic LinuxCNC S-Curve Accelerations

Grotius wrote:

Code:
V = Jm*(t*t)/2; V+=tr.Vo; // Add initial velocity. A = Jm*t; Sa = 0*t + Jm*(t*t*t)/6;

You are ignoring initial velocity here, in the calculation for distance (Sa).

Sa = Jm*(t*t*t)/6 + tr.Vo*t.

This is probably the same bug that I reported here (and that you never replied to)? From the plots in that post you seem to have a similar problem with end velocity.
The following user(s) said Thank You: Grotius

Please Log in or Create an account to join the conversation.

More
5 years 4 months ago - 5 years 4 months ago #212031 by Grotius
Replied by Grotius on topic LinuxCNC S-Curve Accelerations
Hi Arvidb,

Thank you for your reply.
I think you have to look at "V+=Traject.initialVelocity"
The plotted graph's at github show everything is printed ok when using vo and ve parameters.
If they where not ok. I would have seen that.

I spotted and repaired a rtapi print output with empty value's when T1, T2, T3 are 0.
Now it print's only when T1>0 , T2>0, T3>0.

Initial velocity and end velocity are just working. It was printing a empty value at line 0 of the rtapi print output.
So it was looking like a bug.

Here a function input as :
Code:
scurve(5, // velmax 2, // accmax 5, // vo 2, // ve 0, // xs 0, // ys 0, // zs 100, // xe 0, // ye 0, // ze 1, // time output resolution in sec, for example 0.001 is a point every ms 1); // debug 0 or 1


Mention the output resolution is quite low at a 1 sec interval.
Attachments:
Last edit: 5 years 4 months ago by Grotius.

Please Log in or Create an account to join the conversation.

Time to create page: 5.129 seconds
Powered by Kunena Forum