[FW 3.5.2] High jerk good for circular path not for corners
-
@gloomyandy good points. So far I cannot tell you if I noticed artifacts due to rounding, but it might be possible.
The junction deviation might be a good improvement, although I'm not sure how to merge this approach with the current workflow.
From my understanding the purpose of DDA::MatchSpeed is to check whether beforePrepare.targetNextSpeed is actually feasible by the drives, so implementing there the junction deviation speed would mean "overwriting" how beforePrepare.targetNextSpeed was computed before.Does someone know if there are plans to implement the junction deviation or something similar in the codebase?
-
@leone check https://github.com/Duet3D/RepRapFirmware/blob/3.6-dev/src/Todo-next.txt for a good idea of what's up next.
-
@oliof the possibility of having the s-curves sounds exciting! Really looking forward to it.
Meanwhile, I did some other tests to smooth the motion of the printer I'm currently working with.As @gloomyandy suggested, I tried to implement the grbl junction deviation algorithm inside the function DDA::MatchSpeed, but I wasn't able to get decent behavior out of it.
I believe the main reason why the junction deviation didn't perform well is because of the slow decreasing behavior in function of the angle, having again the problem of balancing the high jerk for arcs and the low jerks for corners.
So I improved my "adaptive jerk" approach, implementing a continuous function to scale down from the maximum to the minimum jerk value. I'm still under testing and tuning it but so far it seems to perform quite well. Below the difference of the junction deviation (tuned to have decent arcs) compared to the "adaptive jerk". (X axis is -cos(alpha) wrt the first sketch). -
@leone That "adaptive jerk" curve seems very sharp to me. What angle between two vectors is that "knee" in the graph? It looks to me like any angle below about 150 degrees between the two will result in a jerk of almost zero. That seems pretty extreme. have I misinterpreted the graph? I can see how this would be fine on smooth arcs (with a lot of segments) but how well does it work on things like chamfers and things like holes designed to hold hex nuts etc. Maybe you need that for your printer setup but I would have thought that the junction deviation curve would work much better on most printers.
-
@gloomyandy your interpretation is correct. However, I have a couple of parameters that allow to change the behaviour of the curve.
The function is:allowedJerk = A / (1 + e^(B*(cosAngle + cosAngleThreshold))))+ C
where:
- A = maxJerk (defined by M566) - minJerk
- B = tunable parameter to define the slope of the decay from maxJerk to minJerk
- C = minJerk
Below the plot of the function with maxJerk = 600 mm/min, minJerk = 6 mm/min cosAngleThreshold = -0.707 (following the first picture, alpha=45deg) and increasing B.
In that configuration, vectors at 45deg will have an allowableJerk of 300mm/min, while for 90deg 6mm/min. I think having such a low jerk for sharp corners is not bad, also it allows the input shaping to work better since you have a bigger acceleration profile.
This approach gave me more flexibility, and with a proper setting of parameters you can have pretty much the same behaviour of the junction deviation. I can post the code of course if anyone is interested.
The weak point I see in both approaches (or working only inside DDA::MatchSpeeds) is when the round corners have a very fine mesh and the angle between two consecutive vectors is small. In that case, you may have the "illusion" of traveling a linear path while actually doing a circle and then end up going too fast.
-
@leone Yep please post your code. It would be interesting to see how you have implemented it. From what I remember the original GRBL code was pretty efficient and did not need many/any expensive trig operations.
-
@gloomyandy here it is. It's not much more complicate than the original DDA::MatchSpeed function. It can also be simplified by removing the rotation matrix definition and just compute the X coordinate of v2 in the reference frame of v1.
I also decided to implement it only for xy moves and keeping the possibility to disable it by setting the JerkDecay parameter to zero.void DDA::MatchSpeeds() noexcept { // v2 needs to be expressed in the reference frame of v1 // directionVector and next->directionVector are unit vectors // The rotation matrix R(-angle) can be expressed by using the directionVector[0] and directionVector[1] which are the X and Y components of v1 in the absolute reference frame (v1_0). const float rotationMatrix[2][2] = { { directionVector[0], directionVector[1] }, { -directionVector[1], directionVector[0] } }; // Project v2 in the reference frame of v1 (v2_1) const float nextVectorProjected[2] = { rotationMatrix[0][0] * next->directionVector[0] + rotationMatrix[0][1] * next->directionVector[1], rotationMatrix[1][0] * next->directionVector[0] + rotationMatrix[1][1] * next->directionVector[1] }; debugPrintf("JUNCTION: START targetNextSpeed [mm/s]: %f \n", (double)InverseConvertSpeedToMmPerSec(beforePrepare.targetNextSpeed)); DebugPrintVector("JUNCTION: directionVector \n", directionVector, 2); DebugPrintVector("JUNCTION: next->directionVector ", next->directionVector, 2); DebugPrintVector("JUNCTION: nextVectorProjected ", nextVectorProjected, 2); for (size_t drive = 0; drive < MaxAxesPlusExtruders; ++drive) { if (directionVector[drive] != 0.0 || next->directionVector[drive] != 0.0) { const float totalFraction = fabsf(directionVector[drive] - next->directionVector[drive]); const float jerk = totalFraction * beforePrepare.targetNextSpeed; float allowedJerk = reprap.GetPlatform().GetInstantDv(drive); if (flags.xyMoving && flags.isPrintingMove && reprap.GetPlatform().JerkDecay() != 0) { const float A = (reprap.GetPlatform().GetInstantDv(drive) - ConvertSpeedFromMmPerSec(MinimumJerk)); const float B = reprap.GetPlatform().JerkDecay(); const float C = ConvertSpeedFromMmPerSec(MinimumJerk); allowedJerk = A / (1 + (float)exp(B * (-nextVectorProjected[0] + reprap.GetPlatform().JunctionDeviation()))) + C; debugPrintf("JUNCTION: allowedJerk for drive %i: %f \n", drive, (double)InverseConvertSpeedToMmPerSec(allowedJerk)); } if (jerk > allowedJerk) { beforePrepare.targetNextSpeed = allowedJerk/totalFraction; } } } debugPrintf("JUNCTION: junctionSpeed [mm/s]: %f \n", (double)InverseConvertSpeedToMmPerSec(beforePrepare.targetNextSpeed)); }
-
@leone I've been considering using a different angle/speed-change curve for well over a year, but other priorities have always got in the way. I definitely want to get something along these lines implemented in 3.6 or 3.7. Like you I determined that switching to junction deviation wasn't a solution.
-
@dc42 thanks for the feedback!
-
@leone for small changes in direction I think the concept of jerk works reasonable well; but for larger changes (especially square corners) I think it ss better to accept a greater slowdown. The question is, what sort of curve should be used in between, and what parameters of that curve need to be configurable? For simplicity and ease of understanding, I'd prefer to use just 2 parameters, possibly jerk and square corner speed.
-
@dc42 Thinking in abstract terms, to completely describe and have full control of such a transition, the total amount of parameters might be: max speed change, min speed change (square corner speed), angle threshold (to determine at which angle the curve has to drop), and the slope of the curve.
Focusing on the parameters and not on the type of curve now, I agree that for simplicity two parameters are preferable, but if we use max speed change and min speed change, the user doesn't have control over the transition between the two speeds. I think the slope of the curve can be hard coded (with a parameter or by the type of the curve itself), but if I had to choose a second parameter, between a min speed change or an angle threshold, I would rather prefer to have control on the angle threshold and have the min speed change decided by the FW (it might also be the minJerk). -
I'd like to share some the results of some tests I've been running which may be of interest. The test fall into two parts, the first stage is to investigate the current RRF implementation, the second is to compare that to a Klipper/grbl style junction deviation system.
I have my printer configured with a jerk setting of 500mm/min on X and Y and an acceleration of 8000mm/s/s on X and Y.
M566 X500 Y500 M201 X8000 Y8000
I have two simple test files, the first moves the head in a square, the second uses a series of short lines to simulate a circle. I've modified the firmware to print out the destination X, Y, the move start/end speed, the top speed, the requested speed, the acceleration, deceleration and move length. The results when simulating the square test are as follows:
X 1.00e+2 Y 0.00e+0 start 0.00e+0 end 8.33e+0 ts 1.00e+2 rs 1.00e+2 acc 8.00e+3 dec 8.00e+3 dist 1.00e+2 X 1.00e+2 Y 1.00e+2 start 8.33e+0 end 8.33e+0 ts 1.00e+2 rs 1.00e+2 acc 8.00e+3 dec 8.00e+3 dist 1.00e+2 X 0.00e+0 Y 1.00e+2 start 8.33e+0 end 8.33e+0 ts 1.00e+2 rs 1.00e+2 acc 8.00e+3 dec 8.00e+3 dist 1.00e+2 X 0.00e+0 Y 0.00e+0 start 8.33e+0 end 0.00e+0 ts 1.00e+2 rs 1.00e+2 acc 8.00e+3 dec 8.00e+3 dist 1.00e+2
Which is pretty much what we might expect (though with the current jerk settings it is rather hard to predict what the start/end speeds might be).
However when I run the circle test things look a little odd (at least to me):
X 1.40e+2 Y 9.02e+1 start 0.00e+0 end 6.79e+0 ts 1.50e+2 rs 1.50e+2 acc 9.53e+3 dec 9.53e+3 dist 1.66e+2 X 1.41e+2 Y 8.90e+1 start 6.79e+0 end 8.64e+1 ts 1.50e+2 rs 1.50e+2 acc 1.10e+4 dec 1.10e+4 dist 1.79e+0 X 1.42e+2 Y 8.79e+1 start 8.64e+1 end 7.83e+1 ts 1.50e+2 rs 1.50e+2 acc 9.89e+3 dec 9.89e+3 dist 1.79e+0 X 1.44e+2 Y 8.71e+1 start 7.83e+1 end 7.36e+1 ts 1.49e+2 rs 1.50e+2 acc 9.13e+3 dec 9.13e+3 dist 1.80e+0 X 1.46e+2 Y 8.64e+1 start 7.36e+1 end 6.95e+1 ts 1.43e+2 rs 1.50e+2 acc 8.61e+3 dec 8.61e+3 dist 1.79e+0 X 1.47e+2 Y 8.60e+1 start 6.95e+1 end 6.77e+1 ts 1.40e+2 rs 1.50e+2 acc 8.26e+3 dec 8.26e+3 dist 1.80e+0 X 1.49e+2 Y 8.57e+1 start 6.77e+1 end 6.65e+1 ts 1.38e+2 rs 1.50e+2 acc 8.06e+3 dec 8.06e+3 dist 1.80e+0 X 1.51e+2 Y 8.57e+1 start 6.65e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.53e+2 Y 8.60e+1 start 6.65e+1 end 6.77e+1 ts 1.38e+2 rs 1.50e+2 acc 8.06e+3 dec 8.06e+3 dist 1.80e+0 X 1.54e+2 Y 8.64e+1 start 6.77e+1 end 6.95e+1 ts 1.40e+2 rs 1.50e+2 acc 8.26e+3 dec 8.26e+3 dist 1.80e+0 X 1.56e+2 Y 8.71e+1 start 6.95e+1 end 7.35e+1 ts 1.43e+2 rs 1.50e+2 acc 8.61e+3 dec 8.61e+3 dist 1.79e+0 X 1.58e+2 Y 8.79e+1 start 7.35e+1 end 7.87e+1 ts 1.49e+2 rs 1.50e+2 acc 9.13e+3 dec 9.13e+3 dist 1.80e+0 X 1.59e+2 Y 8.90e+1 start 7.87e+1 end 8.61e+1 ts 1.50e+2 rs 1.50e+2 acc 9.89e+3 dec 9.89e+3 dist 1.79e+0 X 1.60e+2 Y 9.02e+1 start 8.61e+1 end 9.09e+1 ts 1.50e+2 rs 1.50e+2 acc 1.10e+4 dec 1.10e+4 dist 1.79e+0 X 1.62e+2 Y 9.16e+1 start 9.09e+1 end 8.24e+1 ts 1.50e+2 rs 1.50e+2 acc 1.04e+4 dec 1.04e+4 dist 1.79e+0 X 1.63e+2 Y 9.31e+1 start 8.24e+1 end 7.54e+1 ts 1.50e+2 rs 1.50e+2 acc 9.48e+3 dec 9.48e+3 dist 1.80e+0 X 1.63e+2 Y 9.47e+1 start 7.54e+1 end 7.12e+1 ts 1.46e+2 rs 1.50e+2 acc 8.84e+3 dec 8.84e+3 dist 1.79e+0 X 1.64e+2 Y 9.64e+1 start 7.12e+1 end 6.89e+1 ts 1.41e+2 rs 1.50e+2 acc 8.41e+3 dec 8.41e+3 dist 1.79e+0 X 1.64e+2 Y 9.82e+1 start 6.89e+1 end 6.65e+1 ts 1.39e+2 rs 1.50e+2 acc 8.14e+3 dec 8.14e+3 dist 1.79e+0 X 1.64e+2 Y 1.00e+2 start 6.65e+1 end 6.68e+1 ts 1.37e+2 rs 1.50e+2 acc 8.02e+3 dec 8.02e+3 dist 1.80e+0 X 1.64e+2 Y 1.02e+2 start 6.68e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.02e+3 dec 8.02e+3 dist 1.80e+0 X 1.64e+2 Y 1.04e+2 start 6.65e+1 end 6.89e+1 ts 1.39e+2 rs 1.50e+2 acc 8.14e+3 dec 8.14e+3 dist 1.79e+0 X 1.63e+2 Y 1.05e+2 start 6.89e+1 end 7.12e+1 ts 1.41e+2 rs 1.50e+2 acc 8.41e+3 dec 8.41e+3 dist 1.79e+0 X 1.63e+2 Y 1.07e+2 start 7.12e+1 end 7.54e+1 ts 1.46e+2 rs 1.50e+2 acc 8.84e+3 dec 8.84e+3 dist 1.79e+0 X 1.62e+2 Y 1.08e+2 start 7.54e+1 end 8.24e+1 ts 1.50e+2 rs 1.50e+2 acc 9.48e+3 dec 9.48e+3 dist 1.80e+0 X 1.60e+2 Y 1.10e+2 start 8.24e+1 end 9.09e+1 ts 1.50e+2 rs 1.50e+2 acc 1.04e+4 dec 1.04e+4 dist 1.79e+0 X 1.59e+2 Y 1.11e+2 start 9.09e+1 end 8.64e+1 ts 1.50e+2 rs 1.50e+2 acc 1.10e+4 dec 1.10e+4 dist 1.79e+0 X 1.58e+2 Y 1.12e+2 start 8.64e+1 end 7.83e+1 ts 1.50e+2 rs 1.50e+2 acc 9.89e+3 dec 9.89e+3 dist 1.79e+0 X 1.56e+2 Y 1.13e+2 start 7.83e+1 end 7.36e+1 ts 1.49e+2 rs 1.50e+2 acc 9.13e+3 dec 9.13e+3 dist 1.80e+0 X 1.54e+2 Y 1.14e+2 start 7.36e+1 end 6.95e+1 ts 1.43e+2 rs 1.50e+2 acc 8.61e+3 dec 8.61e+3 dist 1.79e+0 X 1.53e+2 Y 1.14e+2 start 6.95e+1 end 6.77e+1 ts 1.40e+2 rs 1.50e+2 acc 8.26e+3 dec 8.26e+3 dist 1.80e+0 X 1.51e+2 Y 1.14e+2 start 6.77e+1 end 6.65e+1 ts 1.38e+2 rs 1.50e+2 acc 8.06e+3 dec 8.06e+3 dist 1.80e+0 X 1.49e+2 Y 1.14e+2 start 6.65e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.47e+2 Y 1.14e+2 start 6.65e+1 end 6.77e+1 ts 1.38e+2 rs 1.50e+2 acc 8.06e+3 dec 8.06e+3 dist 1.80e+0 X 1.46e+2 Y 1.14e+2 start 6.77e+1 end 6.95e+1 ts 1.40e+2 rs 1.50e+2 acc 8.26e+3 dec 8.26e+3 dist 1.80e+0 X 1.44e+2 Y 1.13e+2 start 6.95e+1 end 7.35e+1 ts 1.43e+2 rs 1.50e+2 acc 8.61e+3 dec 8.61e+3 dist 1.79e+0 X 1.42e+2 Y 1.12e+2 start 7.35e+1 end 7.87e+1 ts 1.49e+2 rs 1.50e+2 acc 9.13e+3 dec 9.13e+3 dist 1.80e+0 X 1.41e+2 Y 1.11e+2 start 7.87e+1 end 8.61e+1 ts 1.50e+2 rs 1.50e+2 acc 9.89e+3 dec 9.89e+3 dist 1.79e+0 X 1.40e+2 Y 1.10e+2 start 8.61e+1 end 9.09e+1 ts 1.50e+2 rs 1.50e+2 acc 1.10e+4 dec 1.10e+4 dist 1.79e+0 X 1.38e+2 Y 1.08e+2 start 9.09e+1 end 8.22e+1 ts 1.50e+2 rs 1.50e+2 acc 1.04e+4 dec 1.04e+4 dist 1.79e+0 X 1.37e+2 Y 1.07e+2 start 8.22e+1 end 7.67e+1 ts 1.50e+2 rs 1.50e+2 acc 9.48e+3 dec 9.48e+3 dist 1.77e+0 X 1.37e+2 Y 1.05e+2 start 7.67e+1 end 7.03e+1 ts 1.47e+2 rs 1.50e+2 acc 8.85e+3 dec 8.85e+3 dist 1.82e+0 X 1.36e+2 Y 1.04e+2 start 7.03e+1 end 6.89e+1 ts 1.41e+2 rs 1.50e+2 acc 8.41e+3 dec 8.41e+3 dist 1.79e+0 X 1.36e+2 Y 1.02e+2 start 6.89e+1 end 6.65e+1 ts 1.39e+2 rs 1.50e+2 acc 8.14e+3 dec 8.14e+3 dist 1.79e+0 X 1.36e+2 Y 1.00e+2 start 6.65e+1 end 6.68e+1 ts 1.37e+2 rs 1.50e+2 acc 8.02e+3 dec 8.02e+3 dist 1.80e+0 X 1.36e+2 Y 9.82e+1 start 6.68e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.02e+3 dec 8.02e+3 dist 1.80e+0 X 1.36e+2 Y 9.64e+1 start 6.65e+1 end 6.89e+1 ts 1.39e+2 rs 1.50e+2 acc 8.14e+3 dec 8.14e+3 dist 1.79e+0 X 1.37e+2 Y 9.47e+1 start 6.89e+1 end 7.03e+1 ts 1.41e+2 rs 1.50e+2 acc 8.41e+3 dec 8.41e+3 dist 1.79e+0 X 1.37e+2 Y 9.31e+1 start 7.03e+1 end 7.67e+1 ts 1.47e+2 rs 1.50e+2 acc 8.85e+3 dec 8.85e+3 dist 1.82e+0 X 1.38e+2 Y 9.17e+1 start 7.67e+1 end 8.65e+1 ts 1.50e+2 rs 1.50e+2 acc 9.48e+3 dec 9.48e+3 dist 1.67e+0 X 1.40e+2 Y 9.02e+1 start 8.65e+1 end 0.00e+0 ts 1.50e+2 rs 1.50e+2 acc 1.03e+4 dec 1.03e+4 dist 1.89e+0
As you can see we have start/end speeds that vary from 6.65mm/s to over 9mm/s and there is a similar variation in the acceleration/deceleration values being used. Further thought/investigation shows that RRF applies the jerk/acceleration limits per motor/driver rather than along the actual path of the printer head. This means that because (depending on kinematics) we sometimes have just a single motor moving the print head while at other times we use two motors we have different "limits" being applied to each move. RRF does allow you to specify an acceleration limit that applies along the path of the move by using the m204 command. If we apply this:
M204 P8000 T8000
then run the test again we get:
X 1.40e+2 Y 9.02e+1 start 0.00e+0 end 6.79e+0 ts 1.50e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.66e+2 X 1.41e+2 Y 8.90e+1 start 6.79e+0 end 8.64e+1 ts 1.35e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.42e+2 Y 8.79e+1 start 8.64e+1 end 7.83e+1 ts 1.45e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.44e+2 Y 8.71e+1 start 7.83e+1 end 7.36e+1 ts 1.42e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.46e+2 Y 8.64e+1 start 7.36e+1 end 6.95e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.47e+2 Y 8.60e+1 start 6.95e+1 end 6.77e+1 ts 1.38e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.49e+2 Y 8.57e+1 start 6.77e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.51e+2 Y 8.57e+1 start 6.65e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.53e+2 Y 8.60e+1 start 6.65e+1 end 6.77e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.54e+2 Y 8.64e+1 start 6.77e+1 end 6.95e+1 ts 1.38e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.56e+2 Y 8.71e+1 start 6.95e+1 end 7.35e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.58e+2 Y 8.79e+1 start 7.35e+1 end 7.87e+1 ts 1.42e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.59e+2 Y 8.90e+1 start 7.87e+1 end 8.61e+1 ts 1.45e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.60e+2 Y 9.02e+1 start 8.61e+1 end 9.09e+1 ts 1.49e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.62e+2 Y 9.16e+1 start 9.09e+1 end 8.24e+1 ts 1.48e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.63e+2 Y 9.31e+1 start 8.24e+1 end 7.54e+1 ts 1.44e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.63e+2 Y 9.47e+1 start 7.54e+1 end 7.12e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.64e+2 Y 9.64e+1 start 7.12e+1 end 6.89e+1 ts 1.39e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.64e+2 Y 9.82e+1 start 6.89e+1 end 6.65e+1 ts 1.38e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.64e+2 Y 1.00e+2 start 6.65e+1 end 6.68e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.64e+2 Y 1.02e+2 start 6.68e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.64e+2 Y 1.04e+2 start 6.65e+1 end 6.89e+1 ts 1.38e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.63e+2 Y 1.05e+2 start 6.89e+1 end 7.12e+1 ts 1.39e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.63e+2 Y 1.07e+2 start 7.12e+1 end 7.54e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.62e+2 Y 1.08e+2 start 7.54e+1 end 8.24e+1 ts 1.44e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.60e+2 Y 1.10e+2 start 8.24e+1 end 9.09e+1 ts 1.48e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.59e+2 Y 1.11e+2 start 9.09e+1 end 8.64e+1 ts 1.49e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.58e+2 Y 1.12e+2 start 8.64e+1 end 7.83e+1 ts 1.45e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.56e+2 Y 1.13e+2 start 7.83e+1 end 7.36e+1 ts 1.42e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.54e+2 Y 1.14e+2 start 7.36e+1 end 6.95e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.53e+2 Y 1.14e+2 start 6.95e+1 end 6.77e+1 ts 1.38e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.51e+2 Y 1.14e+2 start 6.77e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.49e+2 Y 1.14e+2 start 6.65e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.47e+2 Y 1.14e+2 start 6.65e+1 end 6.77e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.46e+2 Y 1.14e+2 start 6.77e+1 end 6.95e+1 ts 1.38e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.44e+2 Y 1.13e+2 start 6.95e+1 end 7.35e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.42e+2 Y 1.12e+2 start 7.35e+1 end 7.87e+1 ts 1.42e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.41e+2 Y 1.11e+2 start 7.87e+1 end 8.61e+1 ts 1.45e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.40e+2 Y 1.10e+2 start 8.61e+1 end 9.09e+1 ts 1.49e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.38e+2 Y 1.08e+2 start 9.09e+1 end 8.22e+1 ts 1.48e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.37e+2 Y 1.07e+2 start 8.22e+1 end 7.67e+1 ts 1.43e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.77e+0 X 1.37e+2 Y 1.05e+2 start 7.67e+1 end 7.03e+1 ts 1.41e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.82e+0 X 1.36e+2 Y 1.04e+2 start 7.03e+1 end 6.89e+1 ts 1.39e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.36e+2 Y 1.02e+2 start 6.89e+1 end 6.65e+1 ts 1.38e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.36e+2 Y 1.00e+2 start 6.65e+1 end 6.68e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.36e+2 Y 9.82e+1 start 6.68e+1 end 6.65e+1 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.36e+2 Y 9.64e+1 start 6.65e+1 end 6.89e+1 ts 1.38e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.37e+2 Y 9.47e+1 start 6.89e+1 end 7.03e+1 ts 1.39e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.37e+2 Y 9.31e+1 start 7.03e+1 end 7.67e+1 ts 1.41e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.82e+0 X 1.38e+2 Y 9.17e+1 start 7.67e+1 end 8.65e+1 ts 1.42e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.67e+0 X 1.40e+2 Y 9.02e+1 start 8.65e+1 end 0.00e+0 ts 1.37e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.89e+0
As you can see we now have constant acceleration values, but the start/end speeds still vary from 6.65 to 9.09mm/s (note that we now no longer reach our requested velocity due to the reduction in acceleration).
I find this a little concerning, I would have thought that to get the best surface finish it would be better to minimise the variation in velocity as much as possible.
-
Part two of the previous post:
As an experiment I have implemented a grbl/Klipper style junction deviation algorithm (they are both very similar, the major difference is that Klipper specifies the allowed junction deviation in terms of square corner velocity, which I think is probably a better way to express what is happening). Using this algorithm with the square corner velocity set to 5mm/s (and with the m204 settings from above) I get the following results for the square:
X 1.00e+2 Y 0.00e+0 start 0.00e+0 end 5.00e+0 ts 1.00e+2 rs 1.00e+2 acc 8.00e+3 dec 8.00e+3 dist 1.00e+2 X 1.00e+2 Y 1.00e+2 start 5.00e+0 end 5.00e+0 ts 1.00e+2 rs 1.00e+2 acc 8.00e+3 dec 8.00e+3 dist 1.00e+2 X 0.00e+0 Y 1.00e+2 start 5.00e+0 end 5.00e+0 ts 1.00e+2 rs 1.00e+2 acc 8.00e+3 dec 8.00e+3 dist 1.00e+2 X 0.00e+0 Y 0.00e+0 start 5.00e+0 end 0.00e+0 ts 1.00e+2 rs 1.00e+2 acc 8.00e+3 dec 8.00e+3 dist 1.00e+2
Here you can see that the start/end speed for the right angle corners is indeed being limited to 5mm/s (which is slower then the same corners using RRF jerk settings). If I then run the circle test:
X 1.40e+2 Y 9.02e+1 start 0.00e+0 end 6.20e+0 ts 1.50e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.66e+2 X 1.41e+2 Y 8.90e+1 start 6.20e+0 end 7.26e+1 ts 1.30e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.42e+2 Y 8.79e+1 start 7.26e+1 end 7.21e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.44e+2 Y 8.71e+1 start 7.21e+1 end 7.27e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.46e+2 Y 8.64e+1 start 7.27e+1 end 7.20e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.47e+2 Y 8.60e+1 start 7.20e+1 end 7.25e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.49e+2 Y 8.57e+1 start 7.25e+1 end 7.24e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.51e+2 Y 8.57e+1 start 7.24e+1 end 7.24e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.53e+2 Y 8.60e+1 start 7.24e+1 end 7.25e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.54e+2 Y 8.64e+1 start 7.25e+1 end 7.20e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.56e+2 Y 8.71e+1 start 7.20e+1 end 7.25e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.58e+2 Y 8.79e+1 start 7.25e+1 end 7.25e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.59e+2 Y 8.90e+1 start 7.25e+1 end 7.24e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.60e+2 Y 9.02e+1 start 7.24e+1 end 7.23e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.62e+2 Y 9.16e+1 start 7.23e+1 end 7.26e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.63e+2 Y 9.31e+1 start 7.26e+1 end 7.21e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.63e+2 Y 9.47e+1 start 7.21e+1 end 7.22e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.64e+2 Y 9.64e+1 start 7.22e+1 end 7.28e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.64e+2 Y 9.82e+1 start 7.28e+1 end 7.19e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.64e+2 Y 1.00e+2 start 7.19e+1 end 7.29e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.64e+2 Y 1.02e+2 start 7.29e+1 end 7.19e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.64e+2 Y 1.04e+2 start 7.19e+1 end 7.28e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.63e+2 Y 1.05e+2 start 7.28e+1 end 7.22e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.63e+2 Y 1.07e+2 start 7.22e+1 end 7.21e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.62e+2 Y 1.08e+2 start 7.21e+1 end 7.26e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.60e+2 Y 1.10e+2 start 7.26e+1 end 7.23e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.59e+2 Y 1.11e+2 start 7.23e+1 end 7.26e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.58e+2 Y 1.12e+2 start 7.26e+1 end 7.21e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.56e+2 Y 1.13e+2 start 7.21e+1 end 7.27e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.54e+2 Y 1.14e+2 start 7.27e+1 end 7.20e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.53e+2 Y 1.14e+2 start 7.20e+1 end 7.25e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.51e+2 Y 1.14e+2 start 7.25e+1 end 7.24e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.49e+2 Y 1.14e+2 start 7.24e+1 end 7.24e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.47e+2 Y 1.14e+2 start 7.24e+1 end 7.25e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.46e+2 Y 1.14e+2 start 7.25e+1 end 7.20e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.44e+2 Y 1.13e+2 start 7.20e+1 end 7.25e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.42e+2 Y 1.12e+2 start 7.25e+1 end 7.25e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.41e+2 Y 1.11e+2 start 7.25e+1 end 7.24e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.40e+2 Y 1.10e+2 start 7.24e+1 end 7.23e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.38e+2 Y 1.08e+2 start 7.23e+1 end 7.25e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.37e+2 Y 1.07e+2 start 7.25e+1 end 7.32e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.77e+0 X 1.37e+2 Y 1.05e+2 start 7.32e+1 end 7.12e+1 ts 1.41e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.82e+0 X 1.36e+2 Y 1.04e+2 start 7.12e+1 end 7.28e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.36e+2 Y 1.02e+2 start 7.28e+1 end 7.19e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.36e+2 Y 1.00e+2 start 7.19e+1 end 7.29e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.36e+2 Y 9.82e+1 start 7.29e+1 end 7.19e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.80e+0 X 1.36e+2 Y 9.64e+1 start 7.19e+1 end 7.28e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.37e+2 Y 9.47e+1 start 7.28e+1 end 7.12e+1 ts 1.40e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.79e+0 X 1.37e+2 Y 9.31e+1 start 7.12e+1 end 7.33e+1 ts 1.41e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.82e+0 X 1.38e+2 Y 9.17e+1 start 7.33e+1 end 7.65e+1 ts 1.38e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.67e+0 X 1.40e+2 Y 9.02e+1 start 7.65e+1 end 0.00e+0 ts 1.34e+2 rs 1.50e+2 acc 8.00e+3 dec 8.00e+3 dist 1.89e+0
The start/end speeds are now much more consistent (for why they are not identical see below), as is the top speed. I tried to choose the square corner velocity setting to make the speeds match the speeds obtained using RRF on the circle test as well as I could, which on my printer produces "smooth sounding motion", interestingly this ended up being the value that Klipper uses by default.
I'm not totally sure what to conclude from this. Personally I think that junction deviation provides a better overall way of managing the velocity at a junction than the current RRF jerk system, with a slower speed being used at sharper corners and a more consistent speed on the shallow corners of the circle. I appreciate that the curve used may not be "correct" for all printers, but the nice thing about the grbl algorithm is that it seems to be reasonably efficient (and has been tested on a wide variety of machines). If we plan to replace jerk I'd certainly suggest that we use something that can be applied to the velocity of the move rather than to the motors/drivers (though perhaps the current jerk mechanism could be used as a per motor upper limit rather like m201 acceleration is used when combined with M204 limits).
NOTE 1: I'm currently not 100% sure why the start/end speeds are not identical when using the junction deviation code. I suspect it is mainly down to the variation in segment length (this circle was taken from slicer generated gcode). It may also possibly be caused by the type of approximation used by the grbl based code?
Note 2: Amusing to see that it looks like the forum considers "jerk" to be a "rude" word!
-
@gloomyandy it's so weird jerk was not on the list, only spam sites
-
undefined gloomyandy referenced this topic
-
@gloomyandy May I ask what has been already implemented, today 6 months later?
I am not asking out of mere curiosity. I am struggling with jerk values that are low enough at square corners (in order to avoid ringing) but are at the same time high enough to allow printing smooth curves. A kind of adaptive jerk would be the obvious solution (depending on the angle and speed difference between every two consecutive segments). Call it junction deviation if you like.
-
@Triet Which firmware version are you using. The new 3.6.beta4 firmware (findable in the beta firmware forum category) is absolutely fantastic as it has a new input shaping methodology, You may find this helps your issues.
-
@Triet Pretty much nothing more from me than I described above, which is all on an experimental branch of the stm32 port. I've been busy working on 3.6 (as the changes there seemed more important) and not really had a chance to get back to this (plus there did not seem to be much interest in discussing the results of the tests I've been running so far).
-
@Notepad I am using last stable version from Dec. 2024 (I think it was December).
Yes I will jump into the beta version. I read that the modulation of nozzle temperature depending on flow has been implemented. I have been doing experiments with varying temperature during the print using a postprocessor script and believe me, that is a great feature.
But I will have to update the PanelDue firmware first.
-
@gloomyandy Perhaps you are drawing wrong conclusions from lack of participation of other developers. Some of them modify the firmware for their particular interests, so they just do their own thing and don't care (my speculation).
In any case, mortal users would definitely welcome that kind of adaptive jerk.
Let me try to emphasize. I don't know how to explain my point. Haven't you noticed? Half a world of 3d printing people is talking about things like pressure advance, retraction, flow, speed and acceleration - the key elements to control for a succesfull print. With junction deviation (or something similar) one more advanced mechanism would enable to get rid of defects commonly found everywhere.
Klipper is becoming overwhelmingly popular and is considered the firmware of choice for ambitioned users, but every time I check and compare to RRF I have come to the same conclusion: no reason to switch, and RRF is more polished and reliable.
Until now. Why this adaptive jerk has not been done after years of RRF development... I can't understand. In my naivity, I was even asuming there is some gcode command to tune that, but no.
In my particular case, my prints tend to come out flawlessly, except I get caught by the jerk dilemma. Either low jerk and jerky, stuttering curves with artifacts , or high jerk with smooth, uniform curves but visible ringing around corners. I am constantly changing jerk settings, depending on whether the model has many corners or many curves... Seems not acceptable to me after the underlying factors have been clearly understood. Roughly: Next segment moving in same direction? High jerk! Otherwise: Low jerk! That is not rocket science.
So again, the impact of this feature is not trivial. It is not just "nice to have" but a plain necessity.
Sorry if I my statements are too blunt.
Right now we can see how a certain proprietary printer brand allows itself to treat their clients as slaves, but only because they did many things just right and conquered the market. Open systems, to which Duet3d belongs, can and should perform better.
I said what I said. Let's paint the town red.
-
@Triet Just to clarify, I do not work for or have any direct association with Duet3D. I am the main developer for the stm32 port of RRF firmware and in general I try to keep that code as close as possible to the Duet3D version (particularly for things like motion control). As such I have no direct influence over what goes into the Duet version of RRF firmware. If you wish that version to change then you need to convince @dc42 or @T3P3Tony that this is an area that needs attention. These things typically come down to time and priorities (and to some extent interest), we have all been busy working on changes in 3.6 (which have been pretty major), to some extent we are still catching up on the that in terms of understand how this new code interacts with things like jerk, PA etc. As mentioned above the changes in 3.6 over a big improvement in terms of ringing and I'd encourage you to test that version.
Also I'm not sure that the way that Klipper handles jerk is really much different to RRF, it may be a little smoother (see my tests above), but it is not fundamentally different.