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

G00 command movement error on z axis for negative values #321

Closed
blurfl opened this issue Oct 21, 2017 · 8 comments
Closed

G00 command movement error on z axis for negative values #321

blurfl opened this issue Oct 21, 2017 · 8 comments
Labels

Comments

@blurfl
Copy link
Collaborator

blurfl commented Oct 21, 2017

I noticed in the z-axis panel that the raise and lower commands were not symmetrical - issue a 1mm raise followed by a 1mm lower and the router does not return to the spot is started from. This is easiest see when watching the motor coupler. It is also possible to see in the z calibration step of the calibration sequence - the 'move -0.1mm' button does very little except buzz.
Looking into GC, a G00 Zxx command is sent in these instances. I found that if I changed the G00 to G01, the z movement was correct. Further, the positive case (raise the bit) works correctly with G00 or G01. G00 Z-xx will move the motor by an incorrect amount in every instance.
A workaround in the short term would be to change the 'lower' commands in GC to send G01, but the issue is in the firmware handling of G00 on the Z axis.
I've looked around in CNC_Functions.h in the G1() function but haven't found joy. It looks to me like the resulting call to singleAxisMove(&zAxis, zgoto, zfeedrate) is the same whether G00 or G01 is used.
I've found that using the macros to issue the command strings is helpful.

these are symmetrical, change the 'G01 Z-0' to 'G00 Z-0' to see the issue occur
#move .1mm (converted to inches)
G20 G91 G01 Z-0.003937 G90
G20 G91 G01 Z0.003937 G90

#move .1mm
G21 G91 G01 Z-0.1 G90
G21 G91 G01 Z0.1 G90

#move 15 degrees converted to mm (3.175mm / 24)
G21 G91 G01 Z-0.132292 G90
G21 G91 G01 Z0.132292 G90

@blurfl blurfl added the bug label Oct 21, 2017
@blurfl
Copy link
Collaborator Author

blurfl commented Oct 21, 2017

I've found more information on this.
PR#315 includes a change that adds the zaxis to the coordinatedMove() in CNC_Functions.h. The function G1() calls coordinatedMove(). CoordinatedMove() is called for all three axes, with feedrate 1000 (a hardcoded value...) for a rapid move - G0 gcode. This seems to be a problem for the z axis in the negative direction, haven't looked for why. In the positive direction the z axis seems to work correctly. Changing the hard-coded value to 500 makes the z axis work correctly in the negative direction in the coordinatedMove() function.
@krkeegan, you've studied this section more deeply than I - can you think of a reason that the negtive direction of the z axis should behave this way? Should we consider adding a separate feed parameter to coordinatedMove() for the z-axis?
A temporary workaround could check for non-zero z axis movement just before the call to coordinatedMove() and set the feedrate to 500 if found.

@servant74
Copy link

servant74 commented Oct 22, 2017 via email

@blurfl
Copy link
Collaborator Author

blurfl commented Oct 22, 2017

That's the crux. In the G0, all three axes move at their maximum speed - that is why the path might not be straight. Before PR#315, the firmware would wait for a z-axis movement to complete before beginning the XY traverse. Now all three run simultaneously in a G1 or G0 command.
This works correctly in a G1 command, and in a G0 command if the z-axis movement is positive (raise), but a wrinkle is causing this issue when negative in a G0. Once the wrinkle is corrected, the z-axis will lower the correct amount while running a G0 command.

@krkeegan
Copy link
Collaborator

krkeegan commented Oct 22, 2017 via email

@blurfl
Copy link
Collaborator Author

blurfl commented Oct 22, 2017

Thanks for your insight, that's where I was beginning to suspect. I see the code section you describe, I'll dig around there.

@krkeegan
Copy link
Collaborator

krkeegan commented Oct 22, 2017 via email

@BarbourSmith
Copy link
Member

Do we feel good about closing this?

@blurfl
Copy link
Collaborator Author

blurfl commented Oct 26, 2017

Yes, 👍

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

No branches or pull requests

4 participants