Add and enforce min_entry_speed_sqr#27089
Add and enforce min_entry_speed_sqr#27089thinkyhead merged 1 commit intoMarlinFirmware:bugfix-2.1.xfrom
Conversation
Remove nominal_length, add min_entry_speed_sqr, initial clean up of reverse_pass_kernel and forward_pass_kernel. Added min_entry_speed_sqr to avoid a specific potential source of judder due to working with discrete steps rather than continuous real-valued physics. The first step of any segment runs at initial_rate. If it is too low compared to acceleration_steps_per_s2 it will result in too much accumulated acceleration_time (see stepper.cpp) which will mean the following step will be at a much higher speed, and the speed change will significantly surpass the set acceleration_steps_per_s2 limit. Making sure we can match this limit is why we have minimum_planner_speed_sqr in the first place.
That is exactly why we have |
|
I think the work you're doing here is really impressive @mh-dm. I have often wondered whether the forward pass / reverse pass code could be improved. I have stayed away from it, though, because it hurts my brain to really fully understand it. Optimisations like You have convinced me that Now that I have really forced my brain to think through all of this, though, I believe the entire forward pass is redundant. Check out my branch https://github.com/tombrazier/Marlin/tree/noforwardpass which adds a variable The value I am storing in What do you think? |
Thank you!
Since you mentioned it: Similarly to
I need to unpack this. I looked your code and this is the most relevant bit:
What this is telling me is that your proposed pre-computed entry speed limit is either the junction limit or the speed achieved by full acceleration from the [previous junction limit or the speed limit achieved by full acceleration ... (and so on)]. This is definitely often true, and you have data that points that way. But is it true always? Trying to find a counterexample.. We'd need a segment that somehow ends up at an entry speed below the junction speed but then out of that would be a hard acceleration... Hmm.. Say everything gets planned for a hard acceleration ramp into a hard deceleration to I think what you're proposing would work if the planner was fully precomputing (like klipper) and not racing the stepper. Why didn't this show up in your testing? Multiple possible reasons:
Finally, if you look at #27035 the forward pass is half-removed as it was integrated into |
|
Oh you're right. That is a rare counter case to my idea. |
Description
Remove
nominal_length, addmin_entry_speed_sqr, initial clean up ofreverse_pass_kernel()andforward_pass_kernel().Added min_entry_speed_sqr to avoid a specific potential source of judder due to working with discrete steps rather than continuous real-valued physics. The first step of any segment runs at
initial_rate. If it is too low compared toacceleration_steps_per_s2it will result in too much accumulatedacceleration_time(see stepper.cpp) which will mean the following step will be at a much higher speed, and the speed change will significantly surpass the setacceleration_steps_per_s2limit.Making sure we can actually accelerate at around
acceleration_steps_per_s2is probably one reason for why we haveminimum_planner_speed_sqrin the first place. This change makes sure we follow that limit and keeps the second step under at most 2x theacceleration_steps_per_s2limit.Removed
nominal_lengthflag as acurrent->entry_speed_sqr == current->max_entry_speed_sqrcheck basically already tells us the same information. Done now to make it easier to reason about what the planner actually does. Slightly reduces the number ofmax_allowable_speed_sqr()calls as tiny benefit.Benefits
Pulled this commit out of #27035 to enable submitting PR #26881 that removes the hard
MINIMAL_STEP_RATElimit of 120. This 120 step rate limit acted like a kludge that prevented the worst kinds of acceleration spikes.Related Issues
This change was more fully tested only on top of #27013 so I think that PR should be submitted first. #27013 fixes nearly all acceleration spikes so it makes acceleration spikes easier to see.