Probe for center of material

More
06 Mar 2012 08:46 #18421 by Rick G
Here is another untested concept that you may be able to modify for finding the center of your material with a probe and zeroing your machine there.
This is the long version with many pauses, comments and error checking to help debug.
Many moves are done with G91 Incremental mode, but on error or completion set back to G90 Absolute mode so the operator does not need to remember to do so.
You need to enter the rough size of the material, the search pattern will be slightly larger (each side 55% of the side length) you can edit the sub to it make it larger or smaller.
Set the depth you want Z to probe the sides at.
This should work on round, rectangle and possibly other symmetrical targets such as a bolt head or elliptical objects oriented with long and short axis parallel to X and y axis.
For rectangles it is assumed that the X and y axis of the material is parallel to the X and y axis of the machine.
To start edit the fields for what is appropriate for your target and machine.

It is assumed that some calibration will need to be done, when probing the machine cannot stop instantly, the probe must deflect some to send a signal, the probe may not be complete concentric.
Separate numbers can be entered for X, Y and Z.

To use.
Jog your machine to roughly the center of the target.

The process starts by finding the top of the material and setting that with G92 as Z0.
The probe will then lift to the safe travel height and travel to the left side (55% of the target size from the start point).

Z will then drop down to the probe depth.
X will search for the left side of the target at the high probe speed.
On contact X will back off the target and set up for the slow probe.
X will search for the left side of the target at the slow probe speed.
On contact the location will be saved to memory and the probe will be backed off.
Z will go to travel height.

X will go at travel speed to the other side of the target.
The above routine is duplicated on the right side.

The results are used to calculate the X center of the material.
Z will go to travel height.

X will go at travel speed to the X axis center of the target.
G92 is used to set the machine at X0.

The search routine is now duplicated for the Y axis.
The results are used to calculate the Y center of the material.
Z will go to travel height.

Y will go at travel speed to the Y axis center of the target.
G92 is used to set the machine at Y0.

The machine will then travel to the finish position normally X0 Y0.
This is repeated for the number of cycles entered.

Rick G

File Attachment:

File Name: center_material.ngc
File Size:9 KB
Attachments:
The following user(s) said Thank You: KobeYang

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

More
09 Nov 2014 04:35 #52972 by johns
Replied by johns on topic Probe for center of material
Found a minor syntax error with new 2.6.x LinuxCNC.

I went looking for ngcgui probe programs to replace the hand-written ones that I was using.

There are two instances of O110 - I replaced the "O110 WHILE [#7 gt 0]" and associated ENDWHILE with O90.

Other than that - thanks Rick!

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

More
10 Nov 2014 16:20 #52985 by Rick G
Replied by Rick G on topic Probe for center of material
Good catch on that.
Yes that is a very early version, I really need to post a more recent one.

Thanks,

Rick G

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

More
03 Jul 2015 19:34 #60380 by lerman
Replied by lerman on topic Probe for center of material
Hi Rick,

I just took a quick look, and have a question for you.

I notice that when you probe, your procedure is to move at a fast rate, make contact, back off, then go forward again at a slow rate. I wonder if that is the best procedure.

1 -- The probe touch point is detected at the servo rate -- say one millisecond. So if you are moving at 60 ipm (one inch per second), the touch point will be detected a millisecond after the touch. That corresponds to .001 inches. When I probe, I'm more concerned with overshoot and bending my probe, so I usually probe at 6 ipm.

2 -- When you back off, you get a probe release signal. That could be used instead of the touch signal.

Do you have any evidence that one way of doing things might be more accurate than another?

