On 3/12/24 13:49, gene heskett wrote:
On 3/11/24 12:31, andy pugh wrote:
On Mon, 11 Mar 2024 at 00:11, gene heskett <ghesk...@shentel.net> wrote:

Since no one has commented I updated to todays build, no help there.
lcnc refuses to move the machine by my code more than once per startup.

It sounds like the code leaves a parameter in a state that causes the
code to skip.

If it isn't error-ing then it is probably running to completion, but
not doing what you expect.

Try running through it in single-block mode.

I got tired of looking at all the screaming qt was doing trying to get my camera to work, so I commented it out.  Another and2 fixed the false atspeed indicator saying its at speed when stopped. But what I set for MIN_VELOCITY in the spindle_0 section of the ini has no effect. I still have to click the + button to start the spindle at about 105 revs.  So now its warmed up, I'll go play.

Cheers, Gene Heskett, CET.

More of the same, might be a little more stable w/o all the qt screaming.

It will Single Step to the end of the first hole while I fine tune some of the presets for the first hole, And as the center of x or y is found. I mam updating the 3 vars that the hole finder routine uses to recenter before starting the next measurement. But my run once per restart of linuxcnc continues. It will not restart the spindle on the 2nd try. This "first move" is in the o<z_check> sub. The s<_searck_revs> command is a few lines prior to the M4, works the first time every time, very occasionally works 2nd time.

When I know it should have spun up the spindle to around 1000 revs to find the linear rails top, the spindle hasn't turned and the atspd led is still red. No debug statements elsewhere in the code ever exec.
No response at all to the step button but the stop button works fine.
All indications are that atspeed is the culprit. I can debug the #<_search_revs> var, and it reads just fine. But an M4 on the mdi line does zip.

I sure could use a clue. Latest, probably messy code attached.

Thanks Andy. Take care & stay well.

Cheers, Gene Heskett, CET.
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author, 1940)
If we desire respect for the law, we must first make the law respectable.
 - Louis D. Brandeis
( linear_bearings.ngc, copyright 25 Feb 2024 by Maurice E Heskett, CET )
#<_measure>=1.00000000 ( zero to drill after changing fr probe to 3mm cutter )
#<_hole_spc> = 60.00000000 ( nominal space beteen holes drilled )
#<_xy_spd>      = 3
#<_z_spd>       = 15
#<_search_revs> = 1500 (in M4 reverse)

G17 G21 G40 G49 G54 G61.1 G80 G90 G94 ( setup to use xy arcs, metric, exact 
path)
( cancel diameter comp,cancel length off set, G54 coordinates system 1, )
( cancel any canned cycles, absolute distances, feed per minute mode )
( setup contact to ground to bearing, put probe in spindle with probe wire )

