Issues with pressure advance since RRF 3.4
-
@deckingman
Let me have a go at explaining what I understand about how jerk is applied in RRF....First consider a set of moves
G1 X10
G1 X20
G1 X30
Let's assume the feedrate, and acceleration are such that the length of each move is enough for the target speed to be easily reached. So the simple case would give us three moves each of which accelerates(a), then cruises(c) at the target speed then decelerates(d) back to zero. so we would have
a/c/d a/c/d a/c/dHowever RRF would like to make the overall motion as smooth and fast as it possibly can. This is pretty easy in this case as we can in effect cancel out some of the acceleration and deceleration phases and extend the cruise phases so then we get:
a/c c c/d
Which is a much smoother overall move. So far so good!We now need to look at what actually happens in a move like those above, let's assume we have a simple Cartesian motion system. With that system the above set of moves would have the X motor operating at the feedrate and the Y motor not moving. So 100% of the move speed is allocated to X and 0% to Y.
Now suppose that instead of a set of simple moves along the same axis we are creating a shallow "curve" from a series of straight lines. The curve is such that the first move is 100% X 0% Y, the second move is 90% X and 10% Y (we will ignore later moves to keep things simple). Can we still smooth these moves out in some way? This is when jerk comes into the picture. Let's assume the feedrate is 100mm/s and that the jerk limit is set at 20mm/s (for both X and Y). So what we are saying is that the system is such that we can have an instantaneous change in speed so long as the change is less than the jerk limit. In this example at the join between the first move and the second the change in speed for X is -10mm/s ( a 10% reduction of speed from 100mm/s), for Y we have a +10mm/s change in speed (as it needs to go from 0mm/s to 10% of 100mm/s). In both cases these changes are below the jerk limit of 20mm/s so we can still merge them and maintain "smooth" motion (though the motors will see a jump in speed).
If we have a sharper join between two of the moves such that the first move speed was 100% X and 0% Y but this time the second was 70% X and 30% Y then things become more interesting. Now we have a decrease in speed for X of -30mm/s and an increase in speed of Y of +30mm/s in both cases this exceeds our jerk limit, we need to adjust the speed at the join so we reduce our target velocity for the end of the first move to be 66.67mm/s (instead of 100mm/s). Now the jerk is 0.3*66.67 = 20mm/s so within our jerk limits. However because we have had to reduce the speed at the join we now need to have a deceleration section to the first part of the move and an acceleration to the second part of the move so our motion is no longer smooth.
The above is a big simplification of what actually happens (in particular I've played very fast and loose with the % speed model, in reality this is a direction vector that is normalised) but I think it captures the basic mechanism. The key function in applying jerk is matchSpeeds see here: https://github.com/Duet3D/RepRapFirmware/blob/3.5-dev/src/Movement/DDA.cpp#L1249
From the above I hope we can see that having low jerk and high acceleration will mean that there is less chance to smoothly join consecutive moves, instead you get a series of (in this case) fast decelerations and accelerations which is likely to make the motion noisy and induce vibration.
What I'm not sure about is the impact of high jerk on things like IS, PA and retraction.
-
@gloomyandy
Well written mate -
@Notepad I am not surprised at all that PA and Retraction behave wildly different on 0.6 and larger nozzle sizes. 0.6 nozzle already have double the area of a 0.4, which means pressure buildup, polymer viscosity, "sticking to itself", and gravity have a much larger amount of stuff to deal with for easy control.
This gets ridiculously obvious when using 2mm nozzles where common retraction basically does nothing, and you need to switch to long wipes and then short retracts/long unretracts for acceptable results (Cura's new gradual flow plugin might help).
-
@gloomyandy I think we came to the same conclusion but from different angles. You say that low jerk/high acceleration gives less smooth motion because of the series of accels/decels before each segment boundary, while I concluded that the same combination would give less constant speed which is essentially the same thing.
Regarding input shaping, (this is going to be contentious) as I understand it, people are saying that it works best with low jerk/high acceleration. But from what we have both concluded it is this combination that results in a series of sharp accels/decels which in itself is more likely to induce ringing. So by setting low jerk/high acceleration are people inducing ringing in order to use IS to combat it?
I can test this theory. I don't get ringing but I recently played around with the accelerometer built in to my tool board just because I could. But I could find no definable peak to use as a centre frequency. I can repeat those tests with low jerk/high accel.
Edit. That ain't gonna work because IIRC, each move starts at zero speed so jerk won't get applied.
-
@oliof said in Issues with pressure advance since RRF 3.4:
@Notepad I am not surprised at all that PA and Retraction behave wildly different on 0.6 and larger nozzle sizes. 0.6 nozzle already have double the area of a 0.4, which means pressure buildup, polymer viscosity, "sticking to itself", and gravity have a much larger amount of stuff to deal with for easy control.
This gets ridiculously obvious when using 2mm nozzles where common retraction basically does nothing, and you need to switch to long wipes and then short retracts/long unretracts for acceptable results (Cura's new gradual flow plugin might help).
Yes, I found exactly the same thing when I took two years out of my life building experimental hot ends. The other thing that buggers everything up is the volume of molten material which acts like a kind of sponge and damps out pressure variations. With a high volume of molten material, any short sharp extruder moves get damped out into a kind of slowly changing pressure at the nozzle which makes it impossible to print fine details.
-
The fact that printing curves composed of linear segments requires moderately high jerk, but input shaping is somewhat defeated by jerk, is the reason that the real path forward is by using look-ahead / path smoothing, as I asked about here:
https://forum.duet3d.com/topic/32942/progress-on-path-smoothing-lookahead
So, get in there and voice your support.
The only other approach that would work is to have true arc support (RRF just decomposes arcs into relatively coarse linear segments, currently), and reliable arc fitting in the slicer (none that I am aware of, currently).
-
@CCS86 said in Issues with pressure advance since RRF 3.4:
...................The fact that printing curves composed of linear segments requires moderately high jerk.............................,
Well actually the jerk required to print curves kind of depends...............To elaborate, I printed a few more test parts today. They were nice big hollow cylinders, 360mm in diameter with 3mm thick walls and 3 perimeters meaning that the infill lines were the same as the perimeter - i.e 6 complete turns around for each layer. To start with, I wanted to try something with obvious facets so I used the variable $fs=5 in OpenScad which according to the documentation should have given a segment length of 5mm. In reality, I ended up with facets (segments) that were about 35mm long. So about 32 segments around the circumference giving an angle between segments of about 11 degrees. I printed this at 80mm/sec with my usual 1000mm/sec^2 accel and 1500mm/min jerk. then I progressively reduced jerk. The initial layer time was 1min 26 secs. At 1000 jerk everything was much the same. At 500 jerk, the motion was observed to be less fluid and I could clearly detect changes of speed before and after each segment boundary. But print quality seemed OK. At 300 jerk, the motion was much less fluid, the changes in speed either side of the segment boundaries was quite pronounced and the layer time increased to 1min, 30 secs (so overall about 4.6 percent slower).
But then I made another cylinder with a very high segment count ($fn=300 in OpenScad). At this setting, the stl looks smooth rather than faceted. I printed this as before but this time, I could go below jerk of 300 with no noticeable change in top speed and the movement was still fluid. I kept reducing jerk and at 100 things were the same as they were at 1500 - no detectable difference in reported speed or layer time and visually and audibly it looked the same. Only when I reduced jerk to below 100 did things start to look and sound pretty awful.
So it seems to me that if curves have sufficiently small segments sizes, then a low jerk value can indeed be used. The lower the number of segments (or the higher the angle between them) then the higher jerk needs to be to maintain fluid motion and near constant speed.
The only other approach that would work is to have true arc support (RRF just decomposes arcs into relatively coarse linear segments, currently), and reliable arc fitting in the slicer (none that I am aware of, currently).
The problem with that is that stepper motors are effectively digital devices. That is to say, even if you could produce some sort of "true arc", it still needs to be broken down into motor steps which effectively gives you linear segments (albeit small ones).
-
That's one very specific case you tested.
80 mm/s is relatively slow and on a large arc at a slow speed, of course you can reduce jerk significantly, with a finely faceted model.
Things will be different with higher speeds and smaller arcs. All sorts of real world printing scenarios that need to be balanced.
Your point about motor steps being linear is really a moot point. Every CNC machine has a minimum increment of movement, including the most precise, like a wire EDM. These increments are so small, that practically, they are invisible on the finished part. In our application, the issue is with large linear segments interrupting the motion controller's flow. By looking ahead, we can start the change in axis movement speed ahead of the junction, so there isn't such a reliance on jerk, creating much smoother motion.
-
@CCS86 That test was just a follow up to the other tests that I've posted and we are looking exclusively at jerk - specifically should we use low jerk, high acceleration or high jerk / low acceleration. Of course there are an almost infinite number of scenarios and we don't yet have a full understanding of how the jerk setting works with PA and IS. I've simply been trying to add more data points to add to our understanding.
I'll stop my investigations now or keep the results to myself, as there is little point continuing if people are going to take the results out of context and dismiss them out of hand.
-
@deckingman why are you taking this so personally?
You seemed to be suggesting that low jerk could be used generally. I pointed out that your test was very specific an not representative of general printing. Not sure why that would offend you.
-
@deckingman Thanks for running those tests. The results are inline with what I would expect...
My understand of the code is that it will be the angle between the segments that impacts the required jerk setting for smooth motion, not the length (though obviously when decomposing a curve the two are related). The feedrate for the segments is also part of this, in that higher feedrates will require the angle between the segments to be shallower (and thus a closer approximation to a straight line) for the same jerk setting to allow smooth motion.
-
@CCS86 said in Issues with pressure advance since RRF 3.4:
@deckingman why are you taking this so personally?
You seemed to be suggesting that low jerk could be used generally. I pointed out that your test was very specific an not representative of general printing. Not sure why that would offend you.
Because I'm trying to broaden our collective understanding of how jerk works in "real life" by doing extensive testing. You've taken that post in isolation and reached completely the wrong conclusion. Had you bothered to look at my previous posts you'd have seen that I'm not suggesting anything of the kind - quite the opposite in fact. Thus far with other tests (just scroll up a bit), I've shown that the longer the segment length or greater the angle between segments, then in order to maintain fluid motion at near constant speed, the higher jerk needs to be. Personally I get best overall prints using a jerk of 1500 but I've shown that, if the segment lengths are short enough or the angle between them is shallow enough, then you can use much lower jerk - down to 100 in certain cases.
To my mind, this qualification is better than simply stating "..........printing curves composed of linear segments requires moderately high jerk" as you have done.
But if people are not going to bother looking at the other data I've produced, and wish to filter my output to focus on one individual snippet of data, then I'm wasting my time.
-
@gloomyandy said in Issues with pressure advance since RRF 3.4:
@deckingman Thanks for running those tests. The results are inline with what I would expect...
My understand of the code is that it will be the angle between the segments that impacts the required jerk setting for smooth motion, not the length (though obviously when decomposing a curve the two are related). The feedrate for the segments is also part of this, in that higher feedrates will require the angle between the segments to be shallower (and thus a closer approximation to a straight line) for the same jerk setting to allow smooth motion.
Yes, I agree. It seems to me that higher jerk is more "universal" in that it works better than low jerk where the segment angle is high but works equally as well as low jerk where the angle is shallow.
-
@deckingman The question is what are the downsides of high jerk settings. Klipper mentions that it can impact input shaping, but I've no insight into that. But I also have a sneaking suspicion that some of the PA problems that folks are seeing may be down to high jerk values. If you have a high jerk setting then when the print head arrives at a 90 degree corner it may be moving with that velocity, I suspect that (at least on some/most printers, which may not be super mechanically stiff) this may result in the extruder depositing filament "beyond" the corner and so cause a "corner bulge".
-
@gloomyandy I kind of find the opposite - If the jerk is too low, the extruder goes round the corner too slowly, and this leaves a corner bulge. I find that a jerk of no less than 2100 is required in combination with my other settings to control corner bulge. I am using a delta with direct extruder.
-
@Adrian52 Interesting, that is a pretty high jerk setting, what speeds and accelerations are you using? I'm running a toolchanger with relatively low jerk (around 300mm/min, acceleration 8000mm/s^2) and highish speeds (up to 150mm/s) and don't seem to have any real problems with bulging corners (I do have plenty of ringing at those speeds though, if the part I'm printing needs a better finish I use 80mm/s for perimeters).
-
@gloomyandy I think we need to separate out extruder jerk from axes jerk.
For any XYE move, the lowest jerk will apply to all the other axes (where the extruder is treated as an axis) in order to keep everything in sync, so it makes sense to set extruder jerk high so that it doesn't slow down the other axes.
But when it comes to PA something else comes into play which is applied only to the extruder. The XY axis moves as normal but the extruder speed is modified. It is accelerated faster at the beginning of a move and decelerated faster at the end but the overall feed amount is kept the same. Again, it seem that high extruder jerk is better then low with PA.
When you say ".....klipper mentions that it can affect input shaping......" do you happen to know if they are talking about axes jerk or extruder jerk or both? Also, does high axis jerk help with IS or is it a case that high axes jerk can induce ringing which therefore amplifies the benefit of IS? (That's just me being cynical).
-
@deckingman I don't think klipper allows different jerk settings per axis. See the docs here: https://www.klipper3d.org/Config_Reference.html#printer you specify the square cornet velocity (which is the nearest thing to jerk that Klipper has) to the printer, not to an axis.
As far as I can tell (from looking at the Klipper source) square cornet velocity is not applied to the extruder.
It seems that Klipper also has problems with curves and square cornet velocity, see the discussion here: https://github.com/Klipper3d/klipper/issues/4228
-
@oliof I have been looking at the code, and it looks like the PA only uses a linear relationship of pressure to movement speed. Over Christmas I will be looking at ways to add different algorithms to the PA to change it from a linear relationship to maybe accepting a quadratic based algorithm instead
-
@Notepad Any luck in understanding this issue any better?
I basically gave up printing over this , and not just bulging corners but start/end of layer issues. And without specific notes to confirm....prior to 3.x I have beautiful prints on the same printer!
One repeated theme throughout this thread is 0.6mm nozzle with Volcano (and Hemera). This too is my setup (well was since I gave up).It also seems PA is missing a fundamental understanding considering Vol is a ^3 function and PA has been reported as a linear response function....but since the formulas have not been posted I could be wrong here.
Jerk will always compete with PA for material flow since Jerk reduces residence time but not flow at intersecting travel events, while PA having no knowledge of reduced time intersections event, compensates for excess flow at longer residence (during decel) times and increased flow and shorter residence (during accel) times. It would be really nice if the math were shared and some sort of temporal plot created whereby using the math alone, the zones of goodness could be determined vs wasting so much plastic to try and test this. It sure seems like a mm3/mm travel could be the output and the goal is to show where variation is minimized for various combinations. Every printer is different, but the math is the math and a perfect model should be the starting point. Fudge factors such as bowden tubes stiffness factors deviates from the perfect model, whereas a direct drive might be closest to the perfect model (choose your perfect model).
I finally closed up shop when I had holes, blobs and or bulging corners but never acceptable at all three locations that I could fix. In short I wasted too much time and plastic and finally gave up and stop by here occasionally to see if there has been any new insight.
There has to be a smarter way!