Avoid ProbeCrash

More
30 Oct 2020 18:08 - 30 Oct 2020 22:07 #187813 by MaHa
Avoid ProbeCrash was created by MaHa
Times ago, I made another attempt to protect the probe against crash. Even forgot it's there... This Userspace Python Component, from mymachine.hal: 'loadusr -W protprob'
and submit T-number of Probe: 'setp protprob.prob 999'
The File is placed in $PATH (without '.py')
Without Probe loaded, poll interval is about 5 seconds. If probe in spindle, poll at max interval.
#!/usr/bin/python

import hal
import sys
import linuxcnc
import time

s = linuxcnc.stat()
c = linuxcnc.command()
h = hal.component("protprob")
h.newpin ("prob", hal.HAL_S32, hal.HAL_IN)
oldprob = 0
oldtrig = 0
h.ready()
try:
    while 1:
        s.poll()
        if s.tool_in_spindle == h['prob']:
            time.sleep(0)
            if s.probing == 1:
                oldprob = 1
            if s.probe_val == 1 and oldprob == 0:
                c.abort()
            elif s.probe_val == 1 and oldprob == 1:
                oldtrig = 1
            elif s.probe_val == 0 and oldtrig == 1:
                oldprob = 0
                oldtrig = 0
        else:
            time.sleep(5)
except KeyboardInterrupt:
	raise SystemExit
	

# ****************************************************
# in file:  mymachine.hal
# loadusr -W protprob
# setp protprob.prob 999
# File be placed in $PATH , eg. /usr/xxx/
# echo $PATH will display the current PATH settings
# Berechtigungen: Root: Lesen und Schreiben / yourname: Nur Lesen / Nur Lesen

EDIT:
What a shame...I replaced my computer this summer and moved only the user directory, and the file from my archive was outdated, unfinished. Now i fixed everything and replaced the file here with the current version.
Attachments:
Last edit: 30 Oct 2020 22:07 by MaHa.
The following user(s) said Thank You: Aciera

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

More
04 Nov 2020 22:55 - 05 Nov 2020 18:47 #188349 by MaHa
Replied by MaHa on topic Avoid ProbeCrash
Until the problem with not recognizing probe deflection while moving without G38.n is solved, i continue use this.
When i checked the load of the PC with 'top' , i was wondering about the high cpu load reached from this component.



When the probe is not loaded, the sleep timer of about 5 seconds is no problem, but time.sleep(0) when probe in spindle, is not a good idea. So i tested some other values.



I set the probe contact point on my calibration ring to X zero, and in the ngc file a movement G1 X-0.5 F500. In worst case, this 0.5mm won't hurt the probe.
In my probing routines feed is set to F100 for probing, travelling around F500. That's why i tested only this.

time.sleep(0.001) F500 stoped finally between X-0.262 and X-0.3
time.sleep(0.0005) F500 stoped between X-0.35 and X-0.358
time.sleep(0.00001) F500 stoped always at X-0.35.

Always a cpu load from 0.3% to 2% reached.

time.sleep(0) only produced a very high cpu load, and stop was also at X-0.35
So I will use time.sleep(0.001), which produces average 0.3 %
I can live with stoping within 0.35mm, as the possible deflection of my probe is larger.

Edit:
Doing the same in MDI mode, testing the built in behaviour, also G1 X-0.5 F500.
It stoped at X-0.14 to X-0.15mm.
Attachments:
Last edit: 05 Nov 2020 18:47 by MaHa.

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

Time to create page: 0.112 seconds
Powered by Kunena Forum