Been sort of pulling my hair out over the weekend trying to write a tool height probing routine, and then almost always ending up 2-3" off of my desired Z0 (Z DRO would read 2" instead of 0", for example when at the point that should have been zero after the change).
Are certain LinuxCNC parameters not available for use? For example #5323 would be helpful if I wanted to reference Z heights in G59 or another work offset from the usual G54 (so that setting XYZ0 on the part in G54 between two tool touches would not affect height differences in G59). If I use any of these besides the current relative coordinate parameters (e.g. #<_z> or #5422 work) they just return zero.
With that not working I went back to my original plan to see what was going wrong, and just changed how the program worked so that a probe on the part between tool changes wouldn't matter. I created a macro that did my tool change (since the control has a current bug with G53 causing over-travel errors) and just post my CAM tool by tool. So I do file 1, tool change macro, file 2, etc. The tool change macro takes the current tool, touches off, and then prompts to change to the next tool and touches it. Since it touches both in a row I can't throw it off by setting my Z work offset after I touch off the first tool. Then it calculates the difference between the Z heights of each tool, adds that difference to the current Z height, and does a
That still wasn't working and I wasn't sure why. Here's what I did:
Code: Select all
1. Touch off the part. I use the butt of an old 1/8" endmill as a probe and set XYZ0 for the part using the buttons on the control.
2. Run the first half of the tool change macro. Worth noting I did this line by line in the MDI so I could debug.
3. Once the tool touches the probe and pauses, note the height at which it touched. In this case the DRO said about -1.5" (so the probe top is about an inch and a half below the part top I touched off on).
4. Run the second half with the new tool, again line by line. Using the DEBUG, print out the difference in tool heights. Number seemed correct, about 1/8".
5. Calculate the new value the Z height needs to be updated to by adding the current Z height to the tool height difference
So here's what went wrong: for some reason #<_z> ALWAYS returns a positive number. Is this intended? This is kind of a problem for me, my tool probe will almost always be below the Z0 height. So in reality when #<_z> should return -1.4, it was returning just 1.4. Then when I set the new Z offset to be equal to current Z + tool difference, it would set the Z to 1.4 + 0.125 = 1.525, when in reality it should have been -1.4 + 0.125 = -1.275. This gives a difference of 2.8" between the two values which is why my offsets are off so much.
Is this intended functionality of these parameters? Am I doing something wrong? It would be really helpful to be able to access the offset locations in multiple WCS (G54-59, not just the current one) and even better if those didn't return an absolute value each time... (I'm on firmware 1.0.0)
Thanks for the help!