Probe outside of part to find center

More
17 Apr 2016 20:06 #73503 by BigJohnT
Anyone have a subroutine that finds the center of a part by probing the outside? I'm working on one but it is slow going lol.

JT

Please Log in or Create an account to join the conversation.

More
18 Apr 2016 10:59 - 18 Apr 2016 11:00 #73521 by Rick G
Morning John,

Not sure if this is the right version but as a starting point...
center_material
; RNG3 Feb. 20, 2012
; First Draft
; Goal to find the center of circular, rectangular and possibly eliciptical material on mill
; Concept only, work in progress, not tested, need to add slow probe, error exits, etc.
; modified from cornell3.ngc

; jog probe to roughly center and slightly above material to start

o<center_material> sub

#<Fastprobe> =  #1 (=10 Fast prb)
#<Slowprobe> =  #2 (=5 Slow prb)
#<Probedist> =  #3 (=.50 Prb dis)
#<Retract>   =  #4 (=.050 Prb ret)
#<Diam>      =  #5 (=.117 Prb Diam)
#<Probedepth>     =  #6 (=-.25 Prb depth)
#<Cycles>     =  #7 (=2 Cycles)
#<Xcorr>     =  #8 (=0.00 X cor) ;corection
#<Ycorr>     =  #9 (=0.00 Y cor) ;corection
#<Zcorr>     =  #10 (=0.00 Z cor) ;corection
#<Xmax>      =  #11 (=4.00 X Smax)
#<Ymax>      =  #12 (=2.00 Y Smax)
#<Xfin>      =  #13 (=0.00 X fin)
#<Yfin>      =  #14 (=0.00 Y fin)
#<Zfin>      =  #15 (=.125 Z fin)
#<Zsafe>     =  #16 (=.250 Z Safe)
#<Probepause> = #17 (=.05 pause)

G40 (Cancel cutter radius compensation) 
G49 (Cancel tool length offset) 

