Lost Step Counter

More
16 Oct 2018 17:18 #118892 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
Debug file information:
.
./custom.hal:3: Warning: File contains DOS-style line endings.
./custom.hal:4: Pin 'miss_step.axis.0.pos-cmd' does not exist
7165
PID TTY STAT TIME COMMAND
Stopping realtime threads
Unloading hal components

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

More
16 Oct 2018 19:52 #118898 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
I have to mention that I am running this test on a small laptop which is not my actual cnc PC, and has no real parallel port.
Linuxcnc version 2.7.8

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

More
17 Oct 2018 17:37 #118946 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
Hi I get nowher at this point. I spent 3 days on it...
I know a bit programing in C (arduino), but It's is to much to chew for me...
Python langage, HAL, linuxcnc structure ...
At this point I have a custom panel on the side of main screen.
I can display two interesting things:
for X axis for instance:

halui.axis.0.pos-commanded (which seems to reset to Zero when homing)
xpos-cmd (which seems to remain very absolute)

with this we can imagine a variable which make the difference and give the deviation
"deviation" = "X" - "absoluteX" - "previous deviation"
and a reset button to give to "previous deviation" variable the value of "deviation"

???!!!???? HELP

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

More
17 Oct 2018 19:19 #118950 by andypugh
Replied by andypugh on topic Lost Step Counter
Have you managed to get the file that I gave you to load as a HAL module?

It won't display anything until it is connected up in HAL.

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

More
17 Oct 2018 19:34 #118951 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
Hi,
I believe YES, I think a mistake in the copy/past in your post introduced a little mistake.
p1 = .......JOINT.pos-cmd right? (joint was missing)
now linuxCNC run, and I see this new pins in the HalMeter
nothing appears when I force a Home, and the halMeter remain at "0"
But I think it is an improvement yet :-)
I start understanding how it works... maybe...

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

More
17 Oct 2018 19:45 #118952 by andypugh
Replied by andypugh on topic Lost Step Counter
Do you have the HAL pins connected?

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

More
17 Oct 2018 19:49 #118953 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
Sh...t I forgot this.
I was so happy to succeed running linuxcnc eventualy.
I do it right now

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

More
17 Oct 2018 20:00 #118954 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
Now connected, I have your popup window working.
It show up asap I move the axis and just repeat the position.
Can you check the code and or the connection syntax?
But it's an improvement for my understanding of the system yet !
thank you
:-)

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

More
18 Oct 2018 10:28 - 18 Oct 2018 10:32 #118984 by DieselJoe
Replied by DieselJoe on topic Lost Step Counter
I think I made good progress during the last 12 hours...
I don't fully understand your code, but it was an inspiration.
I succeed making a code that seems to work.
Thank you a lot.
#!/usr/bin/python
import hal, time
h = hal.component("miss_step")

h.newpin("mot_off_x", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("joint_x", hal.HAL_FLOAT, hal.HAL_IN)
h.newpin("lost_x", hal.HAL_FLOAT, hal.HAL_OUT)
h.ready()





previous_offset_x = 0.00
try:
    while 1:
        time.sleep(1)
# make difference between previous offset and current offset, print the deviation if > 0.01
        if (h['mot_off_x']-previous_offset_x) >= 0.01 or (h['mot_off_x']-previous_offset_x) <= -0.01:
            h['lost_x'] = h['mot_off_x']-previous_offset_x
            previous_offset_x = h['mot_off_x']

# reset deviation display if joint has moved for more than 5mm
        if h['joint_x'] >= 5:
            h['lost_x'] = 0






except KeyboardInterrupt:
    raise SystemExit

and the connections:
net my-motoroffsetx miss_step.mot_off_x <= axis.0.motor-offset
net my-lost_x pyvcp.x-lostSteps <= miss_step.lost_x
net my-joint_x miss_step.joint_x <= axis.0.joint-pos-cmd
Last edit: 18 Oct 2018 10:32 by DieselJoe.

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

More
18 Oct 2018 11:24 #118987 by andypugh
Replied by andypugh on topic Lost Step Counter
I don't understand why my code didn't just work for you, it worked when I tested it.
Perhaps the problem was that it was working perfectly and you had no problems? My version only pops-up the message when the homing offsets change.

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

Time to create page: 0.088 seconds
Powered by Kunena Forum