Frix-x / klippain-shaketune

Klipper streamlined input shaper workflow and calibration tools
GNU General Public License v3.0
627 stars 70 forks source link

Unable to produce graph for v0.2 y-axis - AttributeError: 'NoneType' object has no attribute 'upper' #1

Closed ningpj closed 10 months ago

ningpj commented 10 months ago

K-Shake&Tune module branch

Version

v1.0.2-0-gc102d414

Describe the bug and expected behavior

resonances_20231027_213851_Y.csv Hi,

Printer: Voron v0.2

Thanks for the awesome calibration tools! I have encountered this error a few times with your test branch and have been able to reproduce it with the new release. While I know I have a few issues to work through on Y I wanted to make sure I captured and reported this before continuing to tune the printer and have managed to get Y plotted previously when belt tensions were different. belts works fine for X&Y and IS graphs for X only. IS graphs for Y fails and returns the following exception.

21:38:48 // Writing raw accelerometer data to /tmp/raw_data_y_y.csv file 21:38:48 Y axis shaper graphs generation... 21:38:48 // Running Command {plot_graph}...: 21:39:51 // Fitted shaper 'zv' frequency = 75.8 Hz (vibrations = 17.5%, smoothing ~= 0.033) // To avoid too much smoothing with 'zv', suggested max_accel <= 22400 mm/sec^2 // Fitted shaper 'mzv' frequency = 46.8 Hz (vibrations = 2.8%, smoothing ~= 0.093) // To avoid too much smoothing with 'mzv', suggested max_accel <= 6500 mm/sec^2 // Fitted shaper 'ei' frequency = 64.8 Hz (vibrations = 3.4%, smoothing ~= 0.077) // To avoid too much smoothing with 'ei', suggested max_accel <= 7800 mm/sec^2 // Fitted shaper '2hump_ei' frequency = 62.6 Hz (vibrations = 0.5%, smoothing ~= 0.138) // To avoid too much smoothing with '2hump_ei', suggested max_accel <= 4400 mm/sec^2 // Fitted shaper '3hump_ei' frequency = 58.8 Hz (vibrations = 0.3%, smoothing ~= 0.237) // To avoid too much smoothing with '3hump_ei', suggested max_accel <= 2500 mm/sec^2 // Recommended shaper is ei @ 64.8 Hz // Axis has a resonant frequency ω0=72.5Hz with an estimated damping ratio ζ=0.056 // Peaks detected on the graph: 6 @ 6.2, 47.9, 72.5, 94.2, 131.2, 146.6 Hz (3 above effect threshold) // Traceback (most recent call last): // File "/home/pi/printer_data/config/K-ShakeTune/scripts/is_workflow.py", line 214, in 21:39:51 // main() // File "/home/pi/printer_data/config/K-ShakeTune/scripts/is_workflow.py", line 200, in main 21:39:51 // fig, png_filename = get_shaper_graph() // File "/home/pi/printer_data/config/K-ShakeTune/scripts/is_workflow.py", line 107, in get_shaper_graph // fig = shaper_calibration([new_file], KLIPPER_FOLDER) // File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/graph_shaper.py", line 326, in shaper_calibration 21:39:51 // peaks = plot_freq_response_with_damping(ax1, calibration_data, shapers, selected_shaper, fr, zeta, max_freq) // File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/graph_shaper.py", line 233, in plot_freq_response_with_damping 21:39:51 // ax2.plot([], [], ' ', label="Recommended low vibrations shaper: %s @ %.1f Hz" % (no_vibr_shaper.upper(), no_vibr_shaper_freq)) // AttributeError: 'NoneType' object has no attribute 'upper' resonances_20231027_213851_Y.csv

Additional information and klippy.log

No response

turboproc commented 10 months ago

Same here, or looks at least the same:

