3D Touch Probe: gSender macros

I’ve coded two macros for gSender (or CNCjs, based on @neilferreri published examples) that bisect the error from a G38.2 followed by a G38.4 probe cycle. With these (one for front/left and one back/left) I am seeing approx 0.03mm error, noting that the step resolution on the ShapeOKO 3XL is (1.8deg-step and 8 micro-steps on GT2/20T) 0.025mm.

Macro logic is: Probe G38.2 fast to locate edge, retreat a little, probe G38.2 slowly and note machine position on completion, probe ‘away’ G38.4 slowly and again note machine position. Halve the difference, adjust for the probe/puck size and probe tip diameter, set zero.

Unless or until Sienci incorporate PRB: capture into gSender, this is likely as good as it gets. I have made a feature request accordingly.

Files attached, hopefully self-explanatory. The key controlling ‘dimension variables’ are all at the top of the scripts, so you can tweak according to your preference.

gSender Macro Probe Scripts.zip (4.0 KB)

As is usual: Caveat Emptor…

1 Like

I was trying to determine the offset that would be needed for using the probe tip with the bitsetter, so i ran a modified version of the bitsetter tool change macro, having the machine stop after the last G38.4 command

I noted down the machine position after that macro ran. then i moved the spindle up & over to a probably touch probe probing location (just left of the bitsetter pin). I moved the endmill as close as possible to the aluminum shroud that acts as the floor of the nomad.

To do my best to verify my accuracy, I moved the endmill up by 0.1mm and I was barely able to slip the paper under the endmill. After moving the endmill back down by .08mm, the thickness of the paper, i was still above my set Z zero by .02mm, so i know my Z zero is set as accurately as i think is possible)

I noted the machine position after moving the endmill as described. Then taking those 2 values and subtracting them from each other, that should result in the height of the bitsetter when active, which should be approximately 23.86mm.

If anyone wants to run this test, run the same test and post your results.

In theory this value could be used to offset a tool length measurements taken off a probing point that has a known height, something like this:

this little probe point would be held in place with 3M adhesive, and the bitsetter pin would go through the hole, and the touch probe would touch off on the flat portion, just to the left.


modified bitsetter routine, to stop after bitsetter is no longer engaged, after the G38.4

;Bitsetter measure tool better

; Wait until the planner queue is empty
%wait

%global.state.SAFE_HEIGHT = -10          ; clear everything height(negative number, distance below Z limit)
; Set BitSetter probe location
%global.state.BITSETTER_X_LOCATION = -5  ; machine coordinates
%global.state.BITSETTER_Y_LOCATION = -3  ; machine coordinates
%global.state.BITSETTER_Z_LOCATION = -20 ; machine coordinates --> lower this (more negative) to start the probing closer to wasteboard

; Location for tool changes
%global.state.TOOLCHANGE_X = -125

%global.state.BITSETTER_PROBE_DISTANCE = 100
%global.state.BITSETTER_PROBE_FEEDRATE = 300 ; mm/min

; Wait until the planner queue is empty
%wait

; Keep a backup of current work position
%X0=posx, Y0=posy, Z0=posz

; Save modal state
%WCS = modal.wcs
%PLANE = modal.plane
%UNITS = modal.units
%DISTANCE = modal.distance
%FEEDRATE = modal.feedrate
%SPINDLE = modal.spindle
%COOLANT = modal.coolant

G21 ; metric
M5  ; Stop spindle
G90 ; Absolute positioning

; Get to a safe height and park for tool change
G53 G0 Z[global.state.SAFE_HEIGHT]
G53 X[global.state.TOOLCHANGE_X] Y[global.state.BITSETTER_Y_LOCATION]

; Pause for manual tool change & probing
%wait
M0 ; Please insert a tool

; Go to BitSetter
G53 X[global.state.BITSETTER_X_LOCATION] Y[global.state.BITSETTER_Y_LOCATION]
G53 Z[global.state.BITSETTER_Z_LOCATION]

%probe_start_z = posz

G91 ; Relative positioning