O110 WHILE [#7 gt 0]

G91 (Incremental mode)

;start of probe
;Find Z
G38.2 F#1 Z-#3

  ;;add on error G90 exit

G92 Z[0 + #10] (set Z to 0 plus correction)
G1 Z#16 (retract Z)

;Find left side of X 

;go to start probe position
G1 F#1 X[#11 * .75]
;lower Z
G90
G1 F#1 Z#6
G91
G38.2 F#1 X#11

;;add on error G90 exit

G92 X[0-[#5 / 2]] (set X to 0 - 1/2 of probe diameter)
G90
G0 Z #16 (Z to safe travel height)
G91

;Find right side of X

G1 F#1 X#11 (go to right side)
;lower Z
G90
G1 F#1 Z#6
G91
G38.2 F#1 X-#11

;;add on error G90 exit

;;;;;G92 X[#5221-[[#5 / 2] - #8]] (set X to location - 1/2 of probe diameter minus correction)

G90 
G0 Z #16 (Z to safe travel height)
G0 X[#5221-[[#5 / 2] + #8]] (go to X middle (- 1/2 of probe diameter plus correction))
G92 X0 (set middle of X at 0)
G91

;Go  down .75 of max Y

G1 F#1 Y-[#12 * .75]

;lower Z
G90
G1 F#1 Z#6
G91
G38.2 F#1 Y#12

;;add on error G90 exit

G92 Y[0-[#5 / 2]] (set Y to 0 - 1/2 of probe diameter)
G90
G0 Z #16 (Z to safe travel height)
G91

;find top of Y
G1 F#1 Y#12 (go to top)
;lower Z
G90
G1 F#1 Z#6
G91
G38.2 F#1 Y-#12 (probe top of Y)

G90 
G0 Z #16 (Z to safe travel height)
G0 Y[#5222-[[#5 / 2] + #8]] (go to Y middle (- 1/2 of probe diameter plus correction))
G92 Y0 (set middle of Y at 0)

;go to finish position
G0 Z#16
G0 X#13
G0 Y#14
G0 Z#15

#7=[#7 - 1]

O110 ENDWHILE

o<center_material> endsub
cornerll3.ngc finds the lower left corner of material, or vise.

Rick G
Last edit: 18 Apr 2016 11:00 by Rick G.

Please Log in or Create an account to join the conversation.

More
18 Apr 2016 11:53 - 18 Apr 2016 11:56 #73522 by BigJohnT
Thanks Rick,

I started a bit different and probed for the top of the material then managed to take one of Dewey's probe routine and next probe the right side. Ran out of time to get the left side done but should be copy and paste. Chris or Dewey has some neat things in his code that I used like making sure the sign was correct no matter what was entered into the box. I even had the practice tip on the probe and probed a 6" scale hanging off the side of the vise held in place with my finger lol.

Work in Progress and for sure not done but for your viewing pleasure:
; probe top of material
#<travel-speed> = 5
#<zmax> = 0.375
#<seek-speed> = 5
#<probe-speed> = 0.2
#<zoffset> = 0.2
#<zbackup> = 0.025
#<xcenter> = #5420
(debug, x center = #<xcenter>)

; get the sign right
#<zmax> = [0 - ABS[#<zmax>]]
#<zbackup> = ABS[#<zbackup>]
#<zoffset> = ABS[#<zoffset>]

;(debug,Press RESUME to begin)
M0
M110
G20                                      ; inch or mm
G91                                      ; incremental mode
G38.2 F#<seek-speed> Z#<zmax>        ; probe downwards
G90                                      ; absolute mode
G0 Z[#5063+#<zbackup>]                   ; backup
G91                                      ; incremental mode
G38.2 F#<probe-speed> Z[0 - #<zbackup>*2.0] ; probe slowly
G90                                      ; absolute mode
G0 Z[#5063+#<zoffset>]
;(debug,Probe tip is #<zoffset> above workpiece at #5063)
; find right side
(debug,Press RESUME to probe RIGHT side)
M0
M110
#<width> = 1.0
#<xmax> = 0.375
#<xoffset> = 0.2
#<xbackup> = 0.025
#<zdepth> = 0.30
G91
G1 X[ABS[#<width>/2]+ABS[#<xoffset>]] F#<travel-speed>
Z[0-#<zdepth>]
G38.2 F#<seek-speed> X[0-ABS[#<xmax>]]   ; probe left
G90
G1 X[#5061+#<xbackup>]                   ; backup
G91                                      ; incremental mode
G38.2 F#<probe-speed> X[0 - #<xbackup>*2.0] ; probe slowly
G90                                      ; absolute mode
G1 X[#5061+#<xoffset>] F#<travel-speed>
#<xplus> = #5061
G1 Z[#5063+#<zoffset>] 
G1 X#<xcenter>
(debug, xplus = #<xplus>)
M2

JT
Last edit: 18 Apr 2016 11:56 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
18 Apr 2016 12:11 #73524 by BigJohnT
So in my simple thinking it would go like this:
Probe top and move to safe height
Move to diameter + offset
Move down to probe height
Probe right side and record result as xplus
Move up and over and down
Probe left side and record the result as xminus
Subtract xminus from xplus and divide by 2 to get the offset from either.
Move up and over to xminus plus offset

JT

Please Log in or Create an account to join the conversation.

More
19 Apr 2016 12:15 #73586 by andypugh

Probe top and move to safe height
Move to diameter + offset


I wonder if you could:

Probe top to contact
slide left until no contact, then move ball diameter+ further.
move down ball diameter+ probe right.
move to starting XY probe down again, slide off the work to the right...

You do see ruby styluses being rubbed against parts in inspection machines.

Please Log in or Create an account to join the conversation.

More
19 Apr 2016 12:16 #73587 by andypugh
Of course, you could just use Verser's routines:
forum.linuxcnc.org/forum/49-basic-config...9187-work-with-probe

Please Log in or Create an account to join the conversation.

More
19 Apr 2016 13:41 #73595 by BigJohnT

Of course, you could just use Verser's routines:
forum.linuxcnc.org/forum/49-basic-config...9187-work-with-probe


I looked at that thread but never did find the files, I saw a bunch of patches but not the files to patch.

JT

Please Log in or Create an account to join the conversation.

More
19 Apr 2016 13:44 #73596 by BigJohnT
I did however get mine to work to my satisfaction.
; probe_x_dia.ngc
; probe top of material
#<travel> = 1
#<travel-speed> = 10
#<zmax> = 0.375
#<seek-speed> = 5
#<probe-speed> = 0.2
#<zoffset> = 0.250
#<zbackup> = 0.025
#<zdepth> = 0.300
#<xcenter> = #5420
#<xwidth> = 0.5625
#<xmax> = 0.375
#<xoffset> = 0.2
#<xbackup> = 0.025

; get the sign right
#<zmax> = [ABS[#<zmax>]]
#<zbackup> = ABS[#<zbackup>]
#<zoffset> = ABS[#<zoffset>]

(debug,Press RESUME to begin)
M0
G20                                      ; inch or mm
G91 ; incremental mode
G38.2 F#<seek-speed> Z[0-#<zmax>] ; probe downwards
G90 ; absolute mode
G#<travel> Z[#5063+#<zbackup>] F#<travel-speed> ; backup
G91 ; incremental mode
G38.2 F#<probe-speed> Z[0 - #<zbackup>*2.0] ; probe slowly
G90 ; absolute mode
G#<travel> Z[#5063+#<zoffset>] F#<travel-speed>
;(debug,Probe tip is #<zoffset> above workpiece at #5063)
; find right side
#<ztop> = #5063
(msg,Press Resume to probe RIGHT side)
M0

G91
G#<travel> X[ABS[#<xwidth>/2]+ABS[#<xoffset>]] F#<travel-speed>
G#<travel> Z[0-#<zdepth>]
G38.2 F#<seek-speed> X[0-ABS[#<xmax>]]   ; probe left
G90
G#<travel> X[#5061+#<xbackup>]                   ; backup
G91                                      ; incremental mode
G38.2 F#<probe-speed> X[0 - #<xbackup>*2.0] ; probe slowly
G90                                      ; absolute mode
G#<travel> X[#5061+#<xoffset>] F#<travel-speed>
#<xplus> = #5061
G#<travel> Z[#<ztop>+#<zoffset>] F#<travel-speed>
G#<travel> X#<xcenter> F#<travel-speed>
;(debug, xplus = #<xplus>)
(msg,Press Resume to probe LEFT side)
M0
G91  ; incremental mode
G#<travel> X[0-ABS[#<xwidth>/2]-ABS[#<xoffset>]] F#<travel-speed>
G#<travel> Z[0-#<zdepth>]
G38.2 F#<seek-speed> X[ABS[#<xmax>]]   ; probe right
G90 ; absolute mode
G#<travel> X[#5061-#<xbackup>]         ; backup
G91                                      ; incremental mode
G38.2 F#<probe-speed> X[#<xbackup>*2.0] ; probe slowly
G90                                      ; absolute mode
G#<travel> X[#5061-#<xoffset>] F#<travel-speed>
G#<travel> Z[#<ztop>+#<zoffset>] F#<travel-speed>
#<xminus> = #5061
#<xcenter> = [[#<xplus> + #<xminus>]/2]
G#<travel> X#<xcenter> F#<travel-speed>
M2
; probe_y_dia.ngc
; probe top of material
#<travel> = 1
#<travel-speed> = 10
#<zmax> = 0.375
#<seek-speed> = 5
#<probe-speed> = 0.2
#<zoffset> = 0.250
#<zbackup> = 0.025
#<zdepth> = 0.300
#<ycenter> = #5420
#<ywidth> = 0.5625
#<ymax> = 0.375
#<yoffset> = 0.2
#<ybackup> = 0.025

; get the sign right
#<zmax> = [ABS[#<zmax>]]
#<zbackup> = ABS[#<zbackup>]
#<zoffset> = ABS[#<zoffset>]

(debug,Press RESUME to begin)
M0
G20                                      ; inch or mm
G91 ; incremental mode
G38.2 F#<seek-speed> Z[0-#<zmax>] ; probe downwards
G90 ; absolute mode
G#<travel> Z[#5063+#<zbackup>] F#<travel-speed> ; backup
G91 ; incremental mode
G38.2 F#<probe-speed> Z[0 - #<zbackup>*2.0] ; probe slowly
G90 ; absolute mode
G#<travel> Z[#5063+#<zoffset>] F#<travel-speed>
;(debug,Probe tip is #<zoffset> above workpiece at #5063)
; find right side
#<ztop> = #5063
(msg,Press Resume to probe RIGHT side)
M0

G91
G#<travel> Y[ABS[#<ywidth>/2]+ABS[#<yoffset>]] F#<travel-speed>
G#<travel> Z[0-#<zdepth>]
G38.2 F#<seek-speed> Y[0-ABS[#<ymax>]]   ; probe left
G90
G#<travel> Y[#5061+#<ybackup>]                   ; backup
G91                                      ; incremental mode
G38.2 F#<probe-speed> Y[0 - #<ybackup>*2.0] ; probe slowly
G90                                      ; absolute mode
G#<travel> Y[#5061+#<yoffset>] F#<travel-speed>
#<yplus> = #5061
G#<travel> Z[#<ztop>+#<zoffset>] F#<travel-speed>
G#<travel> Y#<ycenter> F#<travel-speed>
;(debug, yplus = #<yplus>)
(msg,Press Resume to probe LEFT side)
M0
G91  ; incremental mode
G#<travel> Y[0-ABS[#<ywidth>/2]-ABS[#<yoffset>]] F#<travel-speed>
G#<travel> Z[0-#<zdepth>]
G38.2 F#<seek-speed> Y[ABS[#<ymax>]]   ; probe right
G90 ; absolute mode
G#<travel> Y[#5061-#<ybackup>]         ; backup
G91                                      ; incremental mode
G38.2 F#<probe-speed> Y[#<ybackup>*2.0] ; probe slowly
G90                                      ; absolute mode
G#<travel> Y[#5061-#<yoffset>] F#<travel-speed>
G#<travel> Z[#<ztop>+#<zoffset>] F#<travel-speed>
#<yminus> = #5061
#<ycenter> = [[#<yplus> + #<yminus>]/2]
G#<travel> Y#<ycenter> F#<travel-speed>
M2

JT

Please Log in or Create an account to join the conversation.

More
21 Apr 2016 10:25 #73681 by Rick G

making sure the sign was correct no matter what was entered into the box.


Good idea, especially when working with a probe.

Rick G

Please Log in or Create an account to join the conversation.

Time to create page: 0.080 seconds
Powered by Kunena Forum