17:53
Command {plot_graph} finished
17:53
peaks = plot_freq_response_with_damping(ax1, calibration_data, shapers, selected_shaper, fr, zeta, max_freq)
File "/home/fly/klippain_shaketune/K-ShakeTune/scripts/graph_shaper.py", line 245, in plot_freq_response_with_damping
ax2.plot([], [], ' ', label="Recommended low vibrations shaper: %s @ %.1f Hz" % (no_vibr_shaper.upper(), no_vibr_shaper_freq))
AttributeError: 'NoneType' object has no attribute 'upper'
17:53
fig, png_filename = get_shaper_graph()
File "/home/fly/printer_data/config/K-ShakeTune/scripts/is_workflow.py", line 116, in get_shaper_graph
fig = shaper_calibration([new_file], KLIPPER_FOLDER)
File "/home/fly/klippain_shaketune/K-ShakeTune/scripts/graph_shaper.py", line 338, in shaper_calibration
17:53
Traceback (most recent call last):
File "/home/fly/printer_data/config/K-ShakeTune/scripts/is_workflow.py", line 231, in
main()
File "/home/fly/printer_data/config/K-ShakeTune/scripts/is_workflow.py", line 217, in main
17:53
Fitted shaper 'zv' frequency = 25.6 Hz (vibrations = 27.7%, smoothing ~= 0.235)
To avoid too much smoothing with 'zv', suggested max_accel <= 2200 mm/sec^2
Fitted shaper 'mzv' frequency = 33.0 Hz (vibrations = 11.1%, smoothing ~= 0.187)
To avoid too much smoothing with 'mzv', suggested max_accel <= 3200 mm/sec^2
Fitted shaper 'ei' frequency = 43.6 Hz (vibrations = 12.0%, smoothing ~= 0.169)
To avoid too much smoothing with 'ei', suggested max_accel <= 3500 mm/sec^2
Fitted shaper '2hump_ei' frequency = 47.0 Hz (vibrations = 5.0%, smoothing ~= 0.244)
To avoid too much smoothing with '2hump_ei', suggested max_accel <= 2400 mm/sec^2
Fitted shaper '3hump_ei' frequency = 49.2 Hz (vibrations = 1.7%, smoothing ~= 0.339)
To avoid too much smoothing with '3hump_ei', suggested max_accel <= 1600 mm/sec^2
Recommended shaper is 3hump_ei @ 49.2 Hz
Axis has a main resonant frequency at 30.7Hz with an estimated damping ratio of 0.065
Peaks detected on the graph: 5 @ 30.7, 54.9, 75.9, 95.3, 124.3 Hz (5 above effect threshold)
Frix-x commented 10 months ago

Hey, thanks for raising an issue. I'll try to reproduce it on my side (thanks for the CSV) and will fix it as soon as possible :)

AMFkuna commented 10 months ago

Similar problem on Klippain HappyHare Snímek obrazovky 2023-10-30 v 19 33 50

locki-cz commented 10 months ago

same problem

00:47:16 Command {plot_graph} finished 00:47:16 main() File "/home/pi/printer_data/config/K-ShakeTune/scripts/is_workflow.py", line 217, in main fig, png_filename = get_shaper_graph() File "/home/pi/printer_data/config/K-ShakeTune/scripts/is_workflow.py", line 116, in get_shaper_graph fig = shaper_calibration([new_file], KLIPPER_FOLDER) File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/graph_shaper.py", line 338, in shaper_calibration peaks = plot_freq_response_with_damping(ax1, calibration_data, shapers, selected_shaper, fr, zeta, max_freq) File "/home/pi/klippain_shaketune/K-ShakeTune/scripts/graph_shaper.py", line 245, in plot_freq_response_with_damping ax2.plot([], [], ' ', label="Recommended low vibrations shaper: %s @ %.1f Hz" % (no_vibr_shaper.upper(), no_vibr_shaper_freq)) AttributeError: 'NoneType' object has no attribute 'upper' 00:47:16 Fitted shaper 'zv' frequency = 38.6 Hz (vibrations = 7.5%, smoothing ~= 0.107) To avoid too much smoothing with 'zv', suggested max_accel <= 5800 mm/sec^2 Fitted shaper 'mzv' frequency = 24.4 Hz (vibrations = 5.4%, smoothing ~= 0.342) To avoid too much smoothing with 'mzv', suggested max_accel <= 1700 mm/sec^2 Fitted shaper 'ei' frequency = 36.4 Hz (vibrations = 4.9%, smoothing ~= 0.243) To avoid too much smoothing with 'ei', suggested max_accel <= 2500 mm/sec^2 Fitted shaper '2hump_ei' frequency = 43.2 Hz (vibrations = 4.5%, smoothing ~= 0.289) To avoid too much smoothing with '2hump_ei', suggested max_accel <= 2000 mm/sec^2 Fitted shaper '3hump_ei' frequency = 53.0 Hz (vibrations = 4.4%, smoothing ~= 0.292) To avoid too much smoothing with '3hump_ei', suggested max_accel <= 1900 mm/sec^2 Recommended shaper is zv @ 38.6 Hz Axis has a main resonant frequency at 39.2Hz with an estimated damping ratio of 0.050 Peaks detected on the graph: 3 @ 6.3, 39.2, 50.2 Hz (2 above effect threshold) Traceback (most recent call last): File "/home/pi/printer_data/config/K-ShakeTune/scripts/is_workflow.py", line 231, in

Frix-x commented 10 months ago

Hello everyone,

Thanks for the feedback. I indeed identified a bug in the "low vibration" shaper recommendation that can happens when there is no shaper with a low level of remaining vibration available. I changed the logic a little bit to be smarter and make better suggestion. This is available in the develop branch for now but I'll merge it in a couple of minutes.

@AMFkuna the bug you are experiencing is due to another problem that is already fixed here but not pushed in the main Klippain repository (and its HappyHare branch) for now. It will be done tomorrow alongside the new full Klippain release :)

Frix-x commented 10 months ago

Fixed in v1.1.0 !

locki-cz commented 10 months ago

Fixed in v1.1.0 !

Thank you very much! Going to test it now! :)

//edit: Works!