Input shaping testing and thoughts
-
Hi I've been doing a lot of testing and generally exploring the new input shaping feature. Here are some results and thoughts. Note that all of this has been done using the STM32F4 port (SBC version), but I think pretty much everything will apply to the Duet versions as well...
Firstly I'm lucky (ahem!) to have a very good test case. My printer rings a lot! Below is a 40x40 test cube printed in petg at 150mm/s (5000mm/s/s acceleration) with no PA.
As you can see lots of ringing. Using the input shaper plugin I get the following for a test on this same axis:
You can clearly see the strong peaks between 12 and 16 Hz with additional ones at higher frequencies.After a little bit of playing around with the recommended solution from the plug in, I gave up on that (it seems to select too low a frequency of around 11Hz) and added a selection of my own based on a frequency of 13.85Hz. After a few runs I chose the MZV shaper as the first to test. This produced the following test cube:
To make it easier to see the results the bottom half has no shaper enabled, while the top half has the shaper turned on (in this case MZV with a frequency of 13.85). As you can see this has a pretty dramatic effect on the result, removing a lot of the ringing. However if you look closely you will see there is still ringing in the "V" of the "Y". More on this later.Next I decided to try using the ZVDD shaper again at 13.85Hz. This produced the following result:
Again a pretty good result, but notice the ringing in the "V" of the "Y" and also notice the ringing at the top left edge of the cube in line with the top of the Y.I also noticed that the print times of the cubes with shaping included had increased. With no shaping the cube took approx 41minutes to print, but the MZV cube took almost 62minutes and the ZVDD version almost 65minutes. So what is going on here?
My understanding is that the input shaper basically injects a series of impulses into the movement of the print head by varying the speed and acceleration of the print head as it moves. These impulses are added during the acceleration and deceleration phases of the move and are based on the target frequency. The different shapers use different numbers and timing of the impulses (in this case MZV adds 4 pulses, while ZVDD adds 6). The process of adding these impulses requires that the move is long enough (both actual distance and timing) to contain the series of impulses and also impacts the effective acceleration of the move (by basically extending the acceleration and deceleration phases of the move). For lower frequencies the impact of this operation is greater.
I think the above understanding allows us to explain both the increase in print time (due to the effective lower acceleration being used) and the ringing that can still be seen in the "V" of the "Y" and to the left of the "Y" top (in this case the moves are not long enough and so are not subject to input shaping). The extra ringing seen in the ZVDD example is there because it uses a more complex shaper that injects extra impulses and so requires a "longer" move.
With this in mind I went in search of an improved solution. One of the characteristics of a shaper is the size of the frequency range that it covers. Some of the shapers (like ei2 and ei3) have a wider range than the others. After some experimentation I printed the following cube using ei3 at 56.25Hz:
As you can see this cube has similar good results to the other shaper results, but does not have the ringing in the "V" nor the ringing at the top edge. It also printed in just under 45minutes. I think this is mainly due to the higher frequency which means the inserted impulses occupy a smaller part of the move and so have a lesser impact on the acceleration being used (and also allow more of the moves to be shaped).
Ideally I'd like to use the "simpler" shapers (like MZV) at a higher frequency as they are supposed to have less "side effects" on the overall print, but testing with the input shaper plugin seems to show that doing this will not allow the MZV shaper to address the peak at 12-16Hz very well, but more tests are needed to determine if this is the case.
All of this is based on my reading of the RRF and klipper source along with a quick look at the original papers describing some of the theory behind input shaping. I'm no expert on this and I'd welcome input from anyone in particular @DC42. I'm still in the process of investigating further (and as you can probably guess have run a lot more tests than described here!).
A few final thoughts questions:
- Is there a way to avoid the slow down of prints when targeting lower frequencies?
- Is it possible to apply shaping to shorter moves (perhaps by slowing down the move to lengthen it, or maybe just applying a subset of the impulses?)?
- What role does the damping factor play in all of this can can it be used to address any of these issues?
- Can we get a more automated solution?
Let me know what you think and what your experience has been.
-
@gloomyandy with ringing as bad as that, it's worth trying lower damping factors than the default 0.1. When selecting the higher order shapers such as EI3 and ZVDD, it may even be best to set the damping factor to zero.
The reason for the increased print time is that input shaping can only be applied when the time taken to accelerate or decelerate is long enough. Therefore, when the acceleration or deceleration time is too is short, RRF will reduce the acceleration or deceleration as needed. The M593 L parameter lets you set the minimum acceptable acceleration, allowing you to choose not to apply input shaping when the amount of speed change is small.
-
@dc42 Hi David, I'm not too concerned about the actual ringing to be honest, firstly it looks much worse on these photos than it actually is (I wanted to makes sure it showed up pretty well) and petg always makes it look worse. I pretty much only print functional parts and being able to print them pretty fast is nice, if I want higher quality then slowing things down gives much cleaner results. Having input shaping will hopefully let me have both though!
I've played around a little with the damping factor (oh and BTW I don't think the input shaper plugin will let you set it to zero) but will investigate it further.
Any thoughts on using low frequencies without losing input shaping on some shorter moves? I spent some time hunting down what was happening with those moves and it was basically going through the optimised "Both" path but when it called ImplementAccelShaping one of the tests would fail and it would fall back to a normal move. I'm not really sure what if anything could be done. I had a quick look at how klipper handles this but it seems to apply the input shaper to all parts of a move (but in such a way as they are in effect null for the constant velocity part), I'm not sure I fully understood how it was doing that and if it was any better!
-
@gloomyandy the lower the shaping frequency, the longer the acceleration segment has to be. AFAIR, Klipper suggests a maximum acceleration to use with the input shaper. That suggests to me that Klipper does not adjust the acceleration, but instead requires you to set a low enough acceleration so that the acceleration segment will be long enough when there is a significant speed change. But I may be wrong.
BTW, 12 to 16Hz is a very low ringing frequency, much lower than the values I see which are generally in the region of 40Hz. Are the belts on your machine loose?
-
@dc42 Hi David, yes I saw that klipper suggests a max acceleration figure, though how the determines it seems a little strange (or rather I don't really understand what it is doing, it seems to be based on minimising the "smoothing").
I've been doing some more testing and I think the 16Hz peak is a red herring and is actually the entire printer/desk moving rather than part of the ringing. If I go old school and measure the actual ringing lines on the test print and calculate the frequency from that then I get 43Hz for them. That makes a lot more sense. I tried moving the accelerometer from the print head to the printer frame (it is mounted with magnets so easy to move around) and sure enough the 16Hz peak is present on the output there.
I wonder if there is any way that the shaper tuning process could identify and ignore things like this?
-
@gloomyandy said in Input shaping testing and thoughts:
I wonder if there is any way that the shaper tuning process could identify and ignore things like this?
I seem to recall it being suggested that the accelerometer could be attached to the frame for a base run and then subtract that from the print head run, but I'm not sure what became of that idea.
-
-