[shaper_calibrate] Reworked multi-file shaper calibration and small shaper selection improvements #7103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR substantially reworks how the automatic shaper selection processes multiple resonance data files. Some printers can have different resonances at different points of the build volume (e.g. bed slingers at different Y positions, some CoreXY printers when gantry or Y rods have insufficient stiffness, delta printers across build volume in general, etc.), so in order to do a proper input shaper selection, one may need to run resonance testing at different points, and somehow combine the results. The current Klipper script just combines the resonances data from different files and averages the measurements for the same frequencies. This has a downside that individual resonance peaks at specific points may be smoothened out by data at other points, sometimes leading to poor input shaper selection. The new reworked algorithm instead estimates remaining vibrations (as a percentage) for each shaper for each resonance measurement individually, and then selects the input shapers that minimizes the vibrations across all measurements. In addition, this PR brings a couple of other minor changes to the shaper selection algorithm:
Here's a comparison for a few cases of the current and the new algorithm for multi-point automatic input shaper selection:
And while you can see that the input shaper recommendations are not always different, sometimes it is more accidental, and the new algorithm still better accounts for individually measured resonances.