Jump to content
Ultimaker Community of 3D Printing Experts
Dim3nsioneer

acceleration in Marlin

Recommended Posts

This is a question for the Marlin experts:

Is it possible that one of you could quickly summarize how Marlin (or Sprinter) is doing the acceleration?

Obviously it doesn't do it separately for each GCODE command line but takes a few code lines together. What are the criteria? When does it accelerate/decelerate and when not?

 

Share this post


Link to post
Share on other sites

I've been working on this the last week to get the time estimate of Cura improved (I'm down to 97% accuracy in the estimate)

Acceleration is planned over 16 moves maximum. What it does it tries to figure out at which speed it should take the intersections, which depends on the changes in speed at that intersection.

It's quite a bit of code, which has quite some details, it boils down to this:

https://github.com/Ultimaker/CuraEngine/blob/master/timeEstimate.cpp

 

Share this post


Link to post
Share on other sites

I've been working on this the last week to get the time estimate of Cura improved (I'm down to 97% accuracy in the estimate)

[...]

 

To have an accurate time estimate in Cura soon, it feels a bit like christmas... :smile:

 

Share this post


Link to post
Share on other sites

My quick summary. If "jerk" is zero then it's simple - every line segment would start from a stop, accelerate to max velocity, maintain that velocity as long as possible and then decelerate to 0 at the last possible moment so that it ends the segment with a deceleration ramp. But in practice it doesn't come to a complete stop at each segment so it's similar but starting at a particular velocity, ramping up, maintaining max speed (if it gets there) and then decelerating to be at the proper next vertex speed when it gets to that vertex.

The "jerk" setting is not zero. The jerk setting is not the official definition of jerk but similar. It sets the velocity at the vertexes where any two line segments come together - the idea is that for a circle of 20 line segments the change in angle is minor and you shouldn't have to come to a complete stop 20 times. So it calculates the "delta" velocity vector from one instant before the vertex to one instant afterwards and keeps that delta below the jerk value. So if jerk is 20mm/sec (default i think) and two vertexes are in a straight line you can go unlimited speed from one vertex to the next. If the vertexes are a 90 degree corner then the minimum speed at the vertex will be sqrt(2)*20 or 28mm/sec. The more gradual the change in direction the faster you are allowed to go. The worst case - 180 degree change in direction implies max speed at vertex at 10mm/sec.

Now you have to calculate all these max speeds 16 segments ahead and work backwards to "now" and figure out what your max speed is along the whole path.

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!