Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit Input Shaping frequencies as integers in menu. #26791

Closed

Conversation

vovodroid
Copy link
Contributor

Currently input shaping frequencies are edited as floats with one decimal:

image

I don't think it has any meaning, and it makes editing this value difficult. This PR displays and edits frequencies as integers:

image

@thisiskeithb
Copy link
Member

You can use floats in your config & via M593, so they shouldn’t be limited via the edit menu.

@vovodroid
Copy link
Contributor Author

You can use floats in your config & via M593

From this POV showing one decimal in menu is also limited. And this is good question - any meaning in float for frequency (even with accelerometer)?

@thisiskeithb
Copy link
Member

any meaning in float for frequency (even with accelerometer)?

For well-tuned machines, definitely. Artificially capping a calibration setting like this is silly.

@rq3
Copy link

rq3 commented Feb 13, 2024

any meaning in float for frequency (even with accelerometer)?

For well-tuned machines, definitely. Artificially capping a calibration setting like this is silly.

I agree, yet that is exactly what Commit 57dd34 did to the G33 standard deviation values reported on the printer's screen.

@vovodroid
Copy link
Contributor Author

I didn't find commit with hash containing 57dd34, but G33 is about delta calibration, that indeed demands precision. Currently Marlin relies on printing calibration print to determinate dumping frequency, method that is very far from 1/10 hertz precision.

Anyway even if one somehow manages to find resonance frequency with such precision, it changes with time due to various factors.

@rq3
Copy link

rq3 commented Feb 13, 2024

I didn't find commit with hash containing 57dd34, but G33 is about delta calibration, that indeed demands precision. Currently Marlin relies on printing calibration print to determinate dumping frequency, method that is very far from 1/10 hertz precision.

Anyway even if one somehow manages to find resonance frequency with such precision, it changes with time due to various factors.

My bad. That was commit 574dd34, on June 27, 2023. Caused a lot of issues, some still on-going.

@KimmoHop
Copy link

any meaning in float for frequency (even with accelerometer)?

For well-tuned machines, definitely. Artificially capping a calibration setting like this is silly.

With any reasonable manual method I'd be surprised to get confident resolution of even 1Hz. What is your test method?

@Sophist-UK
Copy link
Contributor

This is IMO an entirely misguided PR which mis-understands the physics of resonant frequencies.

Unlike many physics areas where there is a single best value which is a single peak on a graph and which you can iterate to, as I understand resonant frequencies, they have harmonics and the graphs have several peaks and troughs of different amplitudes. Depending on your machine, suppose e.g. the accurate resonant frequency was 9.49090, then ideally you would be able to put in 9.491 which would be a pretty good approximation, but even if you put in 9.5 that would still be pretty good. But 9 might actually be so far away as to have reached an anti-harmonic frequency that actually reinforces rather than cancels out the ringing vibrations that should be cancelled out by input shaping making ringing worse rather than better.

The difficulty is being able to measure the vibrations accurately without having a decent accelerometer installed. Based on my experiences the th3dstudio.com ringing tower is a far better way of measuring the resonant frequencies in X and Y directions, though it does not give any insight into the zeta values for which you still need to use the Marlin Input Shaping Calibration Patterns.

However, I do think that the Marlin pattern generator needs some enhancement to allow you to specify the starting and ending frequencies for both Damping Frequencies and Zeta factors, so that you can determine the values with increasing accuracy by iteratively zooming in on the correct frequency.

@vovodroid
Copy link
Contributor Author

he accurate resonant frequency was 9.49090, then ideally you would be able to put in 9.491 which would be a pretty good approximation, but even if you put in 9.5 that would still be pretty good. But 9 might actually be so far away

That's the point. Real frequency could be, let's say 30 Hz, at least three times more, so 0.5Hz will be much lesser deviation.

@Sophist-UK
Copy link
Contributor

Sorry - but that is the exact opposite of the point. For a high momentum axis, such as a bed slinger, the frequency could be as low as 10 (or even lower) and then the decimal point is very important indeed. And the firmware needs to support both frequencies in the 30-50Hz region and frequencies in the single digits.

@vovodroid
Copy link
Contributor Author

the frequency could be as low as 10

It could, but I guess frequencies less than 20 are considered too low. I have bed about 1.5Kg with low resonance about 30 Hz, it's matter of belt tension.

@Sophist-UK
Copy link
Contributor

There are other issues with low frequency input shaping - specifically the amount of SRAM needed. But the key point for best Input Shaping results is that you really need to provide the most accurate frequency that you can measure and not have to round it any more than you need to.