( NOTE Andy Pugh says this is a valid way to address an array: #[100 + #3] )
( but he didn't mention that debug was broken, so if we want to see it )
( to a global var, we must first copy the #<_gvar> = #[basenum+#50] )
( rather cumbersome proceedure )
(pre-alloocate the bounce vars for floats)
(allocate vars, 6 point holding tank)
#<_zx> = 0.00000000 (for z stuffs)
#<_zy> = 0.00000000 (for z stuffs)
#<_zz> = 0.00000000 (for z stuffs)
#<_xyx> = 0.00000000 (for hole stuff)
#<_xyy> = 0.00000000 (for hole stuff)
#<_xyz> = 0.00000000 (for hole stuff)
#50=0 ( set index to zeroth element  then set starting points )
#[200+#50] =  2.6       ( zeroth x location for z_check )
#[210+#50] =  2.1974    ( zeroth y location for z_check )
#[220+#50] =  -84 ( zeroth height to begin  z search )
#[230+#50] =  11.500( zeroth hole xy x location )
#[240+#50] =  1.8424 (zeroth holes xy y location )
#[250+#50] =  [-1.75 + #[220+#50]] ( to see if math works place xy probe 1.75mm 
into hole)
(debug, init_arrays done)

o<get_hole> sub
( now, copy all that to global vars )
#<_zx> = #[200+#50] (z_check x)
#<_zy> = #[210+#50] (z_check y)
#<_zz> = #[220+#50] (z_check z)
#<_xyx> = #[230+#50] (hole_check x)
#<_xyy> = #[240+#50] (hole_check y)
#<_xyz> = #[250+#50] (hole_check z)
( preset 3 vars for hole_finder)
#100    =       #<_xyx>
#101    =       #<_xyy>
#102    =       #<_xyz> 
o<get_hole> endsub

o<show_args> sub
(debug,lb sa 47 hole=#50)
(debug,lb sa 48 zx=#<_zx> #<_zy> #<_zz>)
(debug,lb sa 49 xyx=#<_xyx> #<_xyy> #<_xyz>)
(debug,lb sa 50 #100  #101  #102) 
o<show_args> endsub 

o<store_hole> sub
( uses hole arrays 230-240-250 but update all for this hole ) 
#[230+#50] = #100 (metric x return from hole_finder)
#[240+#50] = #101 (metric y return from tholefinder)
#[250+#50] = #102 (metric z return from latest g38.2 z-75)
o<store_hole> endsub

o<next_hole> sub ( last command of main loop )
( will make data for 9th hole but while will never use it)
( z_checks xyz locations for next hole )
#51                     =       [#50+1] ( make 51 into next member of array )
(first 3 for z_check)
#[200+#51]      =       [#[200+#50] + #<_hole_spc>] (add hole_spc to s_c's X 
for next hole)
#[210+#51]      =       #[210+#50] (propagate current z_c Y)
#[220+#51]      =       #[220+#50] (propagate current z_c Z)
( now do the same for next holes xy search)
#[230+#51]      =       [#[230+#50] + #<_hole_spc>] (increment xy X spot too)
#[240+#51]      =       #101 ( propagate found y to next hole)
#[250+#51]      =       #102 ( propagate found z to next hole)
o<next_hole> endsub

o<z_check> sub
s1000
(debug,z_c 80 spndl sp is s1000)
G1 F1500 z-70 (lift to clear traveler)
G1 f1500 x#<_zx> y#<_xyy> (goto location of z check)
G1 F1500 z[#<_zz> +1] (should be a mm above rail)
M4 (start spindle, backwards)
G4 P.3 (give revs time to get to speed)
G38.2 F10 z-87 ( locate top of rail for 1st time )
#102 = #5063 ( save real z in mm for hole finder )
(debug,lb z_c 86 Z=102=#102)
M5 (stop spindle)
o<z_check> endsub

o<hole_check> sub
(debug,lb hc 87)
G1 f1500 z-70  (clear traveler )
G1 f1500 x#100 y#101 ( position over next hole )
G1 f1500 z[#102 -1] (#102 has ben set, should place into hole counterbore)
o<hole_check> endsub

( call hole_finder in main loop )

o<hole_check2> sub
( #100, #101 s/b set by now )
(debug,lb hc2 105  #100  #101  #102 )
G1 f1500 z-70  (clear traveler )
G1 f1500 x#100 y#101 (re-position over this hole using found values) 
G1 f1500 z[#102 -5] (#102 has ben set, should place into small hole)
(ready for 2nd call to hole_finder2)
o<hole_check2> endsub

o<show_hole> sub
G1 f1500 z-70
G1 f1500 x#100 y#101
G1 f1500 z[#102 +3] ( should place above hole )
M4
G4 P10 (pause for inspection)
M5
o<show_hole> endsub

o<hole_finder> sub ( now runs twice in counterbore depth )
( no z motion now but #100, #101 now preset)
G1 F500 x#100 Y#101 ( better start pos from 1st pass )
s#<_search_revs>
(debug,HF 123 s/b just into current hole)
M4 (start spindle in reverse)
G4 p.25
(FIRST x search)
G38.2 F[#<_xy_spd>+3] X[#100-6] ( find left side, hole is 5.7mm )
G1 F1500 X#100 Y#101 (recenter)
#110=#5061 (record it)
G4 p.25
(2ND X search)
G38.2 F[#<_xy_spd>+3] X[#100+6] ( find right side, hole is 5.7mm )
G1 F1500 X#100 Y#101 (recenter current hole)
#111=#5061 (record it)
(find the center x)
#112=[[110+111]/2.0000]
#100=#112 (use this #100 for rest of this sub)
G1 F100 X#100 (center it)
g4 p.25
(find FIRST Y)
G38.2 F#<_xy_spd> Y[#101+6] (find back side)
G1 F1500 X#100 Y#101 (recenter current hole)
#112=#5062 (record back side)
G4 p.25
(find 2ND Y)
G38.2 F#<_xy_spd> Y[#101-6] (find front side)
#113 = #5062 (record front y)
(calc centers)
#105 = [[#110+#111]/2.0000000] (#105 is now center x)
#106 = [[#112+#113]/2.0000000] (#106 is now center y)
#100 = #105
#101 = #106
(debug,lb hf 151 X=#100 Y=#101)
G1 F1500 x#100 y#101 (put in found center, clear)
g4 p5 (pause for inspection)
(lets see if this is accurate enough to work for a 2nd pass deeper )
o<hole_finder> endsub

o<hole_finder2> sub
(no z motion now but s/b about 4mm deeper)
s#<_search_revs>
(debug,HF 154 s/b just into current hole)
M4 (start spindle in reverse)
G4 p.25
G38.2 F#<_xy_spd> X[#100-10] (find left side)
G1 F1500 X#100 Y#101 (recenter)
#110=#5061 (record it)
G4 p.25
G38.2 F#<_xy_spd> X[#100+10] (find right side)
G1 F1500 X#100 Y#101 (recenter current hole)
#111=#5061 (record it)
#105 = [[#110+#111]/2.000000] (#105 is now center x)
G1 F1000 X#105 (recenter x)
g4 p.25
G38.2 F#<_xy_spd> Y[#101+10] (find back side)
G1 F1500 X#105 Y#101 (recenter current hole)
#112=#5062 (record back side)
G4 p.25
G38.2 F#<_xy_spd> Y[#101-10] (find front side)
G1 F1500 X#105 Y#101 (recenter current hole)
#113 = #5062 (record front y)
(calc centers)
#105 = [[#110+#111]/2.000000] (#105 is now center x)
#106 = [[#112+#113]/2.000000] (#106 is now center y)
#100 = #105
#101 = #106
(debug,lb hf2 173 x=#100 Y=#101)
G1 F1500 x#100 y#101 (put in center, clear)
g4 p10 ( longer pause for inspection)
(lets see if this one is accurate enough to drill the holes )
o<hole_finder2> endsub

o<fixx> sub
( fix half the diff )
#49=[#50-1]
o15 if [#49 ge 0]
(sub found from prev hole+hole_spc)
#125 = [#100 - [#[230+#49]+#<_hole_spc>]]
(check math)
(debug,fixx 206 spc err=#125)
#<_hole_spc> = [#<_hole_spc> + #125/2]
(debug,fixx 208 NEW SPC=#<_hole_spc>)
o15 endif
o<fixx> endsub

o<summerize> sub
#40 = 0
o40 do
(debug, index=#40)
#180=#[200+#40]
#181=#[210+#40]
#182=#[220+#40]
(debug,sm 210 #180  #181  #182)
#180=#[230+#40]
#181=#[240+#40]
#182=#[250+#40]
(debug,sm 214 #180  #181  #182)
#40=[#40+1]
g4 p20 (give time to check results backplot not good, why?)
o40 while [#40 le 7]
o<summerize> endsub

(BEGINNING OF MAIN LOOP)
#50=0 (to start either loop below)
(o<init_arrays> call )(sets first element of each)
(debug,lb 224 index=#50)

o5 if [#<_measure> gt 0]

o1 do ( do while to find holes loop )
( MAIN LOOP )
o<get_hole> call (inits for both z and xy)
o<show_args> call (shows args for this hole)
o<z_check> call (finds a fresh z)
(debug,lb main 233 z_ch done Z=#102)
o<hole_check> call (positions for hole_finder)
#60=0 (first pass)
o<hole_finder> call ( finds ROUGH location of this hole )
#60=1 (2nd pass)
o<hole_finder> call ( using previous #100 & #101 as starters )
 
(o<hole_check2> call) (positions deeper in hole to measure hole, not 
counterbore)
(o<hole_finder2> call) 

(debug,lb main 245 X=100=#100) (metric?)
(debug,lb main 246 Y=101=#101) (metric?)

(o17 if[#50 gt 0])
(o<fixx> call)
(o17 endif)

o<store_hole> call (stores #100, #101 #102 in current arrays )
o<next_hole> call (sets up vars for next hole)

#50=[#50+1] ( make array addresses follow #50 for next pass thru loop )

o1 while[#50 le 7] ( stop short )
( End of MAIN WHILE LOOP )
o<summerize> call (end of data collection, display all findings)
o5 endif

(zero #<_measure> here to drill the holes)
#50=0
o16 if [#<_measure> lt 1]
G1 Z30 (raise enough for tool change)
M6 T2
o16 endif

(make tool setter here?)
( or just measure the diff and add it to the z move)
o7 do
o<get_hole>  call
o<show_args> call (see what its got)
o<show_hole> call (move to it)
(put drill hole code lines here)

#50     = [#50 +1] ( do next hole)
o7 while [#50 le 7]
(o6 endif)
M2
_______________________________________________
Emc-developers mailing list
Emc-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to