Backlash issues

Forum for Discussing Mach3/4 related issues

Re: Backlash issues

Postby BattleFluffy » Wed Aug 14, 2024 6:27 pm

CT63, all mechanical systems are subject to some amount of backlash. We obviously do as much as possible to reduce it via physical means, but getting the last 0.05mm can be tricky.

While we all wait for a solution from CNCdrive, I have something that might help. I have written some code in Lua that takes in a gcode file as input, then outputs that file with appropriate compensation moves added.
I've tested it extensively, including on a live machine, and it seems to work nice. Use at your own risk ofc :>

Code is here:
https://pastebin.com/y5ryM1rw

To run the code you'll need to install Lua for Windows:
https://github.com/rjpcomputing/luaforwindows/releases

Using a text editor, create a file called compensate.lua and paste this code inside.
Measure your machine's backlash in X, then set "backlash" on line 4 of the code.

Put your input.tap file in the same folder.

Open a command prompt (windows key + R, then type cmd)
Navigate to the folder with the files. Then run the compensation procedure by typing:

lua compensate.lua > output.tap


When you run the resulting file, to ensure correctness, start the program with your spindle at or very close to the origin, and the most recent move in X was to the right, ie positive. This is so that the backlash starts in a known place.


The code supports G0, G1, G2 and G3.
G2 and G3 can be specified either with the "R" parameter, or the "I" and "J" parameters.

Any other commands will simply be copied to the output without modification.
It doesn't currently support multiple work offsets, rotating or translating the work offset, any of the canned cycles etc.

I used the following suite of automated tests during development to ensure correct output:
https://pastebin.com/LHqXD21s

I also prepared a gcode file with all different possible configurations of arcs to ensure they all work correctly:
Image

Any questions please ask. I hope this helps someone. :>
BattleFluffy
 
Posts: 7
Joined: Thu Jul 18, 2024 11:15 pm

Re: Backlash issues

Postby BattleFluffy » Sat Sep 07, 2024 6:16 am

cncdrive wrote:I think it is a bug in our Mach4 plugin, but the issue is when you guys asked about the issue then the Mach4 API was changed so much that we needed to reinstall new development tools and figure out the changes, my collegues stucked with it and it took lots and lots of time, so we finally did not figure it out.
My collegue promised that he will give it another go later to see if he can figure it out this time.
You could try UCCNC though, it can do the same things as Mach3/4.


Hello, did you make any progress with fixing this issue?
BattleFluffy
 
Posts: 7
Joined: Thu Jul 18, 2024 11:15 pm

Previous

Return to Mach3/4 Discussions

Who is online

Users browsing this forum: No registered users and 2 guests