-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapt Jerk / Speed code from Prusa MK2 #4997
Adapt Jerk / Speed code from Prusa MK2 #4997
Conversation
…and apply const to some method parameters
I was excited what the changes inside buffer_line() means for execution speed so I did a quick and dirty comparison with and without this PR. The numbers are only for reference and not exact because the planner is interrupted by the ISR so it's more a sum of something. An average run with RCBugFix state takes 4308µs. I would call this significant, and if it also fixes some possible bugs, that's awsome! |
db20fc2
to
965e2ab
Compare
That does seem pretty significant. 308µs is about 4928 CPU cycles, or an average savings of ~12.3 cycles per invocation. When it comes to code in the planner, even 12.3 cycles can add up to a big difference. This PR makes some significant changes to the speed junction code, but nothing too crazy-looking. I noticed that the Prusa MK2 branch also features a pretty different-looking trapezoid generator, so that might be the next PR. I'm not sure if it's just older Marlin (1.0.x) code, or if it's actually a rewrite of that section. I haven't determined the MK2 branch starting-point, but once I do I can perform a side-by-side comparison and see where all the major changes are. |
965e2ab
to
faa7cca
Compare
faa7cca
to
4d89652
Compare
@clexpert @petrzjunior Do we like the MK2? |
I have re-written the trapezoidal generator in the Prusa3D branch of Marlin from floating point to fixed point. For the small bed size, the code shall produce exactly the same result with very significant CPU clock savings. I recommend for the official Marlin to use a conditional block to activate this fixed point planner as long as the intermediate results fit the 32bit integer. |
@thinkyhead Hi Scott, thank you for the question. I see that you have found my photo 😄 We have one Velleman K8200, one Velleman K8400 Vertex, a lot of Rebel 2 (Czech open source printer), and one Prusa i3 MK2. I am satisfied with the Prusa printer but I am frustrated from the latest heatbed 😃 |
@bubnikv Thanks for pointing that out. I've been looking forward to using the fixed-point code when possible. Can I assume that the current MK2 branch is the most up to date? |
@bubnikv One hazard to note. Since |
Wouldn't it be possible to limit G92 in a way that it cannot set positions outside of the actual bed positions? The only time where you would want to set a coordinate outside of the build volume would be if you're trying to "figure out" your printers limits I imagine. I would envision if you call a G92 with X, Y or Z values outside +AXIS_LENGTH>=value>=-AXIS_LENGTH it should simply not execute the command at all. Of course that wouldn't solve issues where someone actually needs exorbitant values (I'd love to see a printer with a 3.2 meter long build axis :D) |
G92 does not behave as intended with the software end stops indeed. The way This is not an issue for a normal user, as the usual slicers use the G92
IMHO no. The user shall have the freedom to shift the offset as she/he On Thu, Oct 20, 2016 at 9:49 AM, Florian Heilmann [email protected]
|
So the offset given by G92 is really a virtual value, which shall be added On Thu, Oct 20, 2016 at 10:04 AM, bubnikv . [email protected] wrote:
|
Correct. You can think of So, for example, suppose the current position is in the middle of the bed, X100 Y100, while the software endstops are X:0,200 Y:0,200. If you do In Marlin 1.1.x this is no longer the case. The The downside of this is, if you want to use In the code we now call the current position the "logical position." That's the position that includes offsets to the coordinate space as applied by either I will be auditing the code soon to find all the places where logical coordinates are converted to "raw coordinates" (the coordinate space without the offsets), and then attempt to sweep the code so that the Planner and Stepper classes always work within the raw coordinate space, and the offsets are applied (or unapplied) when converting back and forth. It probably should have been made that way in the first place. We're just at a point of organization where it should be fairly straightforward to accomplish. |
I see, so this has been fixed in Marlin 1.1. Very good, thanks. On Fri, Oct 21, 2016 at 3:26 AM, Scott Lahteine [email protected]
|
This PR adapts the of the speed limiting code from the Prusa i3 MK2 branch of Marlin. It purports to correct an issue where the Z axis could end up with its speed not properly limited.
Summary:
bool
flagsprevious_safe_speed
for testing whether the move is haltingconst
where it makes senseReferences: #4936, #4930, #4365