Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New zero slowdown linear advance algorithm #27352

Draft
wants to merge 5 commits into
base: bugfix-2.1.x
Choose a base branch
from

Conversation

dbuezas
Copy link
Contributor

@dbuezas dbuezas commented Aug 13, 2024

Description

Linear advance reduces the max acceleration so that the la_advance_rate is kept below e_jerk. The existing implementation also suffers from some degree of quality loss due to it not accounting for the discontinuities in pressure due to both movement jerk and changes in line width (i.e the ratio of e_steps to step_count).

This WIP PR removes that restriction by handling linear advance acceleration in its own isr, and allowing it to not be perfectly in synch with movement. This should theoretically reduce quality, but in practice it doesn't seem to be a problem. In fact, since this algorithm does account for movement jerk and line width changes, the resulting quality is improved beyond the original existing algorithm, and that at higher printing speeds.

The algorithm is as follows:

  • Compute the target pressure (in steps) as current_rate * k
  • Compare with current pressure and accelerate/decelerate extruder to match it.
  • When accelerating the extruder, avoid overshooting by ensuring that the extruder will be able to break in time to match the target with zero speed.
  • When loading a new block rescale the current (residual) nozzle pressure to the new movement step rate to extrusion step rate ratio. (This handles the aforementioned discontinuities)

This is work in progress.
Optimisation so it can run in slower machines is pending (and ideas very welcome)

Requirements

Definitely a 32 bit board. For now, maybe even one with a floating point unit

Benefits

Better quality, faster prints

Configurations

#define LA_ZERO_SLOWDOWN

Related Issues

#27259

@dbuezas dbuezas marked this pull request as draft August 13, 2024 19:51
@dbuezas
Copy link
Contributor Author

dbuezas commented Aug 14, 2024

image
TL;DR: new algorithm is faster and has higher quality.

TOP LEFT: 300mm/s 4000mm/s2, K=0, 30 mins
TOP RIGHT: ~82mm/s K=0.15 (OLD ALGORITHM limits to ~1500mm/s2). 48 minutes
BOTTOM LEFT: 300mm/s 4000/s2, K=0.09, 30 mins. (yes k changes a lot with high speeds, non linear!)
BOTTOM RIGHT: ~82mm/s 3000mm/s2, k=0.15, 37 mins
There's a printing artefact on the top right corner of the inner hexagon on the old algorithm. It's gone with the new algorithm. I think that's the unaccounted for movement jerk and/or line width changes
Discoloration due to lower temperatures on the bottom left makes it look as if there was more blobbing than there is.

@dbuezas dbuezas force-pushed the dbuezas/zero-slowdown-lin-adv branch from 8104252 to 4d34605 Compare August 14, 2024 15:35
@dbuezas dbuezas mentioned this pull request Aug 17, 2024
5 tasks
@dbuezas dbuezas force-pushed the dbuezas/zero-slowdown-lin-adv branch from 5b13ba7 to 49a0bf0 Compare August 18, 2024 08:40
@dbuezas dbuezas changed the title Pressure follower New zero slowdown linear advance algorithm Aug 18, 2024
@thinkyhead thinkyhead force-pushed the bugfix-2.1.x branch 3 times, most recently from 37d77d6 to aa44542 Compare September 28, 2024 01:10
@ThomasToka
Copy link
Contributor

ThomasToka commented Sep 28, 2024

Edit: Found it. My error. Will try it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants