resonance_tester: Disable input shaping for resonance testing

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
This commit is contained in:
Dmitry Butyugin 2021-01-29 20:47:10 +01:00 committed by KevinOConnor
parent 0fb2449be0
commit a8b282d67a
4 changed files with 29 additions and 13 deletions

View File

@ -6,6 +6,11 @@ All dates in this document are approximate.
# Changes # Changes
20210201: The `TEST_RESONANCES` command will now disable input shaping
if it was previously enabled (and re-enable it after the test). In order
to override this behavior and keep the input shaping enabled, one can
pass an additional parameter `INPUT_SHAPING=1` to the command.
20210201: The `ACCELEROMETER_MEASURE` command will now append the name 20210201: The `ACCELEROMETER_MEASURE` command will now append the name
of the accelerometer chip to the output file name if the chip was given of the accelerometer chip to the output file name if the chip was given
a name in the corresponding adxl345 section of the printer.cfg. a name in the corresponding adxl345 section of the printer.cfg.

View File

@ -728,12 +728,15 @@ is enabled (also see the
all enabled accelerometer chips. all enabled accelerometer chips.
- `TEST_RESONANCES AXIS=<axis> OUTPUT=<resonances,raw_data> - `TEST_RESONANCES AXIS=<axis> OUTPUT=<resonances,raw_data>
[NAME=<name>] [FREQ_START=<min_freq>] [FREQ_END=<max_freq>] [NAME=<name>] [FREQ_START=<min_freq>] [FREQ_END=<max_freq>]
[HZ_PER_SEC=<hz_per_sec>]`: Runs the resonance test in all [HZ_PER_SEC=<hz_per_sec>] [INPUT_SHAPING=[<0:1>]]`: Runs the resonance
configured probe points for the requested axis (X or Y) and measures test in all configured probe points for the requested axis (X or Y)
the acceleration using the accelerometer chips configured for the and measures the acceleration using the accelerometer chips configured
respective axis. `OUTPUT` parameter is a comma-separated list of for the respective axis. If `INPUT_SHAPING=0` or not set (default),
which outputs will be written. If `raw_data` is requested, then the disables input shaping for the resonance testing, because it is not valid
raw accelerometer data is written into a file or a series of files to run the resonance testing with the input shaper enabled.
`OUTPUT` parameter is a comma-separated list of which outputs will be
written. If `raw_data` is requested, then the raw accelerometer data
is written into a file or a series of files
`/tmp/raw_data_<axis>_[<point>_]<name>.csv` with (`<point>_` part of `/tmp/raw_data_<axis>_[<point>_]<name>.csv` with (`<point>_` part of
the name generated only if more than 1 probe point is configured). the name generated only if more than 1 probe point is configured).
If `resonances` is specified, the frequency response is calculated If `resonances` is specified, the frequency response is calculated

View File

@ -130,18 +130,15 @@ max_accel: 7000
max_accel_to_decel: 7000 max_accel_to_decel: 7000
``` ```
(after you are done with the measurements, revert these values to their old, (after you are done with the measurements, revert these values to their old,
or the newly suggested values). Also, if you have enabled input shaper already, or the newly suggested values).
you will need to disable it prior to this test as follows:
```
SET_INPUT_SHAPER SHAPER_FREQ_X=0 SHAPER_FREQ_Y=0
```
as it is not valid to run the resonance testing with the input shaper enabled.
Run the following command: Run the following command:
``` ```
TEST_RESONANCES AXIS=X TEST_RESONANCES AXIS=X
``` ```
Note that it will create vibrations on X axis. Note that it will create vibrations on X axis. It will also disable input
shaping if it was enabled previously, as it is not valid to run the resonance
testing with the input shaper enabled.
**Attention!** Be sure to observe the printer for the first time, to make sure **Attention!** Be sure to observe the printer for the first time, to make sure
the vibrations do not become too violent (`M112` command can be used to abort the vibrations do not become too violent (`M112` command can be used to abort

View File

@ -127,6 +127,13 @@ class ResonanceTester:
if csv_output: if csv_output:
helper = shaper_calibrate.ShaperCalibrate(self.printer) helper = shaper_calibrate.ShaperCalibrate(self.printer)
input_shaper = self.printer.lookup_object('input_shaper', None)
if input_shaper is not None and not gcmd.get_int('INPUT_SHAPING', 0):
input_shaper.disable_shaping()
gcmd.respond_info("Disabled [input_shaper] for resonance testing")
else:
input_shaper = None
currentPos = toolhead.get_position() currentPos = toolhead.get_position()
Z = currentPos[2] Z = currentPos[2]
E = currentPos[3] E = currentPos[3]
@ -176,6 +183,10 @@ class ResonanceTester:
helper, axis, data) helper, axis, data)
gcmd.respond_info( gcmd.respond_info(
"Resonances data written to %s file" % (csv_name,)) "Resonances data written to %s file" % (csv_name,))
if input_shaper is not None:
input_shaper.enable_shaping()
gcmd.respond_info(
"Re-enabled [input_shaper] after resonance testing")
def cmd_SHAPER_CALIBRATE(self, gcmd): def cmd_SHAPER_CALIBRATE(self, gcmd):
toolhead = self.printer.lookup_object('toolhead') toolhead = self.printer.lookup_object('toolhead')