Acceleration and braking ramps
-
Hello,
I am using a Duet3 Mini 5+ on a super standard CNC-like setup for a pen plotter to try out some things for a bigger project later on. Nothing fancy like a core-xy.Everything is working perfectly well, but I was wondering if there was a way to define/tune acceleration ramps and also ramps for braking with a duet board. I would like to define how fast it accelerates on a single move and how it brakes down when reaching itโs end. I looked all the way through the gcode dictionary and also tried a couple of things which just turned out to be the wrong commands (e.g what turned out to be the jerk setting which sounded kind of similar to what I was looking for).
Can this be done from the duet board or is this the job of the software that generates the gcode?
Thank you
-
-
@gloomyandy Ohhh. That M204 kind of sounds like what I am looking for, even though I was hoping for setting a smooth curve instead of a linear acceleration. Does this also apply to slowing down before reaching the end of a move or to adapt before a sudden speed change?
The explanation reads itself like it would only influence the start of a move.
-
@MrInka RRF only uses a linear ramp for acceleration and deceleration, the above commands set the rate for both.
-
@MrInka M201 sets the acceleration rate for each axis. The same acceleration rate is applied to the beginning and end of a move, and there is currently no option to have different acceleration and deceleration rates. You could submit a feature request for this functionality if you want, and it will be considered by the firmware developers: https://github.com/Duet3D/RepRapFirmware/issues
Acceleration in RRF is a linear ramp rather than S-curve, for the reasons explained by @dc42 in this post: https://forum.duet3d.com/post/317340. Note that moves that use more than one axis are coordinated, and will necessarily be limited by the speed of the slowest axis. Also, RRF doesn't necessarily slow to a stop on every move; if the next move in the move queue is at the same speed for an axis, it just carries on.
Some machines can change acceleration rate while an axis is still moving, so a different acceleration/deceleration rate can be applied to the next move; RRF does not. It requires all motion stops before the new acceleration rate is applied. See https://docs.duet3d.com/en/User_manual/Reference/Gcodes#command-queueing
M566 controls 'jerk', or 'instantaneous speed change', for each axis. This is also applied to the start and end of each move, as necessary. Because most generated Gcode is comprised of straight line segments, including around curves, there needs to be a configurable 'jump' in speed as the axis traverses the shallow corners of the 'curve'. This is generally not a problem for 3D printers, but can be an issue for CNC machines where the surface speed of the cutting tool is important. Setting low jerk avoids these jumps, but may cause more stuttering around curves, as one axis has to slow down to allow the other axis to speed up. RRF does support G2/G3 arcs, and if your Gcode generator can output G2/G3 arcs rather than line segments for curves, you can select the segmentation of arcs and lines with the M669 S parameter to minimise the effect of jerk; see https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m669-set-kinematics-type-and-kinematics-parameters
M204 sets the acceleration for different kinds of moves, and applies to all axes except extrusion axes. Travel moves are counted as those where no extrusion occurs, printing moves are those where extrusion does occur. So I don't think it is relevant for CNC or pen plotter.
I recently updated the CNC configuration wiki page, which might be useful: https://docs.duet3d.com/en/User_manual/Machine_configuration/Configuration_CNC
Ian
-
Hey Ian,
thank you for your very detailed response. This answers quite a few questions I had in mind.
I tried using M204 recently but didn't get any noticable acceleration / braking, but only hard starts and stops. Now with your info, this obviously doesn't work because I am on a cnc-configuration, where there are no extrusions. So basically everything is a travel move.
M566 / jerk also isn't what I am looking for, since i am not looking for anything specific to segments or how it handles the transition from one move to another in specific, but rather accelerating and slowing down within a single move.
So my takeaway is, that M201 is what I am looking for.
My understanding is that with an acceleration (M201) of 1000 mm/s^2, it takes the machine 1 second to reach the full speed on a G1 F1000 move in a linear way and it will also start slowing down 1 second before reaching the end of this specific move. Is that correct?
If the move in question is too short to reach this speed at all, will it start slowing down after half the distance and smoothly come to a stop, or will it try to reach the max speed until the end of the line and then do a full stop at whatever speed it reached at this point?
I am trying to smooth out a fast back and forth motion over a 50 mm distance. I am currently running with 4000 mm/s max speed and an acceleration of 4000 mm/s^2. Obviously, it won't reach it's full speed at this short distance (it would after 4000 mm), but i fill like I should atleast notice a starting acceleration or a slow-down.
M566 X2000.00 Y2000.00 Z2000.00 M203 X4000.00 Y4000.00 Z4000.00 M201 X4000.00 Y4000.00 Z4000.00
-
@MrInka said in Acceleration and braking ramps:
My understanding is that with an acceleration (M201) of 1000 mm/s^2, it takes the machine 1 second to reach the full speed on a G1 F1000 move in a linear way and it will also start slowing down 1 second before reaching the end of this specific move. Is that correct?
No, because M201 uses mm/s/s (mmilmeters per second per second) but the feedrate is specified in mm/minute. Also max speed set with M203 will be in mm/min not mm/s so currently your max speed is 1/60 of what you think it is. Also 1000mm/s is pretty fast for a cnc machine to be moving at.
To actually "see" the acceleration (so for it to take 1 second to reach your 1000mm/min) feed rate you would need an acceleration of 16.7mm/s/s not 1000mm/s/s.
-
@MrInka you could use custom input shaping to approximate S-curve acceleration. This will split the start and end of acceleration into a number of segments, each of a fixed duration. See the custom option of https://docs.duet3d.com/en/User_manual/Reference/Gcodes#m593-configure-input-shaping. It would only be applied when the acceleration and deceleration segments are long enough.
In 3D printing, "jerk" normally means instantaneous speed change (which is of course impossible). Whereas in most other motion control contexts, jerk means rate of change of acceleration.