This seems to work.
Save this as a file called "miss_step" and make it executable.
Code:
#!/usr/bin/python
import hal, time
import sys
from Tkinter import *
import tkMessageBox
root = Tk()
root.withdraw()
h = hal.component("miss_step")
count = 1
for opt in sys.argv[1:]:
(dummy, count) = opt.split("=")
if dummy != "count":
count = 1
pins = []
for i in range(int(count)):
p1 = "axis.%i.pos-cmd" %i
p2 = "axis.%i.motor-pos-cmd" %i
d = 0
t = [p1, p2, d]
pins.append(t)
h.newpin(p1, hal.HAL_FLOAT, hal.HAL_IN)
h.newpin(p2, hal.HAL_FLOAT, hal.HAL_IN)
h.ready()
try:
flag = False
while 1:
time.sleep (1)
for t in pins:
if h[t[0]]-h[t[1]] != t[2]:
flag = True
t[2] = h[t[0]]-h[t[1]]
if flag == True:
flag = False
message = ""
for t in pins:
message = message + t[0] + " = %f\n"%t[2]
ret = tkMessageBox._show("Homing Position Differs",
message,
tkMessageBox.QUESTION, tkMessageBox.OK)
root.update()
except KeyboardInterrupt:
raise SystemExit
Then load it in the HAL file
Code:
loadusr miss_step count=3
Then in the HAL file connect the pins for each axis
Code:
net check0 miss_step.axis.0.pos-cmd axis.0.pos-cmd
net Xpos miss_step.axis.0.motor-pos-cmd
Or whatever signal axis.0.motor-pos-cmd is linked to