Steppers PID - NOT heaters PID
-
@Bogdan said in Steppers PID - NOT heaters PID:
overshoot while moving
This is either mechanical slop, or skipped steps. Neither of which PID can fix, or even tune. They must not happen to begin with.
-
I was not thinking about skipped steps or mechanical issues. I was thinking about the small oscillations caused by the carriage inertia, which creates the ghosting effect. In a "real" system that has to move, if you plot the real movement on X for example, you will find that at the end of the movement there are minor oscillations caused by the inertia (something like this: https://3l4sbp4ao2771ln0f54chhvm-wpengine.netdna-ssl.com/wp-content/uploads/2017/10/Motion-controller-FAQ-how-to-address-overshoot-768x394.jpg ). If you fine tune the PID parameters, that overshoot can be eliminated. If you can find the right parameters for critical damping, you will have the maximum speed with no oscillations happening at the end of the movement.
-
@Bogdan just go with servo drive instead of steppers to achieve closed loop control?
-
The motion you're trying to correct is the result of belt stretch due to inertia, motor wobble, and maybe a few other things thrown in (flexible frame, flexible pulley mounts, play in bearings, etc.). You'll need a reference to measure against (some point on the bed?) and you'll need to be able to measure in microns over the full range of motion of the machine. Assuming you have all that, I don't think you can correct the errors only by moving the motors -the inertia of the moving parts and the springiness of the belt ensure there will be some delay between the correction and the resulting motion. If you got real fancy, you could look ahead and predict the wobble and apply correction so that the delays would deliver it at just the right instant. The micron resolution required isn't generally compatible with normal speed printing.
The best bet is to minimize belt stretch by using wider belts and/or steel core belts (with large pulleys), quality bearings, rigid construction, and try to minimize moving mass. Ringing is primarily a cosmetic issue. You can tweak acceleration, jerk, etc. to minimize it, but in the end, FDM extrusion will never match injection molding for end product aesthetic quality.
-
@Bogdan said in Steppers PID - NOT heaters PID:
I was thinking about the small oscillations caused by the carriage inertia
IIRC, Duet has a gcode to mitigate it. Don't remember the details and never tried it.
Saw also in other placed discussions about backlash compensation firmware but I don't think Duet has that, yet.
Edit: I was referring to this https://duet3d.dozuki.com/Wiki/Gcode#Section_M593_Configure_Dynamic_Acceleration_Adjustment
-
Others have said in more detail what I was trying to say in a very quick post:
-
Visible artifacts are from inertia, belt stretch, ...
-
PID algorithms require feedback.
-
Combine (1) and (2) and it surfaces the need for feedback more accurate than the visible artifacts (microns) and corrections the same... with a speed of correction that ensures plastic is never put in the wrong place.
That's actually much harder than just getting the positioning right to begin with.
On the other hand, your comment about 8 bit algorithms is very well taken. Many controllers still use trapezoidal acceleration; a few use S. The real magic comes when you quit trying to calculate speed/accel at all and go to higher level derivatives like jerk, snap, crackle, and pop.
I have one controller that calculates "constant jerk" instead of calculating speed or acceleration. It is amazing. I tripled the speed of the (largish) CNC router where I installed it (that machine had Mach3 before, which is trapezoidal speed/accel) while at the same time producing better cuts.
I believe that's where 32 bit code developer effort should go: Higher order derivatives.
-
-
Thank you all for finding the time to read and answer to this post. I don't know many things, which is why I wrote here some unfinished thoughts.
@bearer From what I know, the servos cost a lot. I was thinking that maybe there would be some way to obtain an accurate position from the trinamic driver, thus eliminating the need for an encoder or expensive servo assembly.
@mrehorstdmd (As a side note, I read many of your articles and I really admire you!!!) Theoretically, a PID would allow you to control the system "as a whole". For example, in the youtube video that I posted, you could have weights attached to the "arrow", with different shapes and different positions, but it wouldn't matter, because you would tune the whole movement. So I'm thinking that finding the right PID parameters would mean that you would tune not only the motor movement, but also the final carriage, thus tuning the springiness of the belts and other motion system elements.
You are right about the difficulty of measuring the "real" position accurately. Initially I was thinking about using a laser mounted on the print head and an array of photodiodes mounted on the bed. In order to find the PID parameters, you don't need to analyze the entire motion of the carriage, but only the oscillations nearby the target position, which wouldn't be that big anyway. But then I thought that the oscillations of the carriage would be sent back to the motor via the belts (or the screws), and you would be able to measure them at the motor side. And then I was thinking of obtaining these positioning errors from the trinamic driver used in DUET. But I don't know if that is possible. So another idea would be to use a rotary encoder. For a 1.8 degree stepper, a 2000 ppr encoder and 100 steps per mm, you would obtain a 1 micron resolution, allowing you to measure a step response for PID tuning.
As for tweaking acceleration, jerk, etc... I think we are treating the symptoms, and not the cause. The current algorithms were some adaptations that needed to be performed in order to allow computing the motion on 8 bit MCUs. Now, as the available computing power grew a lot, maybe a "normal" algorithm would be worth implementing. I know that FDM will never be like injection molding, but I was thinking more about optimizing the process results (speed and print quality). I have a feeling that using PID would allow faster movement speeds than using a constant acceleration (the ramp speed profile). -
@Danal said in Steppers PID - NOT heaters PID:
Others have said in more detail what I was trying to say in a very quick post:
-
Visible artifacts are from inertia, belt stretch, ...
-
PID algorithms require feedback.
-
Combine (1) and (2) and it surfaces the need for feedback more accurate than the visible artifacts (microns) and corrections the same... with a speed of correction that ensures plastic is never put in the wrong place.
That's actually much harder than just getting the positioning right to begin with.
On the other hand, your comment about 8 bit algorithms is very well taken. Many controllers still use trapezoidal acceleration; a few use S. The real magic comes when you quit trying to calculate speed/accel at all and go to higher level derivatives like jerk, snap, crackle, and pop.
I have one controller that calculates "constant jerk" instead of calculating speed or acceleration. It is amazing. I tripled the speed of the (largish) CNC router where I installed it (that machine had Mach3 before, which is trapezoidal speed/accel) while at the same time producing better cuts.
I believe that's where 32 bit code developer effort should go: Higher order derivatives.
The thing with the constant jerk is quite interesting... But I don't know what systems implement it.
And about the higher order derivatives... Wouldn't that complicate things for the end users? How could you determine them, without trial and error?
The thing with PID is that with 3 numbers you can optimize the entire system, and there is a whole lot of literature on this subject, provided you are able to calculate the real step response... -
-
No tuning involved for Constant Jerk. It is "always right" because of the way it is calculated. It is really spooky to see it in action.
Here's one demo. Nothing was tuned to the length of the track, the length of the string, the weight of the pendulum, etc. Yet it smoothly brings the pendulum to a stop at each end.
-
@Danal
Huh! Cool!! How about this: https://www.youtube.com/watch?v=uFZCv1Ns5cA ?
Edit: Or this one: https://www.youtube.com/watch?v=idMcJ1h2L8U , which I personally saw in action, and I was blown away... And to think that it is implemented with PID -
@Bogdan said in Steppers PID - NOT heaters PID:
@bearer From what I know, the servos cost a lot. I was thinking that maybe there would be some way to obtain an accurate position from the trinamic driver, thus eliminating the need for an encoder or expensive servo assembly.
trinamics are truly great, but the StallGuard feature isn't suited for low speed, so you'd loose control before coming to a stop, or at tight corners f.ex.
-
I have been able to completely alleviate any visible ringing from my prints by choosing a very low instantaneous speed change value for X and Y, as well as a conservative acceleration value of 1200.
"Jerk" and acceleration are what excite the ringing/ghosting on direction changes. It may be belt stretch, it may be lag and lead of the rotors in the motor... either way, if you want to eliminate you must adjust the jerk and accel.
I get "perfect" prints (ignoring bulges of extrusion at the corner) at 100 mm/s prints speeds with jerk of 8 mm/s and accel of 1200 mm/s/s. To alleviate the bulging extrusions, pressure advance works perfectly. (Though, PA slows down lower resolution prints on my machine due to extruder limitations. At high resolution, this slow down does not occur.)
-
Thank you all for your insights.
I read a few more things on the DUET forums and other forums and I'm starting to think that implementing a PID for motion planning may not bring so many benefits. It would be complicated to implement, and the speed gains would be marginal. (It may already be implemented in LinuxCNC, but I didn't look into the details).
Still, while reading, I read a bit more about TinyG and the way they handle the higher order derivatives, as was suggested by @Danal . Their implementation detail is here: https://github.com/synthetos/TinyG/wiki/Jerk-Controlled-Motion-Explained . The major advantage of their implementation is that it smooths the movement, so less force would be put on the belts, which in turn would cause them to not stretch that much, which in turn would provide more accurate prints. There was some talk about it last year on this forum https://forum.duet3d.com/topic/4802/6th-order-jerk-controlled-motion-planning , but I don't think it was implemented.
Other than that, maybe the idea of reading the motion feedback would not be that bad, provided the printer is rigid "enough". Using some carefully chosen calibration movements before printing would allow people to calibrate the motion parameters, thus determining optimal settings for speed, quality, or different trade-offs between them. Maybe this could be implemented as a separate (slave) module connected to the main board via CAN...
-
@Bogdan said in Steppers PID - NOT heaters PID:
some carefully chosen calibration movements before printing
During commissioning. Setting parameters that are important to that physical printer, but don't change often.
Hmmm... very good idea. I wonder if it could even be "feedbackless" in terms of an actual electronic sensor, and instead based on something the human observes.
Hmmm...
-
We have plans for CAN-connected stepper driver boards with encoder inputs next year. So closed loop control will be possible, using linear encoders to track the axis position.
-
@Bogdan said in Steppers PID - NOT heaters PID:
(It may already be implemented in LinuxCNC, but I didn't look into the details).
for servos only.
I think you are missunderstanding the basics
"motor pid" is positioning them, with stepper that makes zero sense, you know where stepper is.
what's mentioned further is the way movement is calculated (constant jerk, trapesoid, S curve, junction deviation etc etc ..) and that's a completely different thing.. it's where 3d printing path calculators are behind some professional cnc machines but that's mostly 'cause it would bring nothing or close to nothing to 3d printing story (our lateral forces are pathetic compared to milling machines). we are much closer to engravers than to mills and you will not find these calculations there neither..
the ringing you mention has very little to do with this (nothing to do with videos you linked). maybe S shape will reduce ringing but that's minimal, ringing is caused by shitty parts used on most printers... GT2 belts used 'cause they can bend over a tight radius, but they normally stretch and that equals ringing... you can find glass enforced GT2 but it's rare, expensive and not mounted to any of the printers I seen so far (from prusa & ultimaker to super cheap PRC stuff) ... the new E3D machine supposedly comes with german GT2 that's reinforced, we'll see how it behaves when it arrives.. but look at your regular cheap popular printers these days (ender 5, ender5s, wanhao d9, creality cr10 etc etc..) there is a SPRING on the each belt!!!!!! there's no electronics that will remove ringing produced by those springs, the only thing you can do there is crawl to halt (reduce acceleration to nothing and jerk/junction deviation to zero )
-
@smece said in Steppers PID - NOT heaters PID:
... you can find glass enforced GT2 but it's rare, expensive and not mounted to any of the printers I seen so far (from prusa & ultimaker to super cheap PRC stuff) ...Almost all GT2 belts, even/especially the cheap ones, are glass reinforced. You can also find kevlar and steel reinforced belts.
You can consider the presence of clothespin spring tensioners a sign of a bad design. Recently I've only seen them on corexy machines where the pulleys were not positioned to keep the belts parallel to the guide rails. In such machines the belt tension will vary with the position of the extruder carriage. In that case they may be needed to keep the belt tight enough to drive the mechanism at all extruder carriage positions.
-
Genuine "GT2/3" belts (3 is the latest rev) ONLY have glass fiber reinforcement. Anything else is not made or designed by gates. No steel, nothing.
-
@mrehorstdmd said in Steppers PID - NOT heaters PID:
Almost all GT2 belts, even/especially the cheap ones, are glass reinforced. You can also find kevlar and steel reinforced belts.
don't have to take my word for it, test it your self. the belts on
- cr10
- cr10 500
- wanhao d9 300
- wanhao d9 500
- wanhao i3
- malyan m150
- monoprice select
...
every single of those printers comes with belts that stretch
all the cheap aliexpress stuff (e.g. https://www.aliexpress.com/item/32811803594.html ) are belts that stretch
when you compare that with proper original gates or similar reinforced japanese belts you figure out the difference but the problem for most ppl is no frame of reference as I'm yet to see a printer that arrives with original gates ...
don't confuse the pathetic textile mesh embedded in the PU as reinforcement just measure the stretchiness of the belt itself... when you work with them for a while you can also tell by the sound they make...
now apart from shitty belts, the huge issue comes from shitty pulleys too (yes there can be a backlash in the pulley too, you can see that very easy on the laser engraver, or even more 3d printer with laser head) ... it's not that pronounced but it is there
the cheap belts that have proper armature start at 5mm / 0.2" pitch, problem with them is they can't bend around tight radius so you need to use large (18-20 tooth pully is minimal radius for proper 5mm belts)
-
@mrehorstdmd said in Steppers PID - NOT heaters PID:
You can consider the presence of clothespin spring tensioners a sign of a bad design. Recently I've only seen them on corexy
I'm yet to see a machine coming from the East that does not use them. It's a typical partner to shitty stretchy belts