LinuxCNC S-Curve Accelerations
- endian
-
- Offline
- Platinum Member
-
Less
More
- Posts: 331
- Thank you received: 131
30 Mar 2026 16:09 - 30 Mar 2026 17:59 #344958
by endian
my next observation is - high value of G64 tolerance around 0.1(650us spikes) is spiking more than 0.001(250us spikes)
best setup till now ... most influential spiking thingy is the
Replied by endian on topic LinuxCNC S-Curve Accelerations
I think the best way to apply that... its consulate with Luca or Yang Yang if they are allready not using something like that now... I'm not that familiar with their code till now ... it toooo way complicated for meYes Rod .. it is solution but it is creating constant delay between control position -> DFIR -> current position of tool ....
It will not add any delay as it should be applied as the acceleration is calculated or read per servo cycle. Just not sure how you need to use it.
the size of the buffer is configurable.
Any other published moving average solution wanted to use loops which are a source of delay so I devised this..
One of the cleverest algorithms I have ever coded...
my next observation is - high value of G64 tolerance around 0.1(650us spikes) is spiking more than 0.001(250us spikes)
best setup till now ... most influential spiking thingy is the
OPTIMIZATION_DEPTH... this creates real messARC_BLEND_ENABLE = 1
ARC_BLEND_FALLBACK_ENABLE = 1
ARC_BLEND_OPTIMIZATION_DEPTH = 8
ARC_BLEND_RAMP_FREQ = 64
ARC_BLEND_GAP_CYCLES = 64
TC_QUEUE_SIZE = 200
Last edit: 30 Mar 2026 17:59 by endian. Reason: setup add
The following user(s) said Thank You: rodw
Please Log in or Create an account to join the conversation.
- NWE
-
- Offline
- Elite Member
-
Less
More
- Posts: 198
- Thank you received: 50
30 Mar 2026 22:59 #344976
by NWE
Replied by NWE on topic LinuxCNC S-Curve Accelerations
Thanks, I've been wondering too. I've been dreaming about kinematics using multiple realtime threads. Does anyone know whether/why it would not do?Why can't you use more than one thread instead of a FGPA?
Please Log in or Create an account to join the conversation.
- ewlsey
- Offline
- New Member
-
Less
More
- Posts: 7
- Thank you received: 4
31 Mar 2026 00:40 #344979
by ewlsey
Replied by ewlsey on topic LinuxCNC S-Curve Accelerations
Go easy on me. I tried to read through this whole thread, but there's a lot to digest.
How does the current linuxcnc approach compare to how S curve acceleration is being done in GRBLHAL?
I've tried to read the linuxcnc servo loop code, but it's pretty well impenetrable.
However, GRBLHAL is very cleanly written and well commented. From what I can see, it has many features discussed here.
It has a backwards (and forwards) buffered trajectory planner with prescribed tangential acceleration. It has buffered segment interpolation. Both run outside the realtime loop, but the segment buffer is fast enough for feed overrides and holds to feel instantaneous.
I know it's not a "real" control, but it's pretty amazing they could get all that to work (along with g-code interpreter, etc) on an 8 bit AVR microcontroller.
The current HAL version offers jerk limited acceleration, though I have to say its utility is a bit questionable for industrial machines. I believe the GRBL equivalent of the "servo loop" only runs at 100Hz, so you would need really low jerk values to see an effect. But, the framework seems sound.
How does the current linuxcnc approach compare to how S curve acceleration is being done in GRBLHAL?
I've tried to read the linuxcnc servo loop code, but it's pretty well impenetrable.
However, GRBLHAL is very cleanly written and well commented. From what I can see, it has many features discussed here.
It has a backwards (and forwards) buffered trajectory planner with prescribed tangential acceleration. It has buffered segment interpolation. Both run outside the realtime loop, but the segment buffer is fast enough for feed overrides and holds to feel instantaneous.
I know it's not a "real" control, but it's pretty amazing they could get all that to work (along with g-code interpreter, etc) on an 8 bit AVR microcontroller.
The current HAL version offers jerk limited acceleration, though I have to say its utility is a bit questionable for industrial machines. I believe the GRBL equivalent of the "servo loop" only runs at 100Hz, so you would need really low jerk values to see an effect. But, the framework seems sound.
Please Log in or Create an account to join the conversation.
- NWE
-
- Offline
- Elite Member
-
Less
More
- Posts: 198
- Thank you received: 50
31 Mar 2026 01:06 #344980
by NWE
GRBLHAL = 32 bit
GRBL = 8 bit
Thanks for bringing this up. A long time ago I read all about GRBL 8-bit and sort of gave up on it. Now I notice the main project is 32 bit. Now that seems worthwhile. Cheap 32-bit MCUs today pack some punch.
That said, I'll leave the S-curve talk for the pros.
Replied by NWE on topic LinuxCNC S-Curve Accelerations
Just now I discovered:Go easy on me. I tried to read through this whole thread, but there's a lot to digest.
--snip--
I know it's not a "real" control, but it's pretty amazing they could get all that to work (along with g-code interpreter, etc) on an 8 bit AVR microcontroller.
GRBLHAL = 32 bit
GRBL = 8 bit
Thanks for bringing this up. A long time ago I read all about GRBL 8-bit and sort of gave up on it. Now I notice the main project is 32 bit. Now that seems worthwhile. Cheap 32-bit MCUs today pack some punch.
That said, I'll leave the S-curve talk for the pros.
Please Log in or Create an account to join the conversation.
- ruediger123
- Offline
- Junior Member
-
Less
More
- Posts: 29
- Thank you received: 33
31 Mar 2026 17:40 #344999
by ruediger123
Replied by ruediger123 on topic LinuxCNC S-Curve Accelerations
The following user(s) said Thank You: endian
Please Log in or Create an account to join the conversation.
- grandixximo
-
Topic Author
- Away
- Elite Member
-
Less
More
- Posts: 292
- Thank you received: 350
01 Apr 2026 01:43 - 01 Apr 2026 03:12 #345019
by grandixximo
Replied by grandixximo on topic LinuxCNC S-Curve Accelerations
@ruediger123
I believe the jerk is not matained, because it is not possible to maintain it with your cycle time and your tolerance, you are purposely settings the machine up to spike, and it will because there is no choice if it follows your thread cycle, if it follows your tolerance, and it follows your set feed, how do you propose this should be fixed? One of these limits should be relaxed, which one?
I don't think I should hard code limits, it should be up to the integrator to setup the machine with proper cycle time and limits according to processing requirements
@endian @rodw
TP2 in a separate thread should be the medicine that fix our ailments, filtering, NURBS, all will be taken into consideration, it is an active development and testing on our end, not ready to share yet.
I believe the jerk is not matained, because it is not possible to maintain it with your cycle time and your tolerance, you are purposely settings the machine up to spike, and it will because there is no choice if it follows your thread cycle, if it follows your tolerance, and it follows your set feed, how do you propose this should be fixed? One of these limits should be relaxed, which one?
I don't think I should hard code limits, it should be up to the integrator to setup the machine with proper cycle time and limits according to processing requirements
@endian @rodw
TP2 in a separate thread should be the medicine that fix our ailments, filtering, NURBS, all will be taken into consideration, it is an active development and testing on our end, not ready to share yet.
Last edit: 01 Apr 2026 03:12 by grandixximo.
The following user(s) said Thank You: endian, NWE
Please Log in or Create an account to join the conversation.
- endian
-
- Offline
- Platinum Member
-
Less
More
- Posts: 331
- Thank you received: 131
01 Apr 2026 06:11 #345028
by endian
thanks
Replied by endian on topic LinuxCNC S-Curve Accelerations
Do you think that TP1 + TP2 should be in the separate thread ?I don't think I should hard code limits, it should be up to the integrator to setup the machine with proper cycle time and limits according to processing requirements
@endian @rodw
TP2 in a separate thread should be the medicine that fix our ailments, filtering, NURBS, all will be taken into consideration, it is an active development and testing on our end, not ready to share yet.
thanks
Please Log in or Create an account to join the conversation.
- grandixximo
-
Topic Author
- Away
- Elite Member
-
Less
More
- Posts: 292
- Thank you received: 350
01 Apr 2026 07:05 #345030
by grandixximo
Replied by grandixximo on topic LinuxCNC S-Curve Accelerations
Short answer: no.
Longer answer:
Kinda, TP1 and TP2 are different ideas/models/architectures, TP2 is what can be moved in a separate thread, because it was made to plan out of RT, TP1 idea was to run in RT, both are valid ways to solve the jerk-limit, so me and YY agree both can live, they are different approaches, with their own pros and cons, moving TP1 to a separate thread would basically mean TP2.
Longer answer:
Kinda, TP1 and TP2 are different ideas/models/architectures, TP2 is what can be moved in a separate thread, because it was made to plan out of RT, TP1 idea was to run in RT, both are valid ways to solve the jerk-limit, so me and YY agree both can live, they are different approaches, with their own pros and cons, moving TP1 to a separate thread would basically mean TP2.
The following user(s) said Thank You: endian
Please Log in or Create an account to join the conversation.
- ruediger123
- Offline
- Junior Member
-
Less
More
- Posts: 29
- Thank you received: 33
03 Apr 2026 19:27 #345128
by ruediger123
Replied by ruediger123 on topic LinuxCNC S-Curve Accelerations
@grandixximo
The machine is congigured with a 1ms servo cycle, the speed with 15 m/min, the acceleration with 5 m/s² and the jerk with 50 m/s³ so nothing unusual for servo axes.
P64 P0.01 Q0.0 is also not unusual.
In my opinion, the limits for jerk, acceleration and speed should not be exceeded so that the behavior of the machine is predictable.
The unusual thing from my point of view is that MAX_LINEAR_JERK and MAX_JERK are different.
If there are restrictions on certain parameters, please let me know so that I can take them into account in my tests.
The machine is congigured with a 1ms servo cycle, the speed with 15 m/min, the acceleration with 5 m/s² and the jerk with 50 m/s³ so nothing unusual for servo axes.
P64 P0.01 Q0.0 is also not unusual.
In my opinion, the limits for jerk, acceleration and speed should not be exceeded so that the behavior of the machine is predictable.
The unusual thing from my point of view is that MAX_LINEAR_JERK and MAX_JERK are different.
If there are restrictions on certain parameters, please let me know so that I can take them into account in my tests.
Please Log in or Create an account to join the conversation.
- grandixximo
-
Topic Author
- Away
- Elite Member
-
Less
More
- Posts: 292
- Thank you received: 350
04 Apr 2026 01:36 - 04 Apr 2026 03:20 #345135
by grandixximo
Replied by grandixximo on topic LinuxCNC S-Curve Accelerations
@ruediger123
The restriction is the corner itself. A sharp corner is a mathematical direction discontinuity. The velocity vector must change by ~191 mm/s across a 45° turn. With a 1ms cycle time, respecting 50 m/s³ jerk would require spreading that change over ~3800 cycles, during which the machine travels nearly a meter. No feed rate fixes this, the problem is geometric.
The only mathematically correct solution within your parameters is for the planner to detect that no valid cornering speed exists that satisfies the jerk limit given the available segment geometry, and fall back to a full stop at the corner. That is exactly G61.1 behavior.
This is actually a valid point and potentially a missing feature: the junction velocity calculation should be jerk-aware, and when the jerk-constrained cornering speed rounds down to zero, the planner should stop rather than arrive too fast and spike. Currently it may only be acceleration-aware at the junction, which allows a non-zero entry speed that looks acceptable to the acceleration limit but still violates jerk because the ramp does not fit in the available geometry.
The practical workaround in the meantime is either G61.1 explicitly, or a P tolerance of several mm to give the planner room for a proper S-curve through the corner. P0.01 is geometrically equivalent to sharp.
The restriction is the corner itself. A sharp corner is a mathematical direction discontinuity. The velocity vector must change by ~191 mm/s across a 45° turn. With a 1ms cycle time, respecting 50 m/s³ jerk would require spreading that change over ~3800 cycles, during which the machine travels nearly a meter. No feed rate fixes this, the problem is geometric.
The only mathematically correct solution within your parameters is for the planner to detect that no valid cornering speed exists that satisfies the jerk limit given the available segment geometry, and fall back to a full stop at the corner. That is exactly G61.1 behavior.
This is actually a valid point and potentially a missing feature: the junction velocity calculation should be jerk-aware, and when the jerk-constrained cornering speed rounds down to zero, the planner should stop rather than arrive too fast and spike. Currently it may only be acceleration-aware at the junction, which allows a non-zero entry speed that looks acceptable to the acceleration limit but still violates jerk because the ramp does not fit in the available geometry.
The practical workaround in the meantime is either G61.1 explicitly, or a P tolerance of several mm to give the planner room for a proper S-curve through the corner. P0.01 is geometrically equivalent to sharp.
Last edit: 04 Apr 2026 03:20 by grandixximo.
The following user(s) said Thank You: tommylight, besriworld, endian
Please Log in or Create an account to join the conversation.
Time to create page: 0.238 seconds