-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
[BUG] [bugfix-2.0.x] G02 mathematical bug in calculations #14745
Comments
I made a temporary workaround by adding + 0.00001f
It is resolve my example. |
@thinkyhead, what do you think of this issue? |
I found another error in the implementation of G2/G3.
This is a real good sample, I check it on Camotics Camo.zip . |
Regarding the last comment: According to DIN 66025 / ISO 6983 and beckhoff , According to sample 3 of the beckhoff reference, this should happen:
So it does not make sense to me that Marlin works with parameter |
In source code "parser.cpp" there are no implementation of processing of
|
The most obvious candidate for loss of precision is line 289 in G2_G3.cpp: h = SQRT(sq(r) - sq(d * 0.5f)), // Distance to the arc pivot-point to preserve precision this should be h = SQRT((r - d * 0.5f) * (r + d * 0.5f)), // Distance to the arc pivot-point |
The PR linked above should correct the workspace plane parameters issue. We'll check |
No, I checked it out yesterday on my CNC with the latest firmware, as well as on the old firmware (I checked this too) - it does not change the situation.
Yes, I checked it yesterday on my CNC with last firmware - now the CNC workspace plane works fine. |
New changes in version |
I've pointed out above two errors in the commits. Things were complicated by the fact that I had a week-old copy of the code when I made my comment and the code in the meantime had been refactored using struct.
shouldn't this be
h = SQRT((r - len * 0.5f) * (r + len * 0.5f));
I'm not sure what it does using d It looks illegal.
Also, I believe
const xy_pos_t s = { d.x, -d.y }; // Inverse slope of the perpendicular bisector
should be
const xy_pos_t s = { -d.y, d.x }; // move rotated 90 degrees
The above error was introduced in the refactoring #15204```
|
Here's a suggested rewrite of this code section:
I see one remaining problem. The code will crash with a floating point error if given an invalid G-code command with the radius less than half the distance to the destination point (geometrically impossible). How should that be handled? Ignore it? Do a G1 instead?
would fix it by replacing the impossible arc with a straight line, assuming the arc implementation can handle an infinite radius circle. I can work up a pull request if you prefer, as this is no longer a one-liner. I'm fighting git, but here's the diff:
|
Yes you are right!
Maybe insert check: |
Just now I saw that you have added the solution into your message. I made these changes to the firmware 2019-10-08:
|
I think I agree.... Replacing the impossible arc with a straight line probably makes sense. The extruder needs to be in the correct location at the end of the GCode command. But that raises another question... The Extruder Axis needs to be in the 'correct' location also. So what do we do? My vote would be to extrude nothing along the straight line just because we don't know that there is room to do that. Or worse... The Slicer might be moving the extruder back to that location to fill in material and if we extrude along the straight line (instead of the arc) we could be causing a problem. My suggestion is we artificially set the E-Axis to the 'correct' location at the end of the straight line move. |
I mis-stated what my impossible arc fix above does. If the diameter of the arc is less than the distance to the destination point, it makes a minimum-radius arc (i.e. a semi-circle.) between the points. |
I completely agree. |
OK. I created a pull request above. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Steps to Reproduce
Additional Information
Analyzing the differences, I came to the conclusion that here the arithmetic error of calculations with roundings in the AVR platform leads to the fact that the semicircle radius is smaller than the calculated diameter of the semicircle along the coordinates.
I do not program in C - therefore I cannot implement a check myself that would correct the situation.
All my configs.zip
The text was updated successfully, but these errors were encountered: