[FW 3.5.2] High jerk good for circular path not for corners
-
@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
-