Probing in subroutine with quasi infinite loop
- LearningLinuxCNC
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 327
- Thank you received: 61
17 Feb 2018 14:21 #106074
by LearningLinuxCNC
Probing in subroutine with quasi infinite loop was created by LearningLinuxCNC
I have made a probing subroutine that will probe the outline of a part by probing in the x and y directions. This is the first subroutine that may be eventually adapted for probing all around a part to get coordinates for an outline.
The subroutine uses while loops to check the last probe location against limits in x and y. since the locations are dependent on the probe being tripped and getting a result the program starts as an infinite loop while loading it into LinuxCNC.
Does anyone have any ideas on how to make this work without going to increments and limits on the loop as a count. for loop structure.
The subroutine uses while loops to check the last probe location against limits in x and y. since the locations are dependent on the probe being tripped and getting a result the program starts as an infinite loop while loading it into LinuxCNC.
Does anyone have any ideas on how to make this work without going to increments and limits on the loop as a count. for loop structure.
( XY Outline Probing )
( )
( This program probes the outline of a part by first probing in the x )
( direction retracting in the x direction then moving in the y )
( direction then probing in the x direction again repeatedly until the )
( outline has been traced. it stores the x y coordinates of the )
( probed location to the file 'probe-results.ngc' in the same directory )
( as the .ini file )
( This program is adapted to our Touch Probe with a Normally Closed Contact)
(Configuration section)
G20 (inches)
F5 (Probe Speed)
#1=0 (X start)
#2=0.10 (X increment)
#3=10.0 (Maximum X value to move from origin)
#4=0 (Y start)
#5=0.10 (Y increment)
#6=10.2 (Maximum Y value to move from origin)
#7=-.1 (Z height for profile probing)
#8=-.2 (X retract distance)
#13=3 (Z clearance height)
(End configuration section)
(LOGOPEN,probe-results.ngc)
#9=0 (current X position)
#10=0 (current Y position)
G0X0Y0
G0Z#7
O1 while [#9 lt #3]
O2 while [#10 lt #6]
#11=[#10+#5]
(#11 is Y target move, Y position + Y offset)
G38.3 Y#11
O3 if [#5070 NE 0]
(probe tripped during y move so record location and set)
(parameters #9 and #10 equal to the current XY location.)
#9=#5061
#10=#5062
(write the XYZ coordinates to the logfile)
(LOG,#5061, #5062, #5063)
O3 else
(probe did not trip so probe in the X direction up to the limit)
G38.3 X#3
O4 if [#5070 NE 0]
(Probe tripped during X move)
(parameters #9 and #10 equal to the current XY location.)
#9=#5061
#10=#5062
(write the XYZ coordinates to the logfile)
(LOG,#5061, #5062, #5063)
(retract along the x axis by the retract distance)
#12=#10+#8
G1 X#12
O4 else
(probe did not trip during x move so the probing is complete)
O4 endif
O3 endif
O2 endwhile
O1 endwhile
(LOGCLOSE)
G0Z#13
G0X#1Y#4
M2
Please Log in or Create an account to join the conversation.
- LearningLinuxCNC
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 327
- Thank you received: 61
17 Feb 2018 14:37 #106075
by LearningLinuxCNC
Replied by LearningLinuxCNC on topic Probing in subroutine with quasi infinite loop
Nevermind, Right after I posted this I figured out my problem. I will post the final code once I have it working properly.
Please Log in or Create an account to join the conversation.
28 Feb 2018 17:11 #106723
by andypugh
Replied by andypugh on topic Probing in subroutine with quasi infinite loop
Your problem might be that the Axis preview doesn't like infinite loops.
There are two ways round this:
linuxcnc.org/docs/html/gui/axis.html#axis:preview-control
Or have different behaviour based on preview or live mode using the #<_task> named-parameter:
linuxcnc.org/docs/2.7/html/gcode/overvie...ub:system-parameters
There are two ways round this:
linuxcnc.org/docs/html/gui/axis.html#axis:preview-control
Or have different behaviour based on preview or live mode using the #<_task> named-parameter:
linuxcnc.org/docs/2.7/html/gcode/overvie...ub:system-parameters
Please Log in or Create an account to join the conversation.
Time to create page: 0.084 seconds