Skip to content
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

Correct angle calculation #477

Merged

Conversation

blurfl
Copy link
Collaborator

@blurfl blurfl commented Nov 5, 2018

This PR addresses Issue #476: "Motion:arc() bug - G2 gcode cuts counterclockwise instead of clockwise"

The variable theta used in the incremental motion calculation is defined to contain the value direction indicated by G2/G3. This PR removes a second reference to direction in that calculation to correct the issue that arises when a negative direction multiplied twice (G2 instance) cancels the direction. The effect was that G2 gcodes cut in the positive direction (as G3 does) instead of the correct direction.

Here is a cut that demonstrates the error and the fix. It should run a 1" counterclockwise circle (G3) to the right of home, with Z beginning at 0 and ending at 0.5, then a clockwise circle (G2) to the left of home with Z finishing at 0. Without the patch, the G2 circle runs counterclockwise.

G20 G90
G0 X0 Y0 Z0
G3 X.0 Y0.001 Z-0.5 I1.0 J0.0 F100
G0 X0 Y0
G2 X.0 Y0.001 Z0.0 I-1.0 J0.0 F100
G0 X0 Y0
M2

The variable theta is defined to contain the direction.
@MaslowCommunityGardenRobot
Copy link
Collaborator

Congratulations on the pull request @blurfl

Now we need to decide as a community if we want to integrate these changes. You should vote by giving this comment a thumbs up or a thumbs down. Votes are counted in 48 hours. Ties will not be merged.

I'm just a robot, but I love to see people contributing so I'm going vote thumbs up (but my vote won't count...)!

@BarbourSmith
Copy link
Member

Way to fix that quickly!! Awesome. 👍👍

@blurfl
Copy link
Collaborator Author

blurfl commented Nov 7, 2018

I introduced a pretty major flaw in the previous release - G2 gcodes will spoil a user's expensive material.
This PR corrects that, and looks likely to merge.
Is there a way to avoid 30 days of damage before the next release?

@BarbourSmith
Copy link
Member

I think we could do an early release no problem. Should I just merge this right away and we could do a release today? We could also wait a few days if we want more time for testing.

@blurfl
Copy link
Collaborator Author

blurfl commented Nov 7, 2018

The user who identified the issue says he will test it this week. Let’s wait to hear from him.

@MaslowCommunityGardenRobot
Copy link
Collaborator

Time is up and we're ready to merge this pull request. Great work!

@MaslowCommunityGardenRobot MaslowCommunityGardenRobot merged commit d0943e2 into MaslowCNC:master Nov 7, 2018
@BarbourSmith
Copy link
Member

I just realized that I only increased the merge time to one week for Ground Control and the firmware is still 48hrs. Do we want one week on both or does 48hrs seem like enough time?

@servant74
Copy link

servant74 commented Nov 7, 2018 via email

@davidelang
Copy link
Contributor

davidelang commented Nov 8, 2018 via email

@blurfl
Copy link
Collaborator Author

blurfl commented Nov 8, 2018

The reason for the delay is to have more people test and report. Two weeks would be my vote, but one week is better than 48 hours.
--- Did anyone besides me test this PR? ---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants