en:software:mdurosettacncsoftwaregcode:probing

11. Probing

When this command is invoked the machine moves towards the target position along a straight line at the current feed (F).
The move stops, within machine accelerations limits, when the target position is reached, or when the requested change in the probe input takes place.
Target position is interpreted considering the active WCS if G53 is not specified in the same line.
After successful probing, parameters #5701-#5706 (and #5711-#5716) will be set to the program coordinates of X, Y, Z, A, B, C considering the active WCS.
Parameter 5700 is set to 1 or 0 depending on the probe state at the end of the motion.

There are 4 probing options:

  • G38.2: probe toward workpiece, stop on contact, signal error if failure
  • G38.3: probe toward workpiece, stop on contact
  • G38.4: probe away from workpiece, stop on loss of contact, signal error if failure
  • G38.5: probe away from workpiece, stop on loss of contact

There are some cases in which G38.x can raise a compilation error.

Error Description
E0044: cannot move rotary axes druing probing This occours when in the G38.x is defined a rotary axis with target position different than actual position.
E0047: cannot probe in inverse time feed mode This occours when is active G93 (enable feed per inverse of time).
E0048: cannot probe with cutter radius comp on This occours when a cutter radius compensation G40/G41.1/G42/G42.1 is active.
E0049: cannot probe with zero feed rate This occours when feed rate F is set to zero.
E0162: start point too close to probe point This occours when the delta interpolated movement from start point to probe point is lower 0.254mm (0.01in).
  • G38.2 and G38.4 trigger an alarm if the requested state change of the probe is not performed
  • G38.3 and G38.5 probe result can be checked using G-code control statements reading the parameter #5700
    • 1 : probing procedure succeed [ #<probe.state.succeed> ]
    • -1: probing procedure failed, sensor not tripped before reaching the target position [ #<probe.state.not_tripped> ]
    • -2: probing procedure failed, sensor already tripped before starting the procedure [ #<probe.state.already_tripped> ]
    • #0 or #<math.nan> : probing procedure is not executed, it was only compiled.
  • after a successful probing parameters:
    • #5701-#5706 are set to the probed position accordingly to the active WCS
    • #5711-#5716 are set to the probed position accordingly to machine coordinates.

This example shows how the macro “update_piece_position.ngc” is used to detect the Z position of a piece.

; (c) 2016-2019 by RosettaCNC Motion
; Arguments
; =========
; optional A : index of the WCS to be updated (1 -> G54, 2 -> G55, ...)
;
; System parameters: set in the correspondent parameters configuration tab.
; =========
; #6003: system parameter: Feed during procedure
; #6013: system parameter: Safe position Z
; #6021: system parameter: Feed fast approaching sensor
; #6022: system parameter: Feed slow approaching sensor
; #6023: system parameter: Approaching sensor target Z position (reached with fast feed #6021)
; #6024: system parameter: Sensor Z position (reached with slow feed #6022)
; #6035: system parameter: Sensor Z height
 
; Store actual the G code of the modal group 1: G0, G1, ...
#4101=#5101
; Store current target feed
#4130=#5130
; Store actual state M3, M4, M5
#4151=#5151
; Store actual state M7, M9
#4153=#5153
; Store actual state M8, M9
#4154=#5154
; Store current positions (X, Y, Z, A, B, C)
#4001=#5001
#4002=#5002
#4003=#5003
#4004=#5004
#4005=#5005
#4006=#5006
 
M109 P"Update piece position" Q4
 
; Uncomment the following code if one of the WCS should be updated
; IF [#1 EQ #0] THEN1
;    M109 P"Argument A should corresponds to a WCS index: 1 -> G54, 2 -> G55, ... " Q1
;    M2
; END1
 
IF [[#6003 EQ #0] OR [#6013 EQ #0] OR [#6021 EQ #0] OR [#6022 EQ #0] OR [#6023 EQ #0] OR [#6024 EQ #0] OR [#6035 EQ #0]] THEN10
    M109 P"One orm more compulsory system parameters are not specified."  Q1
    M2
END10
 
; Check if a G38.X is used. In that case convert to a G80 to prevent an error when setting G#4101
IF [[#5101 GE 38] AND [#5101 LT 39]] THEN10
	#4101 = 80
END10
 
; Disable spindle, flood & mist
M5 M9
 
F#6003
; Move upwards to a "safe position"
G53 G1 Z#6013
 
; Move the a position near the sensor "Approaching sensor target Z position"
G53 F#6021 G38.3 Z#6023
IF [#5700 EQ -2] THEN M109 P"Error updating piece position: Sensor already tripped!" Q1
; Sensor should not be tripped during the fast approach
IF [#5700 EQ 1] THEN M109 P"Error updating piece position: Sensor tripped during fast approach!" Q1
G53 F#6022 G38.3 Z#6024
IF [#5700 EQ -2] THEN M109 P"Error updating piece position: Sensor already tripped!" Q1
IF [#5700 NE 1] THEN M109 P"Error updating piece position: Sensor not tripped!" Q1
 
; Calculate the offset using the BCS position when the sensor was tripped #5173,
; the BCS position of the sensor and the length of the current tool.
#10 = [#5713 - #6035 - #5403]
; Update the G54, G55 or , ...
; Uncomment the following line if one of the WCS should be updated
; G10 L2 P#1 Z#10
; or use G52 or G92 offsets
G52 Z#10
 
F#6003
; Move upwards to a "safe position"
G53 G1 Z#6013
 
; Restore original target feed
F#4130
; Restore original G code (G0 or G1 or G2 or G3 or ...)
G#4101 ; or reset setting G80
 
; Restore previous states
IF [#4151 EQ 3] THEN M3
IF [#4151 EQ 4] THEN M4
IF [#4153 EQ 7] THEN M7
IF [#4154 EQ 8] THEN M8
 
M109 P"" Q4
M99

Usage example.

; (c) 2016-2019 by RosettaCNC Motion
G54 F1000
G0 X0 Y0 Z-20
 
G65 P"update_piece_position.ngc"
 
; Go to the origin of the WCS
G1 X0 Y0 Z10
 
M109 P"G52 offsets have been used. Program Z position is #5003 and Machine Z position depends on where the piece is placed."
M30
  • Last modified: 2023/03/22 09:07
  • by 127.0.0.1