Welcome! Log In Create A New Profile

Advanced

Junction Deviation Explained and Visualized

Posted by Paul Wanamaker 
Junction Deviation Explained and Visualized
January 17, 2017 06:24PM
The following will illustrate how Junction Deviation and Acceleration work together for smooth cornering.

Intro:
Printer controllers use a motion control program to plan the timing of every step. Motion controllers based on GRBL use a cornering algorithm called Cornering Junction Deviation, which I'll focus on here. (Other firmware use a different algorithm called Jerk which may be implemented differently - I am not discussing Jerk here.)
I've been researching Junction Deviation as part of my research into pressure compensation.

In layman's terms:
- Junction Deviation determines how tight the controller's motion planner sees an upcoming corner to be.
- Acceleration controls how sharply the breaks and gas pedal are applied.
- The smaller the Junction Deviation, the slower the cornering speed will be.
- Don't worry, the term "Junction Deviation" doesn't mean the printer will deviate from it's course!

I wanted to be able to visualize the effect that Junction Deviation and Acceleration have on cornering speed and segment time. So I extracted and "functionated" the Junction Deviation calculation from Smoothieware and created a visualizer for my use, and these screenshots are the result.

The most critical inputs to the calculation are the Acceleration, Junction Angle, and the Junction Deviation, where Junction Deviation is a number between 0 and about 1 (numbers over 0.5 are ridiculous tho). I won't go into the details of the equation here, I'm focusing on the effects.

The top plot shows the cornering speed at different junction angles for a maximum printing speed of 40 mm/s, given the inputs on the right. A 90 degree junction angle is simply a 90 degree corner between two segments. The red line shows where the target angle intersects the travel speed - giving the cornering speed for the given angle.

The middle plot shows the cornering speeds for up to a 150 mm/s travel speed.
If the acceleration is the same, then the plots for printing and travel are identical (up to the maximum print speed).

When printing a 90 degree corner: the effector will slow to about 15mm/s given the junction deviation of 0.100 and 1000 mm/sec Acceleration. Increasing either the Junction Deviation or the Acceleration will shift that line up, and the machine will corner faster.



The bottom plot shows a simulation of:
- two printing segments with a 90 degree corner between them,
- and then two travel segments with a 90 degree corner between them.

Each of these pairs of segments shows a dip in the center down to 15 mm/s - this is the cornering speed at the target 90 degree angle.

The motion for each pair of segments in detail is: Accelerate from 0 to the requested speed, speed is flat to before the corner/junction point, decelerate to junction speed between segments, accelerate back to the requested speed in the next segment, speed is flat to before end of segment, decelerate to 0.

If Junction Deviation was not used: the printer would just try to slam around the corner at full speed, and that would cause many problems (lost steps, extreme vibration, etc). If I could turn Junction Deviation off, then the plot of each pair of segments would not dip in the center.

There is one other parameter used with Junction Deviation: "Minimum Planner Speed" in Smoothieware.

For my screen I labeled it "Minimum Junction Speed" as I think that better describes it.
Notice at the beginning of the first two plots there is a knee, it starts out with a speed of 0, and then jumps up suddenly at about 18 degrees. This is a hardcoded "feature" of the J.D. calculation as it was implemented - any angle below about 18 degrees is considered essentially 0 degrees, and the "Minimum Planner Speed" is used.
If you want to make very sharp corners print faster then you can increase the "Minimum Planner Speed" from the default 0 mm/s.

Notice also that at about 162 degrees there is a sharp rise to full speed. This is also how J.D. was implemented - nearly strait angles more than (180 minus 18 degrees) are considered strait.

For comparison the following shows what happens if junction deviation is increased to 0.300. The cornering speed at 90 degrees has increased from about 15 mm/s to about 27 mm/s. That could well be enough to cause ringing - depending on the printer.



Note that this would be equal to the speed reached if you just changed the acceleration from 1000 mm/sec/sec to 3000 mm/sec/sec (although the acceleration slope would be much sharper!).

I also increased the "Minimum Planner Speed" to 5 mm/s - notice how the beginning of the first two plots does not start at 0. This amount only will affect angles below 18 degrees, however if you increased Minimum Planner Speed to 10 it would speed up corners with 30 degree angles to 10 mm/s. I'm not necessarily recommending it - only testing will tell how this would affect your printer!

You can change the Junction Deviation and Minimum Planner Speed (Minimum Junction Speed) in the Smoothie Config file, or using the M205 command. Other firmware will use different settings - you will need to do your own research on that.

You can test Junction Deviation and acceleration using a model like this one.

If I've made any errors, or if you have something to add, please let me know!

Edited 1 time(s). Last edit at 01/17/2017 06:27PM by Paul Wanamaker.


My printer: Raptosaur - Large Format Delta - [www.paulwanamaker.wordpress.com]
Can you answer questions about Calibration, Printing issues, Mechanics? Write it up and improve the Wiki!
Re: Junction Deviation Explained and Visualized
June 05, 2017 09:18AM
I appreciate the effort you put in to this. Was very helpful info.
Re: Junction Deviation Explained and Visualized
June 05, 2017 10:04AM
I was able to follow your explanation well, the charts were very useful.

Do you have any opinion on the performance of junction deviation? I've always viewed it as an awkward hack since it requests moves that are physically unlikely and expects stepper motor compliance to smooth it out.

Traditional trajectory planners keep velocity and its derivatives within the configured limits at all times, and allows the user to choose a middle ground between exact stop and constant velocity (via corner rounding). [dynomotion.com]

LinuxCNC has a very nice trajectory planner as well: [wiki.linuxcnc.org]
Re: Junction Deviation Explained and Visualized
February 07, 2018 08:43AM
Very interesting article.
Do you know if smoothieware can reduce extrusion rate in sharp corners using the same parameters used in junction deviation. It could prevent over extruding in sharp corners when junction deviation is low. If the hot end must slow down in corners, it should also decrease extrusion rate in the same way..

Edited 1 time(s). Last edit at 02/07/2018 08:44AM by sophal.
Re: Junction Deviation Explained and Visualized
August 02, 2020 01:42AM
How does the firmware or slicer know what the junction angle is?
Sorry, only registered users may post in this forum.

Click here to login