@thisiskeithb
Copy link
Member

My stance is still that we should not be reducing these values to integers on the LCD side.

Even with TFT_COLOR_UI, you can fine tune values with + / - buttons as well as an encoder for equipped TFTs (like the BTT SPI TFT that OP has).

And of course, most LCDs will have an encoder or USB port, so editing values on screen or over serial will not be difficult at all.

@vovodroid
Copy link
Contributor Author

Actually this PR is originates from [FR] Allow input shaping tuning during print #26653

I created gcode files producing movements with swept frequency in different ranges. Next I choose range with resonance (by hearing, or spectrogram) and change IS frequency on the fly near the resonance frequency until getting the best result. So reasonable tuning resolution is desired.

@Sophist-UK
Copy link
Contributor

I can understand the purpose of #26653 but I do not see how this PR is at all relevant to that FR.

@vovodroid
Copy link
Contributor Author

I do not see how this PR is at all relevant to that FR.

Because precision 0.1 Hz is not needed (and not handy) to find best frequency in real time.

@thisiskeithb
Copy link
Member

thisiskeithb commented Mar 29, 2024

Because precision 0.1 Hz is not needed (and not handy) to find best frequency in real time.

For you / your machine, but this PR should not be merged for everyone as-is. If it were made optional through a config option (and disabled by default), then it'd at least be made available if you did not want the extra precision.

@Sophist-UK
Copy link
Contributor

And as I pointed out, and as @thisiskeithb concurred, this precision is needed because the frequency needs to be as accurate as possible to have the best effect and differences from optimal have a disproportionate effect.

If you disagree with the physics behind my statement, then please provide a rational alternative explanation.

@Sophist-UK
Copy link
Contributor

Because precision 0.1 Hz is not needed (and not handy) to find best frequency in real time.

This is NOT a justification for how it is relevant to #26653 which is about changing the conditional code that displays or hides the menu item for the purpose of making the existing menu item visible during printing. This PR is about something completely different specifically how the menu operates when you use it. The fact that you decided you would like to see a second change whilst you are working on the first change does not IMO make them related.

@thisiskeithb
Copy link
Member

a85a2d5 makes this optional

@KimmoHop
Copy link

( This is turning into FreeCad forum discussion :) )

I'd like to repeat my question: how does one measure vibration in sub-Hz accuracy? Klipper and sensor is one way (I did that, since ringing tower and fast sweep can be hard to interpret; but I like Marlin as printing firmware better for now), but for Marlin, realistically? Neither Marlin nor Octoprint support any sort of sensor measurement.

I'd also like to see a study or proper investigation about how many decimals are relevant :)


If printer does not vibrate in single peak per axis, manual/visual measurement will be even more difficult, and ZV won't work well with wide spectrum or multiple peaks. (FTM, when stable and tested throughout and having linear advance values tamed, gives more shapers, but without actual sensor measurement anything beyond ZV could still be very much guesswork)

@Sophist-UK
Copy link
Contributor

@KimmoHop I am far from convinced that the Marlin Input Shaping calibration pattern is at all a good way to measure the input frequencies or zeta/damping values, and certainly not unless you have the ability to start from the current big picture and then zoom-in/focus-in on the area of the approximate resonant frequency that you find in the big picture.

Or perhaps you start with the resonant frequency and then use something similar to the th3studio ringing tower (but smaller and tighter and more stress-inducing) to zoom in and give you a bigger measurement sample for the fine measurements.

Unfortunately I don't have the time to work on creating an improved tool. Sorry.

@vovodroid vovodroid force-pushed the is_integer_menu_pr branch from 6ebc44c to fb47012 Compare July 5, 2024 19:36
@thinkyhead thinkyhead force-pushed the bugfix-2.1.x branch 3 times, most recently from 37d77d6 to aa44542 Compare September 28, 2024 01:10
@thinkyhead
Copy link
Member

Thanks for the suggestion, but it's better not to limit these to whole numbers. Clearly this is an easy change to make for the RepRapper who finds it better for their situation, but for the average user it's better if dialing in the frequency remains meticulous. We want to encourage users to pay careful attention to these frequencies and dial them in using real measurements. And we don't want too many pre-flashed machines out in the wild which can only be tuned to, e.g., the two bad frequencies 42.0 and 43.0 around the perfect one at 42.5, because then it looks like the feature is broken.

@thinkyhead thinkyhead closed this Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants