Marlin Max Acceleration

Can someone explain to me how “acceleration” works in Marlin?

Anyone who’s taken phyiscs 101 knows that the units for acceleration are length / time^2. The comments in the configuration.h say that the units for default max acceleration are in mm/s. But they also note “(Maximum start speed for accelerated moves)”.

So is acceleration in Marlin different from the physical definition of acceleration? It’s just a start speed? If that’s the case why would the start speeds be higher than the default max feedrates?

/**

  • Default Max Feed Rate (mm/s)
  • Override with M203
  •                                  X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
    

*/
#define DEFAULT_MAX_FEEDRATE { 120, 120, 30, 25 }

/**

  • Default Max Acceleration (change/s) change = mm/s
  • (Maximum start speed for accelerated moves)
  • Override with M201
  •                                  X, Y, Z, E0 [, E1[, E2[, E3[, E4[, E5]]]]]
    

*/
#define DEFAULT_MAX_ACCELERATION { 400, 400, 100, 2000 }

https://github.com/Allted/Marlin/blob/MPCNC_Rambo_T8_16T_LCD/Marlin/Configuration.h

Acceleration is what you think. Not sure who wrote that comments but it makes no sense to me.

Jerk is the funny one, because instead of being the derivative of acceleration, it is a speed where the acceleration isn’t applied. So if your jerk is 1mm/s, it will go from 1mm/s to zero instantly.

1 Like

It’s pretty much right there. You’re giving it how much velocity to change per second. That’s why the units are in mm/s, because it’s the amount of change per sec.

Now, the whole “Maximum start speed for accelerated moves” is mind-boggling. Wait… Neuron firing…

If the tool head is already moving in the desired direction at MAX_ACCELERATION_SPEED, you can’t have an accelerated move. But if the length of its movement vector is currently less than the max, it can accelerate. So if it’s trying to reverse direction, it can “accelerate” in the opposite direction.

1 Like

Okay, so to make the units jive I assume it is DEFAULT_MAX_ACCELERATION (mm/s) / 1 (s).

MAX_ACCELERATION_SPEED, say what!? I’m assuming you mean max velocity at which to allow acceleration. But then that’s a totally different variable than max acceleration. Which is it? My head hurts…

I meant ‘DEFAULT_MAX_ACCELERATION’… :clown_face: They are one and the same. You can’t accelerate if you’re already moving as fast as your maximum acceleration. Personally, I think there was some organic code growth, and the meaning of the name got lost, but no one has the guts to dig into the code and make sense of it.

It also means the default max acceleration is 0-[full speed] instantly (or perhaps over the course of a second?)…

I’m not sure exactly what you’re trying to say. You can’t increase acceleration if you’re already moving as fast as your maximum velocity or if you’re already accelerating at max acceleration.

Its gotta be DEFAULT_MAX_ACCELERATION / 1 second.

Careful diving this deep can drive you nuts…I just got out of a few week rabbit hole a few days ago. Every year or so I get irritated at lack of explicit instructions for this stuff and just go for it. This year though I made even more progress than usual.

I am still not convinced Junction deviation is doing what is says completely…but we use very slow accelerations. a setting of .1 or .001 seem to have very little difference. The ballpark for this setting though is .4old jerkold jerk/acceleration…SO to set this you should be setting the classic stuff first tuning it then turning it off and using JD…odd, very odd. The double acceleration setting, yup odd. If you look in the actual marlin docs though some of it is defined better. If I actually felt like I understood any of it I would help out and make some doc pull requests but as it stand I am still very uncertain by most of them.