I'm using a cheap ($80) probe with my Bridgeport clone. Using the probe release coordinate, I'm getting repeatability of about .0002 (two tenths) of an inch when probing to find the center of a circle. (I probe the center, zero the coordinates, move off a few inches in X and Y. Then I go back to the center and probe again. It's rare that the new X and Y coordinates differ by more than .0002 from the original zero values.

I'd be interested in hearing other opinions about this.

Ken

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

More
05 Jul 2015 17:24 - 05 Jul 2015 17:29 #60435 by Rick G
Replied by Rick G on topic Probe for center of material

Do you have any evidence that one way of doing things might be more accurate than another?


I prefer to have the machine moving in the direction of the probe so any mechanical issues such as backlash are taken up.
The sub uses a fast probe speed which can be set at any speed the operator is comfortable with and a slow probe speed for precision.
The slow probe speed just takes too darn long to travel across a large hole.

You might also want to look at P-hole.ngc by Chris
%
G20 F25

#1000=4 ;max radius

G91 G38.3 Z.00001
#1001=#5061
#1002=#5062

G91 G38.2 X#1000
#1003=#5061
G90 G0 X#1001
G91 G38.2 X[0-#1000]
#1004=#5061
#1001=[[#1003+#1004]/2]
G90 G0 X#1001

G91 G38.2 Y#1000
#1005=#5062
G90 G0 Y#1002
G91 G38.2 Y[0-#1000]
#1006=#5062
#1002=[[#1005+#1006]/2]
G90 G0 Y#1002


G91 G38.2 X#1000
#1003=#5061
G90 G0 X#1001
G91 G38.2 X[0-#1000]
#1004=#5061
#1001=[[#1003+#1004]/2]
G90 G0 X#1001

G91 G38.2 Y#1000
#1005=#5062
G90 G0 Y#1002
G91 G38.2 Y[0-#1000]
#1006=#5062
#1002=[[#1005+#1006]/2]
G90 G0 Y#1002


F0.1

G90 G0 X[#1003-0.005]
G91 G38.2 X0.010
#1003=#5061
G90 G0 X[#1004+0.005]
G91 G38.2 X-0.010
#1004=#5061
#1001=[[#1003+#1004]/2]
G90 G0 X#1001

G90 G0 Y[#1005-0.005]
G91 G38.2 Y0.010
#1005=#5062
G90 G0 Y[#1006+0.005]
G91 G38.2 Y-0.010
#1006=#5062
#1002=[[#1005+#1006]/2]
G90 G0 Y#1002

#1007=[#1003-#1004+[6.0/25.4]]
#1008=[#1005-#1006+[6.0/25.4]]
#1009=[[#1007+#1008]/2]
#1010=[atan[#1002]/[#1001]]
#1011=[sqrt[[#1001*#1001]+[#1002*#1002]]]

(debug,Xdia #1007 Ydia #1008 Dia #1009 Ang #1010 Dist #1011)

%

Which can be modified for NGCGUI something like below...

I HAVE NOT TESTED BELOW AS I DO NOT HAVE A MACHINE WITH A PROBE HERE
;Based on Chris Radek's P-hole.ngc
;modified for NGCGUI
;g0 moves changed to g1
;jog probe to hole location, jog probe to z  depth inside hole
;finds center of hole and retracts Z when finished

o<probe_holeEXP> sub

#<Fastprobe> =  #1 (=10 Fast prb) ;speed for 1st probe at each location 
#<Slowprobe> =  #2 (=5 Slow prb)  ;speed for 2nd slow speed probe at each loacation 
#<Probedist> =  #3 (=.005 Prb dis) ;distance for slow probe 
#<Diam>      =  #4 (=.117 Prb Diam) 
#<Xcorr>     =  #5 (=0.00 X cor) ;X correction 
#<Ycorr>     =  #6 (=0.00 Y cor) ;Y correction 
#<Xmax>      =  #7 (=2.00 radius max) ;max radius hole size to probe 
#<TravelSpd>  = #8  (=20 Trvl Spd) ;speed to travel on non probe moves 
;;;
#<Zretract>  = #9 (=.125) ;distance to retract z when finished

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

G20 F#1
#1000= #7

G91 G38.3 F#1 Z.00001 (store org position)
#1001=#5061
#1002=#5062

;first search
G91 G38.2 F#1 X#1000 (find 1st x)
#1003=#5061 (store)
G90 G1 F#8 X#1001 (go back to org post)
G91 G38.2 F#1 X[0-#1000] (look for 2nd x)
#1004=#5061 (store)
#1001=[[#1003+#1004]/2] (calc center of x)
G90 G1 F#8 X#1001 (goto center of x)

G91 G38.2 F#1 Y#1000 (find 1st y)
#1005=#5062
G90 G1 F#8 Y#1002 (go back to org post)
G91 G38.2 F#1 Y[0-#1000] (look for 2nd y)
#1006=#5062
#1002=[[#1005+#1006]/2](calc center of y)
G90 G1 F#8 Y#1002 (goto center of y)

;repeat above in rough center
G91 G38.2 F#1 X#1000
#1003=#5061
G90 G1 F#8 X#1001
G91 G38.2 F#1 X[0-#1000]
#1004=#5061
;;;
#1004 = [#1004 + #5] (apply x correction)
#1001=[[#1003+#1004]/2]
G90 G1 F#8 X#1001

G91 G38.2 F#1 Y#1000
#1005=#5062
G90 G1 F#8 Y#1002
G91 G38.2 F#1 Y[0-#1000]
#1006=#5062
#1002=[[#1005+#1006]/2] (calculate center)
G90 G1 F#8 Y#1002 (goto center of y)

G90 G1 F#8 X[#1003-#3] (goto 1st x minus slow probe dist)
G91 G38.2 F#2 X[#3*2] (slow probe)
#1003=#5061
G90 G1 F#8 X[#1004+#3] (go to 2nd x minus slow probe dist)
G91 G38.2 F#2 X-[#3*2]
#1004=#5061
#1001=[[#1003+#1004]/2] (calculate center)
G90 G1 F#8 X#1001 (goto center of x)
G90 G1 F#8 Y[#1005-#3](goto 1st y minus slow probe dist)
G91 G38.2 F#2 Y[#3*2](slow probe)
#1005=#5062
G90 G1 F#8 Y[#1006+#3](go to 2nd y minus slow probe dist)
G91 G38.2 F#2 Y-[#3*2](slow probe)
#1006=#5062
#1002=[[#1005+#1006]/2](calculate center)
G90 G1 F#8 Y#1002 (goto center of y)
;;;
G91 G1 Z#9
G90

#1007=[[#1003-#1004]+[#4 + #5]]
#1008=[[#1005-#1006]+[#4 + #6]]
#1009=[[#1007+#1008]/2]
#1010=[atan[#1002]/[#1001]]
#1011=[sqrt[[#1001*#1001]+[#1002*#1002]]]

(debug,Xdia #1007 Ydia #1008 Dia #1009 Ang #1010 Dist #1011)

o<probe_hole4EXP> endsub

I prefer to have the error checking on all probe moves which is in the original posted sub and can be added to the above code.

Rick G
Last edit: 05 Jul 2015 17:29 by Rick G.

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

Time to create page: 0.117 seconds
Powered by Kunena Forum