Marlin: [BUG] Linear advance incompatible with S-Curve acceleration

Created on 25 Jul 2019  路  24Comments  路  Source: MarlinFirmware/Marlin

As described here https://github.com/MarlinFirmware/Marlin/issues/10812 by @ejtagle (creator of linear advance who seems to quit working on project about 9 months ago) current implementation of linear advance is incompatible with amazing new feature of Marlin S-Curve acceleration.

As far as I understand current (Marlin 2.0.x) implementation of linear advance uses trapezoidal model different from S-Curve Bezier curve profile (see detailed description provided by linear advance author by link above).

I also suspect that direct extruders with low k-factor are more susceptible due to very fast response time. Mine is dual drive BMG extruder with short (~5cm) 1.9 diameter Capricorn tubing going to e3d V6 heatbreak. K-factor is 0.03

If both (LA and SC) are enabled - underextrusion and overextrusion happen at the edges of acceleration/deceleration phases.

Artifacts are especially noticeable with high speed (150 mm/s) and low acceleration (300 mm/s2) - which means longer acceleration/deceleration time and distance and bigger area where trapezoidal model of linear advance conflicts with bezier model of S-Curve.

Attached is a picture with related artifact (speed: 150mm/s acc: 300 mm/s2 k-factor: 0.03). Artifact disappears completely with K-factor = 0
Notice consistent underextrusion at the edge of acceleration/deceleration (where trapeziodal linear-advance conflicts with bezier s-curve)
IMG_20190726_012143

Most helpful comment

Yes I did, but I have disabled S_Curve. I also tested S_Curve, with Junction Deviation, & have reverted all back to classic jerk, with Linear Advance. This seems to produce best prints for me

I believe that is the best combination for any printer with a moving (Y) bed, if you want the nice extrusions. S-Curve Acceleration dynamically adjusts the feedrate throughout acceleration and deceleration, and this takes it out of phase with S-Curve Acceleration.

I would hazard a guess that if you are printing at a certain range of speeds (on 32-bit) you could get away with S-Curve Acceleration plus a very small amount of Linear Advance just to clean up corners.

you may want to consider re-opening

It's not so much "actionable" as "awaiting LA version 2.0." And the expertise and time needed for a rewrite of the planner is not currently available.

I'll put a sanity-check warning into Marlin when these features are enabled together (especially on AVR). At the current time there's no simple way to make Linear Advance work with S-Curve Acceleration. Linear Advance predicts the duration of the move to be able to relax at the right time and with the right amount, and S-Curve Acceleration makes the duration less predictable, especially on longer lines.

All 24 comments

I use both for a few months and never noticed that. With jerks and junction deviation. My k-factor is around 0.15, direct extruder.

My understanding is that LA is not perfect when used with S-curve, but it still results in an improvement over not using LA at all. So "no s-curve with LA" is better than "s-curve with LA" which is still better than "s-curve with no LA".

but it still results in an improvement over not using LA at all. So "no s-curve with LA" is better than "s-curve with LA" which is still better than "s-curve with no LA".

Not in my case. I've updated original posts. Please look at the picture.

Did you rerun the K-factor calibration after enabling S-curve acceleration?

Did you rerun the K-factor calibration after enabling S-curve acceleration?

Calibration pattern is another story. I believe it is also subjected to this issue.
I did it multiple times with steps as low as 0.001

The thing is none of the calibration lines seems to be perfect. K=0 is one of the best actually. All the other have different issues. 0.03 is a little better than others (not ideal though).

With a proper K value & S_CURVE_ACCELERATION enabled, I haven't seen underextrusion like this on Marlin bugfix-1.1.x (MKS GEN-L/TMC2208s) or bugfix-2.0.x (SKR 1.3/TMC5160s), but I'm printing at 65mm/s or less.

With a proper K value & S_CURVE_ACCELERATION enabled, I haven't seen underextrusion like this on Marlin bugfix-1.1.x (MKS GEN-L/TMC2208s) or bugfix-2.0.x (SKR 1.3/TMC5160s), but I'm printing at 65mm/s or less.

