From 1d4c68265d8fb51067777e8bcf45b7f4d5480523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Sun, 19 May 2024 13:02:56 +0200 Subject: [PATCH] small bug-fixes and greek alphabet for paired peaks --- docs/macros/belts_tuning.md | 4 ++-- shaketune/measurement/axes_input_shaper.py | 1 + shaketune/measurement/belts_comparison.py | 1 + shaketune/measurement/static_freq.py | 1 + shaketune/post_processing/graph_belts.py | 4 ++-- shaketune/post_processing/graph_creator.py | 1 + shaketune/post_processing/graph_shaper.py | 6 +++--- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/macros/belts_tuning.md b/docs/macros/belts_tuning.md index f354b21..a4ac25b 100644 --- a/docs/macros/belts_tuning.md +++ b/docs/macros/belts_tuning.md @@ -25,7 +25,7 @@ Then, call the `COMPARE_BELTS_RESPONSES` macro and look for the graphs in the re ### Belts frequency profiles -On these graphs, **you want both curves to look similar and overlap to form a single curve**: try to make them fit as closely as possible in frequency **and** in amplitude. Usually a belt graph is composed of one or two main peaks (more than 2 peaks can hint about mechanical problems). It's acceptable to have "noise" around the main peaks, but it should be present on both curves with a comparable amplitude. Keep in mind that when you tighten a belt, its peaks should move diagonally toward the upper right corner, changing significantly in amplitude and slightly in frequency. Additionally, the magnitude order of the main peaks *should typically* range from ~500k to ~2M on most machines. +On these graphs, **you want both curves to look similar and overlap to form a single curve**: try to make them fit as closely as possible in frequency **and** in amplitude. Usually a belt graph is composed of one or two main paired peaks (more than 2 peaks can hint about mechanical problems). It's acceptable to have "noise" around the main peaks, but it should be present on both curves with a comparable amplitude. Keep in mind that when you tighten a belt, its peaks should move diagonally toward the upper right corner, changing significantly in amplitude and slightly in frequency. Additionally, the magnitude order of the main peaks *should typically* range from ~500k to ~2M on most machines. Aside from the actual belt tension, the resonant frequency/amplitude of the curves depends primarily on three parameters: - the *mass of the toolhead*, which is identical on CoreXY, CrossXY and H-Bot machines for both belts. So this will unlikely have any effect here @@ -40,7 +40,7 @@ The Cross-Belts plot is an innovative cool way to compare the frequency profiles The good zone, wider at the bottom (low-amplitude regions where the deviation doesn't matter much) and narrower at the top right (high-energy region where the main peaks lie), represents acceptable deviations. So **you want all points to be close to the ideal center line and as many as possible within the green zone**, as this means that the bands are well tuned and behave similarly. -Paired peaks of exactly the same frequency will be on the same point (labeled A1/A2, ...) and the distance from the center line will show the difference in energy. For paired peaks that also have a frequency delta between them, they are displayed as two points (labeled A1 and A2, ...) and the additional distance between them along the plotted line represents their frequency delta. +Paired peaks of exactly the same frequency will be on the same point (labeled α1/α2, β1/β2, ...) and the distance from the center line will show the difference in energy. For paired peaks that also have a frequency delta between them, they are displayed as two points (labeled α1 and α2, ...) and the additional distance between them along the plotted line represents their frequency delta. ### Estimated similarity and mechanical issues indicator diff --git a/shaketune/measurement/axes_input_shaper.py b/shaketune/measurement/axes_input_shaper.py index 87d7734..f10fa63 100644 --- a/shaketune/measurement/axes_input_shaper.py +++ b/shaketune/measurement/axes_input_shaper.py @@ -57,6 +57,7 @@ def axes_shaper_calibration(gcmd, config, st_thread: ShakeTuneThread) -> None: point = (x, y, z) toolhead.manual_move(point, feedrate_travel) + toolhead.dwell(0.5) # Configure the graph creator creator = st_thread.get_graph_creator() diff --git a/shaketune/measurement/belts_comparison.py b/shaketune/measurement/belts_comparison.py index d2f4857..5b9bcb1 100644 --- a/shaketune/measurement/belts_comparison.py +++ b/shaketune/measurement/belts_comparison.py @@ -56,6 +56,7 @@ def compare_belts_responses(gcmd, config, st_thread: ShakeTuneThread) -> None: point = (x, y, z) toolhead.manual_move(point, feedrate_travel) + toolhead.dwell(0.5) # Configure the graph creator motors_config_parser = MotorsConfigParser(config, motors=None) diff --git a/shaketune/measurement/static_freq.py b/shaketune/measurement/static_freq.py index 1dbf188..0699dab 100644 --- a/shaketune/measurement/static_freq.py +++ b/shaketune/measurement/static_freq.py @@ -50,6 +50,7 @@ def excitate_axis_at_freq(gcmd, config) -> None: point = (x, y, z) toolhead.manual_move(point, feedrate_travel) + toolhead.dwell(0.5) min_freq = freq - 1 max_freq = freq + 1 diff --git a/shaketune/post_processing/graph_belts.py b/shaketune/post_processing/graph_belts.py index 0a5c46b..94a04e2 100644 --- a/shaketune/post_processing/graph_belts.py +++ b/shaketune/post_processing/graph_belts.py @@ -22,7 +22,7 @@ matplotlib.use('Agg') from ..helpers.common_func import detect_peaks, parse_log, setup_klipper_import from ..helpers.console_output import ConsoleOutput -ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # For paired peaks names +ALPHABET = 'αβγδεζηθικλμνξοπρστυφχψω' # For paired peak names (using the Greek alphabet to avoid confusion with belt names) PEAKS_DETECTION_THRESHOLD = 0.1 # Threshold to detect peaks in the PSD signal (10% of max) DC_MAX_PEAKS = 2 # Maximum ideal number of peaks @@ -524,7 +524,7 @@ def belts_calibration( # Adding Shake&Tune version in the top right corner if st_version != 'unknown': - fig.text(0.995, 0.985, st_version, ha='right', va='bottom', fontsize=8, color=KLIPPAIN_COLORS['purple']) + fig.text(0.995, 0.980, st_version, ha='right', va='bottom', fontsize=8, color=KLIPPAIN_COLORS['purple']) return fig diff --git a/shaketune/post_processing/graph_creator.py b/shaketune/post_processing/graph_creator.py index 22d868c..b937055 100644 --- a/shaketune/post_processing/graph_creator.py +++ b/shaketune/post_processing/graph_creator.py @@ -111,6 +111,7 @@ class BeltsGraphCreator(GraphCreator): ) fig = belts_calibration( lognames=[str(path) for path in lognames], + kinematics=self._kinematics, klipperdir=str(self._config.klipper_folder), accel_per_hz=self._accel_per_hz, st_version=self._version, diff --git a/shaketune/post_processing/graph_shaper.py b/shaketune/post_processing/graph_shaper.py index 26962e8..c1f2be5 100644 --- a/shaketune/post_processing/graph_shaper.py +++ b/shaketune/post_processing/graph_shaper.py @@ -381,9 +381,9 @@ def shaper_calibration( title_line4 = '' title_line5 = '' fig.text(0.12, 0.957, title_line2, ha='left', va='top', fontsize=16, color=KLIPPAIN_COLORS['dark_purple']) - fig.text(0.58, 0.965, title_line3, ha='left', va='top', fontsize=10, color=KLIPPAIN_COLORS['dark_purple']) - fig.text(0.58, 0.951, title_line4, ha='left', va='top', fontsize=10, color=KLIPPAIN_COLORS['dark_purple']) - fig.text(0.58, 0.919, title_line5, ha='left', va='top', fontsize=10, color=KLIPPAIN_COLORS['dark_purple']) + fig.text(0.58, 0.963, title_line3, ha='left', va='top', fontsize=10, color=KLIPPAIN_COLORS['dark_purple']) + fig.text(0.58, 0.948, title_line4, ha='left', va='top', fontsize=10, color=KLIPPAIN_COLORS['dark_purple']) + fig.text(0.58, 0.933, title_line5, ha='left', va='top', fontsize=10, color=KLIPPAIN_COLORS['dark_purple']) # Plot the graphs plot_freq_response(