G38.2 z-[global.state.BITSETTER_PROBE_DISTANCE] F[global.state.BITSETTER_PROBE_FEEDRATE]; fast probe (so it doesn't take forever)
G0 z2
G38.2 z-5 F40 ; "dial-it-in" probes
G4 P.25
G38.4 z10 F20
G4 P.25
G38.2 z-2 F10
G4 P.25
G38.4 z10 F5 ; probe away from bitsetter and then stop
1 Like

I finished off the probesetter (all the credit to @HeuristicBishop for the name.) touch locations, now to put some double sided tape on them and put one in place, and see if my idea for the necessary macro will work to set tool length for the touch probe.





4 Likes

I tested my first version of what I am calling the Touch Probe Tool Change macro, and my order of operations went like so to test it, and it seems to have worked swimmingly.


PRE-MACRO SETUP

I first ran the modified bitsetter routine, to determine the activation height relative the the aluminum shroud/floor of the nomad. I then measured my ProbeSetter Pad’s height, and subtracted the two to get an appropriate offset. For me, that is noted as variable %probesetter_height_offset

This will probably be different on a machine to machine basis, and obviously on whatever type of pad one decides to come up with and the accuracy of how the machine it or make it.


FIRST TEST RUN

Step 1: Open gSender
Step 2: Insert Touch Probe
Step 3: Run Touch Probe Tool Change macro
Step 4: Set Z zero using Touch Probe (and set XY somewhere i wouldnt hit anything)
i set my Z zero at the height of my SMW soft jaw, just as a useful datum that i could jog over/to later

Step 5: Run BitSetter ToolChange macro [from @natewalck]
Step 6: Move tool back to XY zero, then manually jog back to work zero
(i used the goto once before and it went too low because i forgot a step, and nearly s**t myself)

During Step 6 i slowly jogged over to the SMW jaw, and 1mm at a time, jogged the new tool (actually a probing dowel for the bitzero) over the jaw, and the bottom of the dowel right up against the jaw. I had the ability to slide the jaw (with resistance) under the dowel, which indicates to me that its pretty damn close.

without an indicator of some sort im not sure of a more accurate method of verification.


Tentative Touch Probe Tool Change Macro [in reality this is @natewalck’s BitSetter Macro modified to adjust the X position for the ProbeSetter pad location, the tooltip to remind the user to plug in the cable for the touch probe, and the additional offset subtraction]

; measure touch probe length

; Wait until the planner queue is empty
%wait

%global.state.SAFE_HEIGHT = -10          ; clear everything height(negative number, distance below Z limit)
; Set BitSetter probe location
%global.state.PROBESETTER_X_LOCATION = -18.50  ; machine coordinates
%global.state.PROBESETTER_Y_LOCATION = -3  ; machine coordinates
%global.state.PROBESETTER_Z_LOCATION = -20 ; machine coordinates --> lower this (more negative) to start the probing closer to wasteboard

; Location for tool changes
%global.state.TOOLCHANGE_X = -125

%global.state.BITSETTER_PROBE_DISTANCE = 100
%global.state.BITSETTER_PROBE_FEEDRATE = 100 ; mm/min

; Wait until the planner queue is empty
%wait

; Keep a backup of current work position
%X0=posx, Y0=posy, Z0=posz

; Save modal state
%WCS = modal.wcs
%PLANE = modal.plane
%UNITS = modal.units
%DISTANCE = modal.distance
%FEEDRATE = modal.feedrate
%SPINDLE = modal.spindle
%COOLANT = modal.coolant

G21 ; metric
M5  ; Stop spindle
G90 ; Absolute positioning

; Get to a safe height and park for tool change
G53 G0 Z[global.state.SAFE_HEIGHT]
G53 X[global.state.TOOLCHANGE_X] Y[global.state.PROBESETTER_Y_LOCATION]

; Pause for manual tool change & probing
%wait
M0 ; Please insert touch probe and connect cable!

; Go to BitSetter
G53 X[global.state.PROBESETTER_X_LOCATION] Y[global.state.PROBESETTER_Y_LOCATION]
G53 Z[global.state.PROBESETTER_Z_LOCATION]

%probe_start_z = posz

G91 ; Relative positioning

G38.2 z-[global.state.BITSETTER_PROBE_DISTANCE] F[global.state.BITSETTER_PROBE_FEEDRATE]; fast probe (so it doesn't take forever)
G0 z2
G38.2 z-5 F40 ; "dial-it-in" probes
G4 P.25
G38.4 z10 F20
G4 P.25
G38.2 z-2 F10
G4 P.25
G38.4 z10 F5
G4 P.25

G90 ; Absolute positioning
%wait

; Get the Z position at the end of measuring tool length
; the probe_setter_height_offset will be different for each user or machine
%probesetter_height_offset = 14.51; mm height to subtract from tool length because probesetter is shorter than bitsetter activation height
%probe_end_z = posz
%probe_actual_distance = probe_start_z - probe_end_z
%probe_compensated_distance = probe_actual_distance - probesetter_height_offset ; subtract offset from actual length, because it will always be longer by offset.
(actual=[probe_actual_distance] compensated=[probe_compensated_distance])
%probe_actual_distance = probe_compensated_distance ; assign tempvariable we used for printing to console
%is_initial_tool = ! (global.state.PROBE_ACTUAL_DISTANCE > 0)

; Update Z offset for new tool
; note: do this in individual steps otherwise it sometimes treats some variables as strings (wtf??)
;     resulting in new_z=-31.0423.3225252

%delta_z = is_initial_tool ? 0 : probe_actual_distance*1.0 - global.state.PROBE_ACTUAL_DISTANCE*1.0
%new_z = posz*1.0 + delta_z*1.0
%new_z  =  Math.round(new_z * 1000) / 1000
(old=[global.state.PROBE_ACTUAL_DISTANCE] new=[probe_actual_distance] new_z=[new_z])

G10 L20 Z[new_z]

%global.state.PROBE_ACTUAL_DISTANCE = probe_actual_distance

%wait

G91 ; Relative positioning
G0 Z5
G90 ; Absolute positioning
G53 Z[global.state.SAFE_HEIGHT] ; Move in machine coordinates to safe height
%wait
; go back to tool change location to begin toolpath again
G53 X[global.state.TOOLCHANGE_X] Y[global.state.PROBESETTER_Y_LOCATION]

; Restore modal state
[PLANE] [UNITS] [DISTANCE] [FEEDRATE] [SPINDLE] [COOLANT]
3 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.