So, I have spent a lot of time trying to get the original code to work using gmoccapy. I have it working but with unexpected results.
When I home the machine, I get the message box which shows the value in X. Perfect.
I thought, great, now I can load some gcode, run it and see which axis is having problems.
When I move the gantry to set up the 0,0,0 points, the machine takes off on it's own. A miss_step message box
pops up with some random number.
I can't even stop the jog unless I hit the e stop.
I thought, maybe this is a compatibility issue with gmoccapy. Maybe not.
Here is my code:
miss_step file:
#!/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
---
Here is my custom_postgui.hal code:
# -- AndyPugh zero checker connections
#net check0 miss_step.axis.0.pos-cmd axis.x.pos-cmd
#net Xpos miss_step.axis.0.motor-pos-cmd
---
Here is the custom.hal code:
#loadusr -W /home/jeff/Desktop/Mauer-Mill/miss_step count=3
---
I not only cannot get this code to work without taking over the machine during jogs, but wonder if
there is a way to monitor the two Y joints? I don't have any idea how to do that. It is there that I
am having problems. X and Z are fine. I can't keep the two Y's on my gantry machine to stay in sync.
Thanks much