Lost Step Counter

More
11 Oct 2018 16:08 #118672 by DieselJoe
Lost Step Counter was created by DieselJoe
Hi,
I am a former LinuxCNC user, i turned myself to ESTLCAM recently , it is easy and can do great stuffs, but I now use hybrid steppers, and Estlcam struggle to send correct timing pulse to the motors.
So I am thinking to get back to LinuxCNC.

One of the key fonction (for me) of ESTLCAM is the Lost step counter, that really helped me setting my machine.

I would like to know if it is now available on LinuxCNC or easily programmable ?

The principle is simple:

At every homing, the computer compare the known position of the machine to the homing switches, and if it doesn't match, it means that some steps have been lost.


So it works for every type of machine, motors, and gives indication about health of the machine.

sincerely.

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

More
12 Oct 2018 12:18 #118701 by andypugh
Replied by andypugh on topic Lost Step Counter
Does this assume that the machine hasn't been moved since it was turned off?
(Often a safe assumption).

LinuxCNC can store the switch-off position in a txt file and re-use that at switch-on, so all that needs to be done is to compare the position offset before and after homing...

I think this could be done fairly easily in HAL. (but I would need to be in front of a LinuxCNC machine to experiment to see which pins to monitor).

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

More
12 Oct 2018 12:31 #118703 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
Hi,
What I'd like is:
1) home the machine
2) mill the project
3) home the machine
4) calculation of deviation between the 2 homings. I would tell how many mm lost during the milling.

I find it very useful in Estlcam.

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

More
12 Oct 2018 12:33 #118705 by andypugh
Replied by andypugh on topic Lost Step Counter
If you find it useful to know when you have lost steps then your machine probably has a problem. A properly configured machine shouldn't ever lose steps.

But I will have a poke around tonight to see if I can figure something out.

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

More
12 Oct 2018 12:37 #118707 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
Hi, yes in a perfect world everything is perfect... But not in my garage :-( .
Seriously it helps setting the proper speeds , acceleration, etc.
And this is how I discovered that estlcam doesn't properly use my hybrid steppers.
After 1 hour of milling, I lost 0.5mm

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

More
12 Oct 2018 12:39 #118710 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
It also help to diagnose the accuracy of limit switches.

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

More
12 Oct 2018 20:30 #118726 by andypugh
Replied by andypugh on topic Lost Step Counter
This seems to work.

Save this as a file called "miss_step" and make it executable.
#!/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
loadusr miss_step count=3
Then in the HAL file connect the pins for each axis
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

Attachments:
The following user(s) said Thank You: tommylight

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

More
12 Oct 2018 20:33 #118727 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
Thank you.
Incredible.
I am not familiar with add-ons modules on linuxcnc, but I will work on it this weekend

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

More
16 Oct 2018 16:34 #118889 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
Hi,
Sorry I'm newbie in Hal files.
I tried what you told me , and also i'am trying to read and understand documents on HAL files.
I made the miss_step file, made it executable (chmod -x right ?)
positioned the file in /.../linuxcnc/configs/ma-machine

then added in custom.hal :

loadusr miss_step count=3
net check0 miss_step.axis.0.pos-cmd axis.0.pos-cmd
net Xpos miss_step.axis.0.motor-pos-cmd

Is it the right procedure ?
I have a lot of errors and linuxcnc doesn't want to launch

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

More
16 Oct 2018 16:51 #118890 by andypugh
Replied by andypugh on topic Lost Step Counter
I think that the python file needs to go in usr/bin/linuxcnc
(or you can give the complete path to the file in the loadusr statement)

Can you attach the error listing?

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

Time to create page: 0.157 seconds
Powered by Kunena Forum