diff options
author | Dmitry Butyugin <dmbutyugin@google.com> | 2024-02-08 03:06:48 +0100 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2024-02-16 19:20:56 -0500 |
commit | 72b301a2859c3f7ed26d802dd52fc495eef6c353 (patch) | |
tree | 9c1986502927dc4c8f9056e90de5a63bee7a9507 /klippy/extras/resonance_tester.py | |
parent | 4f00f2199174eca1b022fe4b8f7f3aaedfd90b6f (diff) | |
download | kutter-72b301a2859c3f7ed26d802dd52fc495eef6c353.tar.gz kutter-72b301a2859c3f7ed26d802dd52fc495eef6c353.tar.xz kutter-72b301a2859c3f7ed26d802dd52fc495eef6c353.zip |
scripts: Added shaper tuning parameters to calibrate_shaper script
The added parameters include square_corner_velocity, shaper frequencies
to optimize, input shapers to test, input shaper damping ratio and
damping ratios to test. All these options can be useful for fine-tuning
the input shapers when the default suggestions generated by the tuning
script are not optimal.
Also the `SHAPER_CALIBRATE` command was modified to pass some of these
parameters to the shaper tuning routine. Specifically, square corner
velocity and the maximum tested frequency are used to adjust shaper
tuning and maximum acceleration recommendations.
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
Diffstat (limited to 'klippy/extras/resonance_tester.py')
-rw-r--r-- | klippy/extras/resonance_tester.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/klippy/extras/resonance_tester.py b/klippy/extras/resonance_tester.py index d5f43b77..4b29d6b8 100644 --- a/klippy/extras/resonance_tester.py +++ b/klippy/extras/resonance_tester.py @@ -1,6 +1,6 @@ # A utility class to test resonances of the printer # -# Copyright (C) 2020 Dmitry Butyugin <dmbutyugin@google.com> +# Copyright (C) 2020-2024 Dmitry Butyugin <dmbutyugin@google.com> # # This file may be distributed under the terms of the GNU GPLv3 license. import logging, math, os, time @@ -114,6 +114,8 @@ class VibrationPulseTest: if input_shaper is not None: input_shaper.enable_shaping() gcmd.respond_info("Re-enabled [input_shaper]") + def get_max_freq(self): + return self.freq_end class ResonanceTester: def __init__(self, config): @@ -302,8 +304,14 @@ class ResonanceTester: "Calculating the best input shaper parameters for %s axis" % (axis_name,)) calibration_data[axis].normalize_to_frequencies() + systime = self.printer.get_reactor().monotonic() + toolhead = self.printer.lookup_object('toolhead') + toolhead_info = toolhead.get_status(systime) + scv = toolhead_info['square_corner_velocity'] best_shaper, all_shapers = helper.find_best_shaper( - calibration_data[axis], max_smoothing, gcmd.respond_info) + calibration_data[axis], max_smoothing=max_smoothing, + scv=scv, max_freq=1.5*self.test.get_max_freq(), + logging=gcmd.respond_info) gcmd.respond_info( "Recommended shaper_type_%s = %s, shaper_freq_%s = %.1f Hz" % (axis_name, best_shaper.name, |