G43.1 Dynamic Tool Length Measurement - Program Exceeds machine maximum on axis

More
15 Nov 2021 16:44 - 15 Nov 2021 21:55 #226589 by +Jan+
I have a small problem with dynamic tool length measurement with G43.1.
I call via remap a macro on this basis:


My adapted macro looks like this

o<messen_eng> sub
M64P10
#1700=1200            (Tool change X position)
#1701=0        (Tool change Y position)
#1702=-1        (Tool change Z position)

#1800=-100        (Position safe Z/Starting point for G38.2 move)
#1801=1279.125         (position probe X)
#1802=2498        (position probe Y)

#1900=#<_coord_system>    (Store coordinate system only G54 till G59)

o500 if [#<_current_tool> EQ #<_selected_tool>]
;(debug, Tool already in spindle)
o500 else 
M5
G54
G90 G0     

G53 Z#1702            (Go to tool change Z position)
G53 X#1700 Y#1701        (Go to tool change XY position)
M6 T#<_selected_tool>
#4999=#5400. (save actually loaded tool... for another macro)
G43.1 Z0            (TLO reset)
G53 X#1801 Y#1802       (Go to probe position)
G53 Z#1800            (Go to save Z position)


G91
G38.2 Z-197.5  F850        (probing fast)
G1    Z2.0  F150        (go up a bit)    
G38.2 Z-2.25  F25         (probing slow)
#2000=[#5063+#5223]     (Switching point+zero Offset)
#2001=[#2000-#2002+#2003](new - diff + old)  
#2002=[#2000]           (Save old switch point)
#2003=[#2001]            (Save old offset)     
G1 Z5.0 F500            (go up away from sensor)
G90 G0

G43.1 Z#2001            (TLO set)
G53 Z#1800         (Go to save Z position)
G53 Z#1702            (Go to tool change Z position)
#1803=1            (State tool already measured)

;(debug, Differenz ist: #2001)

(Restore old zero (only G54 to G59)    
o100 if[#1900 EQ 540]
G54
o100 endif
o101 if[#1900 EQ 550]
G55
o101 endif
o102 if[#1900 EQ 560]
G56
o102 endif
o103 if[#1900 EQ 570]
G57
o103 endif
o104 if[#1900 EQ 580]
G58
o104 endif

o500 endif

M65P10
o<messen_eng> endsub
M2


My Z axis has the following specification

[AXIS_Z]
MAX_VELOCITY = 100.0
MAX_ACCELERATION = 700.0
MIN_LIMIT = -300.0
MAX_LIMIT = 0.01

My workflow is as follows.

1. tool measurement via the macro above
2. define Z0 (for the tests I set it far away from machine limits)
3. start program

If I now start a program I get the message, "Program Exceeds machine maximum on axis Z.". As far as I could understand, the error occurs when the machine is moved to different Z heights in the program run.

For example, this code works here:

G21 (Units: Metric)
G40 G90
F1
M6 T9 ( Cutter, 6 mm)
G0 Z10
G0 X0 Y0
G01 Z10 F2000 (same height)
G01 X20 Y20
G01 X0 Y0
G0 Z10
M05 M30

This one as well:

G21 (Units: Metric)
G40 G90
F1
M6 T9 (Cutter, 6 mm)
G0 Z0
G0 X0 Y0
G01 Z0 F2000 (same height)
G01 X20 Y20
G01 X0 Y0
G0 Z0
M05 M30

This however not only with the above mentioned error message:

 

G21 (Units: Metric)
G40 G90
F1
M6 T9 (Cutter, 6 mm)
G0 Z0
G0 X0 Y0
G01 Z10 F2000 (different height)
G01 X20 Y20
G01 X0 Y0
G0 Z0
M05 M30


If I then click on "Run anyway", the program runs through to the end of the cycle without any problems. However, since I have to click the message away every time and thus cannot use my external hardware start button, I would like to solve the problem. Does anyone have a troubleshooting approach?

Best wishes

Jan
Attachments:
Last edit: 15 Nov 2021 21:55 by +Jan+.

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

More
16 Nov 2021 18:33 - 16 Nov 2021 18:33 #226670 by andypugh
I think that the problem here might be that probing always fails in the preview.
Judicious use of
O100 IF [#<_task> EQ 0]
    simulate probe
O100 ELSE
    actually probe
O100 ENDIF

Might fix the problem.
Last edit: 16 Nov 2021 18:33 by andypugh.

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

More
17 Nov 2021 14:26 - 17 Nov 2021 14:26 #226736 by +Jan+
I'm afraid that I'm not judicious enough to implement that accordingly ;-).
Can you please describe the workaround in more detail?

Thanks in advance

Jan
Last edit: 17 Nov 2021 14:26 by +Jan+.

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

More
17 Nov 2021 14:37 #226737 by andypugh
It's hard to know without context.

One thing to look at... What does your code do if the probe fails to find the sensor?

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

More
17 Nov 2021 14:45 #226739 by andypugh
Looking at the preview interpreter:
github.com/LinuxCNC/linuxcnc/blob/master...sai/saicanon.cc#L397
It looks like the tool point moves to 0.254mm short of the programmed probe end position, but does not set the "probe success" parameter flag.

The issue that you are seeing is likely to be that the calculated result in preview mode appears to be a very short tool, one with a tip somewhere inside the headstock.

Maybe just skip the whole probe routine if #<_task> EQ 0 ?

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

More
17 Nov 2021 14:47 #226740 by andypugh
The following user(s) said Thank You: +Jan+

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

More
17 Nov 2021 23:06 #226805 by +Jan+
I have now added an If query at the beginning of the tool length measurement as it is implemented for example at Gmoccapy:
o<messen_eng> sub

o100 if [#<_task> EQ 0]
(debug, Task is zero)
o100     return [999]
o100 endif

M64P10
#1700=1200            (Tool change X position)
#1701=0        (Tool change Y position)
#1702=-1        (Tool change Z position)

#1800=-100        (position sicheres Z)
#1801=1279.125         (position probe X)
#1802=2498        (position probe Y)

#1900=#<_coord_system>    (Store coordinate system only G54 till G59)

o500 if [#<_current_tool> EQ #<_selected_tool>]
;(debug, Tool already in spindle)
o500 else 
M5
G54
G90 G0     

G53 Z#1702            (Go to tool change Z position)
G53 X#1700 Y#1701        (Go to tool change XY position)
M6 T#<_selected_tool>
#4999=#5400
G43.1 Z0            (TLO reset)
G53 X#1801 Y#1802       (Go to probe position)
G53 Z#1800            (Go to save Z position)


G91
G38.2 Z-197.5  F850        (probing fast)
G1    Z2.0  F150        (go up a bit)    
G38.2 Z-2.25  F25         (probing slow)
#2000=[#5063+#5223]     (Switching point+zero Offset)
#2001=[#2000-#2002+#2003](new - diff + old)  
#2002=[#2000]           (Save old switch point)
#2003=[#2001]            (Save old offset)     
G1 Z5.0 F500            (go up away from sensor)
G90 G0

G43.1 Z#2001            (TLO set)
G53 Z#1800         (Go to save Z position)
G53 Z#1702            (Go to tool change Z position)
#1803=1            (State tool already measured)

;(debug, Differenz ist: #2001)

(Restore old zero (only G54 to G59)    
o200 if[#1900 EQ 540]
G54
o200 endif
o201 if[#1900 EQ 550]
G55
o201 endif
o202 if[#1900 EQ 560]
G56
o202 endif
o203 if[#1900 EQ 570]
G57
o203 endif
o204 if[#1900 EQ 580]
G58
o204 endif

o500 endif

M65P10
o<messen_eng> endsub
M2

Is this implemented correctly?
Unfortunately the problem persists and I don't get a debug message when refreshing the preview.

Best wishes

Jan

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

More
17 Nov 2021 23:53 #226809 by andypugh
I think that the o100 in front of the return is wrong.

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

More
18 Nov 2021 03:29 #226822 by JohnnyCNC
Last year I did a remap based on the same one you based yours on.  I used the the QTDragon GUI, 3DProbe, eBay tool setter, and TTS tooling. My remap handles both fixed length tools and variable length tools.  Variable length tools get automatically measured right after the tool change and fixed length tool use the length listed in the tool table.  I remember getting that error while working through my remap but I don't recall the exact cause.  You may find some clues by looking at my remap.  You can find it  posted here

John

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

More
18 Nov 2021 11:04 - 18 Nov 2021 14:58 #226853 by d2inventory
o100 if [#<_task> EQ 0]
(debug, Task is zero)
o<messen_eng> return
o100 endif


this is how you exit the subroutine.

btw, can you reproduce your error in a SIM config? I wasn't able to.

I managed to reproduce it and the above if clause fixed the issue as andy suggested.

Also if you're using a button type of touch probe you should debounce it, mine bounces for a few milliseconds so I used a 5ms debounce.

linuxcnc.org/docs/html/hal/rtcomps.html#_debounce
Last edit: 18 Nov 2021 14:58 by d2inventory.

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

Time to create page: 0.111 seconds
Powered by Kunena Forum