I believe the effect is largely dependent on the path from extruder to meltzone. The tighter it is the more the effect. Bowden extruders should not suffer so much. Lower speeds with high acceleration should also suffer less (due to very low transition time).

I've also added the link to detailed description of this issue from linear advance creator who seems to stop updating it 9 months ago.

Both configs are BMG/direct drive, but I haven't pushed speeds like you're running.

I use both for a few months and never noticed that. With jerks and junction deviation. My k-factor is around 0.15, direct extruder.

As 0.15 k-factor is typical for bowden - it seems that you have pretty much space for filament bending between exctuder and meltzone. Which alleviates the symptoms.

I have k-factor of 0.03 due to short capricorn (low internal diameter) tube between extruder and meltzone.

If you print at lower speeds (around 60 mm) and with acceleration of 1000 (or higher) - artifacts also should be minimal due to very short and fast acceleration/decelerations periods.

Issue should be most prominent with tight extruder-meltzone space, high speeds and low accelerations.

Both configs are BMG/direct drive, but I haven't pushed speeds like you're running.

what is you k-factor?

I'm also running BMG direct drive into a genuine V6 - I use 0.07 as my K factor for PLA. I use 0 for PETG because I haven't yet run a calibration pattern with PETG.

what is you k-factor?

Depends on the filament. 0.07-0.15 is about average.

me use 0.05 for both PLA and PET-G, no issues as i also use S-Curve and lin. advance

Please don't close the issue for a while - I need several days to run tests and make reliable steps to reproduce for others.

Same for me. K = 0.03 speed = 100mm/s direct extruder. Sorry for fuzzy picture. I did notice this after turn on S-Curve. It did not (or vaguely) show up on short move.
Kfactor-Conflict

my prints are normal now. but with s curve and junction they were ugly, under or over extruded walls. i also dont use la anymore, i dont print fast and dont need la for quality since prints are already good. i used marlin 2 (1 week old from now), got annoying sound at y motor while doing certain moves. i guess marlin 2 needs some time to be reliable.

@vadsh had time to do more testing?

Lack of Activity
This issue is being closed due to lack of activity. If you have solved the
issue, please let us know how you solved it. If you haven't, please tell us
what else you've tried in the meantime, and possibly this issue will be
reopened.

i have disabled S_Curve & left Lin_Advance enabled

Do you have the same issue?

Yes I did, but I have disabled S_Curve. I also tested S_Curve, with Junction Deviation, & have reverted all back to classic jerk, with Linear Advance. This seems to produce best prints for me

@thinkyhead - you may want to consider re-opening

Yes I did, but I have disabled S_Curve. I also tested S_Curve, with Junction Deviation, & have reverted all back to classic jerk, with Linear Advance. This seems to produce best prints for me

I believe that is the best combination for any printer with a moving (Y) bed, if you want the nice extrusions. S-Curve Acceleration dynamically adjusts the feedrate throughout acceleration and deceleration, and this takes it out of phase with S-Curve Acceleration.

I would hazard a guess that if you are printing at a certain range of speeds (on 32-bit) you could get away with S-Curve Acceleration plus a very small amount of Linear Advance just to clean up corners.

you may want to consider re-opening

It's not so much "actionable" as "awaiting LA version 2.0." And the expertise and time needed for a rewrite of the planner is not currently available.

I'll put a sanity-check warning into Marlin when these features are enabled together (especially on AVR). At the current time there's no simple way to make Linear Advance work with S-Curve Acceleration. Linear Advance predicts the duration of the move to be able to relax at the right time and with the right amount, and S-Curve Acceleration makes the duration less predictable, especially on longer lines.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Matts-Hub picture Matts-Hub  路  3Comments

StefanBruens picture StefanBruens  路  4Comments

jerryerry picture jerryerry  路  4Comments

ahsnuet09 picture ahsnuet09  路  3Comments

Ciev picture Ciev  路  3Comments