Conversation
bug: cubic spline step is up to 2*BEZIER_MAX_STEP
|
AFAIKT your fix increases it to 4*BEZIER_MAX_STEP. Have you checked running code? |
I got this result by testing: with BEZIER_MAX_STEP set to 0.1, 10 interpolation points are expected over t=0.0...1.0, but only 5 were generated. relevant link is : https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.1.x/Marlin/src/module/planner_bezier.cpp#L159 |
|
where you see 4*BEZIER_MAX_STEP ? Do you got it by running code? |
|
BTW I like "interp(position.z, target.z, t)" in the Marlin. Not ideal but it is much better then no Z interp. |
According to the description how many steps to expect depends on the curve straightness. When I run the code with double precision math I get four segments, not five. And with your change I get five vs. ten. And to add to float impreciseness |
description: "MAX_STEP is taken at the first iteration." 4 steps sounds buggy as per "2*MAX_STEP" rule from description. In this case 5 steps is minimum, not 4. I haven’t checked the double version yet.. |
My while loop produces the same steps as the Marlin for loop, so the linked Marlin code has the same bug? Or is Marlin using a different float library that has produces slightly different results that affects the loop exit condition? |
Marlin code looks correct. (https://github.com/MarlinFirmware/Marlin/blob/bugfix-2.1.x/Marlin/src/module/planner_bezier.cpp#L159) is matches to the: actual grblHAL not matches Marlin: The difference between your while loop and Marlin’s is that in your case, one (wrong) iteration may pass when (new_t - t) is exactly equal to BEZIER_MAX_STEP. Sorry I didn’t try to clarify it from the start. I thought it was pretty obvious. |
bug: cubic spline step is up to 2*BEZIER_MAX_STEP