On 17 November 2017 at 21:14, chris <[email protected]> wrote:

> The idea is that you start you machine, home it , do some mill action or jog
> around and than when press the "home" bottom again, then pops out a window:
> "Axis is already homed, are you sure you want to re-homed?"
> if you then press "yes" the Machine do the home sequence again and tell you
> with a pop-window something like: " your home location now has a difference
> of 0.2xx from the last time of your home position"

I had a think about this, and came up with a userspace Python module to do this.

------------------------------------------------------
#!/usr/bin/python

import hal,time
import Tkinter
import tkMessageBox

root = Tkinter.Tk()
root.withdraw()

h=hal.component("home_logger")
old = {}
for a in ["x","y","z","a","b","c","u","v","w"]:
    name = "%s-axis-motor-offset"%a
    h.newpin(name, hal.HAL_FLOAT, hal.HAL_IN)
    old[name] = 0

h.ready()

try:
    while 1:
        time.sleep(5)
        for n in old:
if h[n] <> old[n]:
    tkMessageBox.showinfo("Home Position Change:", \
        "%s\nOld: %05f New: %05f Delta: %05f""" % (n, old[n], h[n],
h[n]-old[n]))
    old[n] = h[n]
    root.update()

except KeyboardInterrupt:
    raise SystemExit
------------------------------------------------------

That needs to be saved as "home_logger" somewhere that LinuxCNC can
find it (like /usr/local/bin) and made executable.

You can then add a HAL file to connect it.

------------------------------------------------------

loadusr -W home_logger
net h1 axis.0.motor-offset home_logger.x-axis-motor-offset
net h3 axis.1.motor-offset home_logger.y-axis-motor-offset
net h3 axis.2.motor-offset home_logger.z-axis-motor-offset

------------------------------------------------------

Now, this wasn't working for me. It seemed to work if I started the
component from the command line, but loadusr -W was never seeing the
component become ready (despite the h.ready() command) so I am hoping
that somone else can explain that bit.


-- 
atp
"A motorcycle is a bicycle with a pandemonium attachment and is
designed for the especial use of mechanical geniuses, daredevils and
lunatics."
— George Fitch, Atlanta Constitution Newspaper, 1916

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to