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

More
4 years 11 months ago #226930 by +Jan+
 
Hello to the round,
thank you very much for the hints. I have now set up the macro as follows:
Code:
o<messen_eng> sub o100 if [#<_task> EQ 0] (msg, Task is zero) o<messen_eng> return 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

Unfortunately the preview still doesn't work like this, although the If loop works (if I include a syntax error in the code below the If loop Linuxcnc doesn't complain).

I just tried the following for debugging:

- I measured the tool via the MDI: M6 T9
- Up to this point, no error is displayed in the preview.
- If I now set the Z zero point again (somewhere in the machine workspace) the error is displayed.
- If I now delete Z0 in the MDI via G43.1 Z0 and set the Z Origin somwhere in the workspace the error disappears.
- Even if I set the offset to G43.1 Z100 as a test, the error disappears after setting the Z zero point again. 
- Also a reduction of the remapping code as follows:

o<measure_eng> sub
o<measure_eng> endsub
M2

Does not have an affect on the error message.

To make this a bit more understandable I made a short screencast video to the above.



(watch on 720p, otherwise you wont be able to see it clear)

The problem is as far as I understand the value of the determined G43.1 offset. This is about -247 mm for the cutter used in the video.  Does anyone have an explanation for this?

Best regards

Jan
 

Please Log in to join the conversation.

More
4 years 11 months ago #226964 by nkp
By the way in version 2.7 it was not possible to reproduce the error.

Please Log in to join the conversation.

More
4 years 11 months ago #227025 by +Jan+
I made a few more attempts. If I comment out the remap m6 in the ini the problem does not occur, even if I manually set g43.1 z-247 and the zero point accordingly in the MDI.

If I start Linuxcnc with empty m6 remap file:
Code:
o<messen_eng> sub o<messen_eng> endsub M2

the problem occurs as soon as I set g43.1 z-247 via the MDI with the corresponding Z zero point.
The problem occurs only after a certain offset. g43.1 z-20 works fine, for example.

To be sure, I reproduced the above on a simulated machine (sim.axis/axis_mm.ini - I just configured the Z axis to Z max 0.1 and Z min -300 and enabled the m6 remap). Again, the error occurs (also with empty M6 remap file).

@ NKP
Did you test this with my Z Axis Config?
Z max 0.1
Z min -300

@d2inventory
Thanks also for the hint with the debouncing of the switches. I have built a switch with inductive proximity sensor. It should not need this, right?

Best wishes

Jan

Please Log in to join the conversation.

More
4 years 11 months ago #227033 by d2inventory
can you attach your sim config where you can reproduce the issue?

for debouncing, I don't know. do you have an oscilloscope to measure it?

Please Log in to join the conversation.

More
4 years 11 months ago #227034 by +Jan+
Hi,
enclosed you find a zip file.
It contains the remap file in the file path specified in the ini. Also the whole Axis Simulation Config folder. Please use the file "axis_mm.ini", which I have adapted according to my Z axis, m6 remap and the macro file path. Also I attach the NGC file which I used last for the tests.

Best regards and thanks in advance

Jan

 

Attachment not found

 

Attachment not found

Please Log in to join the conversation.

More
4 years 11 months ago #227198 by d2inventory
Ok, I can reliably reproduce the fault.Attached is the config I'm using. To get the debug messages you gotta run it from the terminal.linuxcnc path/to/config/tool-sensor-test.ini

You can trigger the tool touch probe on the right side panel (Probing is active when the feed rate is 5, aka slow :D )

If you start the config for the first time there are no linuxcnc.var and linuxcnc.var.bak files in the config directory. I think this is where the issue comes into play.
On this first start look at the program movement from the Y perspective and you will see it will exceed Z axis limit.
If you set the G54 origin (Nullpunkt) to -5 the program will fit into the machine.
Now you can measure the tool height with "T1 M6" in MDI and use the "Sensor Trigger" button to make a measurement. (Remember it probes twice, so click wait a second and click again ;-) )
After measurement you can play the program without warning message. If you check the Y-perspective again you can see it's at the bottom of the machine now.

Now go to G54 X0 Y0 Z5 and do a touch of again. This would set the G54 origin at machine X0Y0Z0 before any tool measurement and this makes the program run out of the machine boundaries. But the preview shows that the program is perfectly fine inside the machine boundaries.

Now I'm not sure how to get rid of this warning yet but I thought if you and I can reproduce the issue with the same setup we can find a solution soon :D

I am in the IRC channel if you want to have a quicker back and forth chat on how to fix this issue.

Please Log in to join the conversation.

More
4 years 11 months ago #227259 by d2inventory
Ok, I think I found the issue and a way to fix it.

This is the line that throws the warning:
github.com/LinuxCNC/linuxcnc/blob/master...cripts/axis.py#L1850

Both of those checks need to have the tool length offset added to them.

So from:
Code:
if o.canon.max_extents_notool[i] > machine_limit_max[i]:


to:
Code:
if o.canon.max_extents_notool[i] + (o.last_tool_offset[i] / 25.4) > machine_limit_max[i]:

But just dividing by 25.4 only works if the machine is in metric and the default LinuxCNC program is loaded. I still need to find the function for proper conversion so I can make a pull request. Maybe have a discussion if that is the right way to do it, but I can't see why not. The preview drawing accounts for TLO so why shouldn't this warning check do.

Anyway, you can try this fix in your own axis python script (you already edited that anyway for loggin, right?), gotta sleep now :P

Please Log in to join the conversation.

More
4 years 11 months ago #227324 by +Jan+
Hello,
first of all, thank you very much for working on my problem. Unfortunately, I have not yet had the time to reproduce your findings on the machine. I should be able to change the Axis file by that time... :-) For me it would be an acceptable workaround to comment out the error message completely, to solve it in a clever way would be great of course. If a real conflict with the machine limits occurs, the software aborts the cycle with further error messages after I click run anyway.

Best regards and thanks again.

Jan

Please Log in to join the conversation.

More
4 years 11 months ago #227810 by harry4516
this code, I think it was first created by Talla83, has a couple of issues and should not be used as it is.

The lines:
#2001=[#2000-#2002+#2003](new - diff + old)
#2002=[#2000] (Save old switch point)
#2003=[#2001] (Save old offset)

are just doing nothing. 2002 and 2003 always have the same value, and -#2002+#2003 = 0, so have no effect, which can be tested by debug output  (debug, var2002: #2002) ...

Maybe +Jan+'s problem is that this code leaves Z at a wrong value if it stops by error or if LinuxCNC is restarted. The result is, that Z may go over its limits.

When using this code you need to manually reference the Z null of your work piece after every error or restart of LinuxCNC. Then it will work as expected.

Please Log in to join the conversation.

More
4 years 11 months ago #227827 by d2inventory
Talla83's code shouldn't matter as you can reproduce this fault without it.

Just use G43.1 in MDI and it's easy to reproduce without a real tool change.

The issue is, as I pointed out, that the warning check in Axis (the GUI) doesn't take the tool length offset into consideration. So the Z-shift when using G43.1 Z-10.0 f.e. isn't taken into account when checking the boundaries.

If your program exceeded the Z-axis by 5mm and you use G43.1 Z-10.0 the program would fit by 5mm but the check still thinks it's 5mm above Z-max because the TLO isn't used in the bounds check. Maybe I'm just explaning it really bad, dunno :D

Please Log in to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum