6th-order jerk-controlled motion planning
-
+1 to S-Curve implementation. This video is the perfect demonstration for an enhanced quality (noticeably less ringing in the print). https://www.youtube.com/watch?v=C0XjXqO6Ji8
I have been looking at the implementation of the S-Curve motion control in Marlin and TinyG. It oly works on 32bit CPUs as AVR simply does not have enough processing power for this.
TinyG implementation is well explained nd has references to some papers with the maths behind the code: (https://github.com/synthetos/TinyG/blob/master/firmware/tinyg/plan_exec.c#L243).They're using 5th-order Bezier velocity curves to get 6th-order position planning. When planning each velocity change, the math assumes that acceleration and jerk start at zero, which allows to significantly simplify the math.
Note that both solutions are still using trapezoids to drive overall velocity changes, it's just that the velocity changes are smoothed using the 5th-order Bezier curves.
The logic is also very clearly explained at https://github.com/MarlinFirmware/Marlin/pull/10337.
-
I've been trying to avoid getting involved with this discussion on the grounds that it's bad for my blood pressure , but anyway…..
So aside from the technicalities, what is the big problem with the current motion system that this proposed variable rate of acceleration is going to cure? Where are all the real world prints that every FDM printer suffers from because of imperfections in the current motion system? I look on line and see some pretty amazing things that people are making so where is this problem that needs solving?
Also, where are the real world prints that have been produced with every parameter unchanged apart from implementing variable acceleration? Where are the back to back, real world tests? Where is there any scientific analysis of a) the problem as it manifests itself in FDM printing and b) the solution to this problem?
I see videos of moving glasses full of liquid in a straight line. So what? How does that relate to improved print quality with real prints? What happens when that same motion system is applied to short moves or segmented arcs? What happens to the extruded filament under those conditions? What happens to pressure inside the melt chamber? etc etc...
I see a picture of an imperfectly printed test cube, then a “reason” for the imperfection being some sort of overshoot which variable acceleration will correct. Come one…….I've printed much better test cubes than that, and just look on line and you'll see many other examples of test cubes without these defects. All of which have been printed with the current motion system.
I see statements like “the distance nozzle overshoot on a 90 degree corner is usually between 0.05 and 0.1mm”. Really? For every printer? For every speed? Where are the test results? How was that number derived? Where is the evidence to back up that statement?
Come on guys. Lets have some real world test results and some sort of proper analysis. All I hear is conjecture and hypothesis based on theory, YouTube videos of beer glasses, and pictures of imperfect prints which can in fact be printed without those imperfections. Show me real evidence that a problem exists and that variable acceleration on it's own with all other parameters unchanged, gives some improvement in 3D printing, then I'll start to believe.
The big thing that everyone forgets or chooses to ignore with these discussions is that we are using what is in effect a robot controlled glue gun. That is to say, we are squeezing hot sticky filament out of a nozzle. No matter how precisely we control the movement of the print head, the filament will to some extent “do it's own thing” and in general, it will always lag slightly behind the print head as it gets dragged across the bed or previously printed layer. If we accelerate the print head in X and or Y we need to accelerate the rate that we push filament into the hot end (and melt it) by the same proportion. The trouble is, it just acts like a sponge and damps out a great deal of that acceleration or deceleration. All we get is rapid pressure changes followed by much slower increases in feed rate. So the rate of change that we can extrude filament will never closely follow the rate of change that we can apply to the print head position. Coupled with other factors such as filament type, hot end temperature, layer height (and width), imperfect gcode and numerous other variables, this means that very fine control of the rate of change of the tool path position is largely a waste of time and effort IMO.
-
@deckingman Ian I agree with you about this not necessarily being something that is required for 3d printing. What is interesting is that for CNC firmware variations on this theme appear to be more common.
Now that David has migrated to an RTOS, it might be possible for someone to write an alternative motion planner based on one of these algorithms and then run true side by side tests. I would be very wary of switching permanently but having an alternative that could be selected via gcode might work, especially if this is a bigger issue for CNC machines.
-
Why heaving less vibrations should not be an advantage for 3d printing? The psychics behind it is simple. Maybe many users will not see a difference because they jerk and acl settings a quite low. But I like to push my printer to the limits.
-
@dragonn The point is that it has not been definitively shown to have less vibrations in 3d printing. We need to have some comparisons with everything else held equal.
-
A lot of this comes down to - "how fast do you want or need to print?" If you need accuracy over speed, and that's the position most people eventually come to rest at, then slow everything down, lower XY acceleration to the point where you are not making your mechanics follow anything but the true path the gcode contains.
If however you want to push a machine to the limits of speed then perhaps having some sort of compensation for the inertia of the print head and the axes supporting it makes sense. There is no doubt that good software, especially RRF, can create much better prints than less good software, using things we already have like pressure advance and non-linear extrusion which for all intents and purposes can be seen as either fudges which do yield better results, or compensations to allow the imperfect machinery to produce nearer the desired output.
How you go about tuning it and deciding how much "inertia-compensation" or whatever you end up calling it, to apply is something to be determined.
-
@t3p3tony I know without an video and rely on one opinion isn't an 100% confirmation but I will quote from first link with I posted (https://github.com/MarlinFirmware/Marlin/pull/10337) :
"The result is mostly incredible: There is no vibration of the machine itself while printing. You have to see in action to believe it! :D" -
@dragonn fair enough but were they using TMCs with 256 microstepping etc. I am not saying we should not do this, rather that we need to get some side by side comparisons on Duet. That requires someone to code a new motion planner into RRF.
-
Lots of good reading here for the technically inclined.
https://github.com/KevinOConnor/klipper/issues/57I think we need to keep from getting derailed by the talk of replacing sharp corners with arcs. That's not really what S-curve acceleration is about. Smoother accel and decel, less vibration, open the door to higher speeds with similar quality. Who doesn't want shorter print times and a quieter printer?
Now that we have 32bit cpus we have the opportunity to spend more cycles on potentially better path planning. It's something worth investigating, because the potential is certainly there. Real world tests can only come after there is an implementation available to test against.
-
@deckingman
The point that video of mater make is that with the S curve acceleration, moving mass comes to a stop without oscillation. In 3d printer this would result in less ringing.
When I say “the distance nozzle overshoot on a 90 degree corner is usually between 0.05 and 0.1mm”. That is just referring to this particular print. If you print the perimeter slowly or have very low jerk acceleration, you may not see the overshot, but the overshot still happens. The print head along any an axis cannot go from 5mm/s to 0mm/s instantly, it will overshot more or less, it might just not be visible for you. This is backed up by physics. Just like you compensate the elasticity of filament by pressure advance, you can also compensate for the elasticity of xy motion.
I don't know why you are so against the idea of an different different motion system. You want to see real world test results before you believe but every time this is brought up you just strongly oppose the idea, and even an experiment build. This might work well, or it might not bring any improvement, but how do we know without testing? -
@deckingman said in 6th-order jerk-controlled motion planning:
So aside from the technicalities, what is the big problem with the current motion system that this proposed variable rate of acceleration is going to cure? Where are all the real world prints that every FDM printer suffers from because of imperfections in the current motion system? I look on line and see some pretty amazing things that people are making so where is this problem that needs solving?
I look online and see artifacts in MOST prints. Not all. Use extremely high quality mechanics, slow down print speeds, and amazing quality can result. But, again, most prints I see have very noticeable ringing after a corner or a hole. For many applications, these artifacts can be ignored. Or painted over. However, I'd rather not have them to begin with.
And... I won't quote the rest of your post about controlled testing, change one thing at a time. Because I agree with that! 100%!! Maybe more!!!
Unfortunately, it is almost impossible to achieve. The closest we could come would be a firmware that allows us to change algorithms while keeping as much else as possible equal. Given the real world way that firmware is developed, even open source firmware, this seems unlikely.
Therefore, "distant second" is to switch from one firmware to another, and see the results. I can only testify to such swaps that change MANY other things... such as MACH to TinyG on a machine who's specs I posted above. The results were remarkable.
3rd order? 6th order? Not sure. Let's try them all.
I also humbly submit: The "replace this path with that" debate??? ALL controllers approximate the path. To some extent or another. (Again, at anything above VERY SLOW speeds.) So the debate should be "What set of approximations result in the best physical print?". The "should the controller approximate" horse left the barn long ago.
-
And, since tone is hard to read on Forums: FUN DEBATE, let's keep going!
-
@shen said in 6th-order jerk-controlled motion planning:
................> I don't know why you are so against the idea of an different different motion system. You want to see real world test results before you believe but every time this is brought up you just strongly oppose the idea, ..................
I'm not opposed to a different motion system. Like I said, show me some real evidence. However, as a mechanical engineer I do have difficulty in understanding how the implementation of jerk in the physics sense, (i.e changing the rate of change of the rate of change of velocity) can lead to better print quality. It comes from spending a great proportion of my working life combatting the effects of non linear acceleration. Variously referred to as "jerk", or in higher orders of magnitude terms such as "snap", "crackle" and "pop". These are maybe desirable characteristics for breakfast cereal but tend to have undesirable consequences in motion systems.
That aside, what I really do have a problem with is the unscientific way in which most of these "features" or firmware requests are presented. It's what I call "cat an dog logic". It goes like this. All dogs have 4 legs and fur. My cat has 4 legs and fur therefore it's a dog. So using the same logic we have a video of a glass of beer being moved smoothly, therefore we can say that if we use the same motion on my printer, it will print better. Huh? Maybe it will, but there are numerous reasons why it might not. That video of the beer glass\wine glass whatever, was made quite a while ago. How come the makers of it haven't released a new video showing that motion translates into improved print quality? I can't help being cynical - it comes with age.
-
@danal said in 6th-order jerk-controlled motion planning:
And, since tone is hard to read on Forums: FUN DEBATE, let's keep going!
Absolutely. We can agree, or agree to differ. All in a mature and adult way and hopefully neither feel aggrieved by other peoples comments nor cause others to feel so.
-
The problem that needs solving is called "vibration".
With the current motion planner, how do I determine the acceleration value for my printer?
As of now it is a kind of trial error process to set the correct speed/jerk/acceleration values that would allow to print quickly enough and without causing the printer to shake too much, without drastically slowing down the print process. just to quote Tom giving guides on calibration: "Protip: If you just can’t seem to get a print right, slow it down. Like, print at half the speed and you will usually end up with much a better print"3d printer industry is very new and motion Control has been studied in depth for more than 10 years. Trapezoidal velocity models can achieve fast motions, but tend to cause overshoots, and excite residual vibrations that require time for the machine to reach the final position with desired precision.
6th-order jerk control would facilitate the calibration and event eliminate the need to specify the jerk/acceleration on the config.g, because the firmware would do the math based on the speed settings. This is a BIG gain for me.
-
I must agree with deckingman!
I thought for a while before commenting deeper the TinyG video, but now that I have started... First of all the TinyG video shows a pendulum attached to a moving "thing". The pendulum is quite loosely connected to its support, having a lot of freedom around the connection point. Maybe 3D printers are similar, just that the distance to the connection point is much shorter, but I don't believe that is true. But CNC machines are nothing like that, with the spindle tightly connected to the system (though it is funny to think of a CNC with the spindle installed like the pendulum in the TinyG video!!! if you want to get into "hilarious mode", just think of the Z axis connected like that to a gantry also connected like that!!!).
All the years spent learning physics and math, though 18+ years ago so plenty of dust settled over most of the knowledge, clearly tell me that there is a difference, but I don't know how significant. School tried to teach me precision is important, real life engineering did the contrary, emphasizing on down to Earth compromises.
With the above said, if I look over the TinyG pendulum video, I see quite a lot of broken end-mills when the breaking starts and the pendulum tends to get ahead of the moving thing. Compensating a pendulum requires a different type of physics when compared to a CNC mill, or a even a decent 3D printer (no pendulum like solutions).
@carlosspr
We develop systems for out customers that involve quite a similar fine tuning (I won't go into details!). Although the systems are theoretically identical, we have to calibrate each of them independently using some specialized setup. Just think of a CNC with a 10kg gantry compared to one with a 20kg gantry. Both could reach the same feedrate, but the acceleration must also be correlated with the steppers, for example. It is like having a racing car and an expensive family sedan - both might reach the same top speed, but the time needed to do that is clearly different! If you spend half a day or even a whole day for finding the right parameters for your machine, that is time well spent. You can avoid that only by buying a fully built and configured machine, where someone else did the same thing for you! -
I also see similarities between this thread and another. In that particular thread, the OP put forward the "theory" that the limiting factor to print speed was friction in the nozzle and that melt rate was not a factor. This was in direct contrast to my own observations after considerable testing which showed that the limiting factor was indeed melt rate. My blog shows the real world testing and the results that I could achieve by employing multiple melt chambers feeding in to a single nozzle. https://somei3deas.wordpress.com/2017/06/22/exploration-of-print-speeds-with-a-diamond-hot-end/. However, despite the real world evidence that I had, the OP insisted that non-linear extrusion was required to overcome friction and enable him to print at much higher speeds. I lost that particular battle and so we now have non-linear extrusion as a firmware feature. Hallelujah! . So where now is the OP? Where are his high speed prints employing the feature that his theory said would solve all his problems and would be the best thing to hit 3D printing since the beginning of time? Nothing. Zilch. Diddly squat. There has been one other user who claims there are benefits to using non-linear extrusion but the results are "subtle and don't show up in photographs". Personally, I file those types of observation under the heading of "psychological" rather than scientific - more to do with expectation theory than anything else. Since then, I've come across things like this excellent work by Michael Hackney http://www.sublimelayers.com/2017/12/musing-on-under-extrusion-prepare-to.html which shows, in scientific analytical way, that printed parts are actually very tolerant to quite a high levels of under extrusion, which further reinforces my personal belief on just how useful or not that non-linear extrusion is in actual real world printing.
However, there is no harm done as I don't have to use that feature. What concerns me now is that a new motion system may not be something that I could choose to use or not. The reason that bothers me is that I have recently had reason to revert to a previous version of firmware because of a second order effect of pressure advance with the latest firmware. It seems that the latest version of firmware is less tolerant of imperfect gcode than earlier versions. This causes havoc when printing arcs whilst employing pressure advance. So now I have a choice of either trying to find a slicer that generates more perfect gcode, or using an earlier version of firmware. Personally I think that firmware should work independently of slicers and be tolerant to their various vagaries and imperfections, but that's another matter. But it does raise concerns in my mind about what other second order effects might creep in with a new motion system. Will we all have to start using one particular slicer for example?
-
@deckingman said in 6th-order jerk-controlled motion planning:
There has been one other user who claims there are benefits to using non-linear extrusion but the results are "subtle and don't show up in photographs". Personally, I file those types of observation under the heading of "psychological" rather than scientific - more to do with expectation theory than anything else.
That will be me you are referring to. Sorry that my satisfaction with the non-linear extrusion feature doesn't fit in with your view of the world. I find your attitude insulting in the extreme. Grow up man, accept that other people with other equipment can achieve results that are at odds with your own narrow views.
-
I'm truly sorry that my personal opinion has upset you. I was very careful not to name anyone, in fact I couldn't even remember who it was. I was merely pointing out that on the one hand, there is hard evidence in support of the fact that printed parts are very tolerant to under extrusion, but on the other hand there is only anecdotal evidence to say otherwise. So for me personally, I tend to believe the hard evidence and my own test results. However, if you read my blog https://somei3deas.wordpress.com/2018/01/15/an-attempt-to-investigate-pressure-in-the-extrusion-system-with-a-diamond-hot-end/ you'll see that I go to great lengths to explain that my findings were based on my own particular printer and that things such as nozzle size could play an important role. I stated there and will repeat it it here that other users may find different results and if they need to use a positive extrusion multiplier, then non-linear extrusion might work for them. To date, no one has yet come back to me to say that it works for them so I'm still of the opinion that there is no evidence to support it's use. Sorry if that upsets you but that's the way I personally see it.
-
@deckingman said in 6th-order jerk-controlled motion planning:
What concerns me now is that a new motion system may not be something that I could choose to use or not.
Agreed. A new motion planner should not be a replacement, but rather an option. But there is no reason to deny the feature that according the marlin posts is showing a big impact on printer vibrations.
There are many algorithms for motion planning in the technical literature and a proper software architecture would allow to select which planner to use. Marlin team has solved this issue with a compilation directive that you can define or not in Configuration.h when you prepare your firmware letting you the option to use it or not.