How does probing work?

Look here to see if your question has already been answered.
PNSNengineering
Posts: 6
Joined: Tue Jun 01, 2021 5:15 pm

Re: How does probing work?

Post by PNSNengineering » Fri Jun 04, 2021 9:11 pm

Thanks, that actually helped a lot. I knew about parameters (vaguely) but I didn't see any free parameters to use when glancing through the LinuxCNC documentation - although I could have missed it, a lot of that is foreign to me. But for example the Haas control has a range of numbers that are unused parameters that can be used by the programmer.

Anyways, the ability to change and set parameters I think solves my problem. Since the BB control doesn't currently have a display for the tool table and this will happen automatically I think it's easiest just to touch off at each tool change. Here's what I came up with - basically just store the Z height of the last tool touched off, then after the tool change compare it to the new height the tool touched off at. The difference is the amount the Z offset needs updated by. See code below - note that I have not tested this on machine yet, I've just been writing it as I learn more about the LinuxCNC parameters and gcode programming. Ill try to run it this weekend.

(CODE REDACTED - SEE CORRECTED VERSION IN BELOW POST)

This is just the tool change script, I'll also need to touch off once before the program starts (not to change any values, but just to set the #<_last_z> parameter for the next tool change. I'll probably also set up macros to touch off a tool whenever I want.

Side note - the Buildbotics control demo (https://demo.buildbotics.com/#control) has been really helpful with trial and error as I learn the gcode, and I don't have to be at the machine to run anything.
Last edited by PNSNengineering on Sun Jun 06, 2021 12:05 pm, edited 1 time in total.
--
Alex Pinson
IG: pnsn.engineering

PNSNengineering
Posts: 6
Joined: Tue Jun 01, 2021 5:15 pm

Re: How does probing work?

Post by PNSNengineering » Sun Jun 06, 2021 12:04 pm

Okay, here's what I've got (and it works!):

First I have to run this. I have it set up as a macro, so I put my probe in (which is just a 1/8" ground pin) and press the button to run this macro. This just sets the #<_last_z> parameter for the next tool changes, and then after that I use the probe tool to set XYZ offsets. Here's the macro:

M70 (save machine state)
G20 (set to imperial units)
G90 (absolute distance mode)

G53 G0 Z6.985 (move Z to highest height - CHANGE VALUE PER MACHINE)
G53 G0 X16.131 Y7.209 (move above touch probe - CHANGE VALUE PER MACHINE)

G91 (incremental distance mode)
F15.0 (slow-ish feed)
G38.2 Z-6.985 (move Z until probe makes contact - CHANGE VALUE PER MACHINE)
G0 Z0.05 (move Z up a bit)
F0.5 (sloooow feed)
G38.2 Z-.06 (move Z back down more slowly for fine touch)
#<_last_z> = #<_z> (store z height for next tool change)

G90 (absolute distance mode)
G53 G0 Z6.985 (move Z to highest height - CHANGE VALUE PER MACHINE)
M72 (recover saved state)

And then in the tool change section of the control I am running this code (I also found it helpful to set it up as a macro, minus the M0 M6 line). The only real difference between this and the code I posted earlier (which I am going to redact from that post so no one accidentally runs the wrong thing) is that I changed the order of the parameters in the #<_z> - #<_last_z> line and added G53 so that the moves to the probe location aren't relative to the current work offset but instead the machine's absolute coordinates. Here's that code:

M70 (save machine state)
G20 (set to imperial units)
G90 (absolute distance mode)

G53 G0 Z6.985 (move Z to highest height - CHANGE VALUE PER MACHINE)
G53 G0 X16.131 Y7.209 (move above touch probe - CHANGE VALUE PER MACHINE)
M0 M6 (MSG, Change tool)

G91 (incremental distance mode)
F5.0 (slow-ish feed)
G38.2 Z-6.985 (move Z until probe makes contact - CHANGE VALUE PER MACHINE)
G0 Z0.05 (move Z up a bit)
F1.0 (sloooow feed)
G38.2 Z-.06 (move Z back down more slowly for fine touch)
#<_adjust_by> = #<_z> - #<_last_z> (find difference between current location and last touch point)
#<_update_z> = #<_z> + #<_adjust_by> (find the new z value based on height difference)
G92 Z#<_update_z> (update the Z height)
#<_last_z> = #<_z> (store z height for next tool change)

G90 (absolute distance mode)
G53 G0 Z6.985 (move Z to highest height - CHANGE VALUE PER MACHINE)
M72 (recover saved state)

Hopefully that helps anyone else trying to solve the same issue in the future. I'll post if I make any significant edits or find any issues in the future, thanks for the help!
--
Alex Pinson
IG: pnsn.engineering

rtkracht
Posts: 8
Joined: Tue Mar 23, 2021 2:36 pm

Re: How does probing work?

Post by rtkracht » Mon Jun 07, 2021 9:43 am

Alex, thanks for the update.
R.T.Kracht
Huffman, TX

Post Reply