I have a 4th axis with brake on my mill. I want to set it up like a locking indexer, where the brake is on whenever the axis is stopped. But I also want to be able to jog the axis and (ideally) use it for coordinated moves also. So, I can't just use the built-in locking_indexer functionality (which only allows G0 moves).
I have it set up using a wcomp to check if the commanded velocity for the axis is non-zero, and that controls the brake. It all works great except that I am losing a few steps during the fraction of a second it takes for the brake to disengage. How can I delay sending steps to the axis until after the brake disengages?
Here's the relevant section of my hal file:
Code:
### handle 4th axis brake ###
loadrt wcomp names=wcomp_vzero
loadrt not names=not_vzero
loadrt timedelay names=timedelay_brake,timedelay_brake_movement
addf wcomp_vzero servo-thread
addf not_vzero servo-thread
addf timedelay_brake servo-thread
# wcomp output is true when input between min and max, false otherwise
setp wcomp_vzero.min -0.0001
setp wcomp_vzero.max 0.0001
setp timedelay_brake.on-delay 1.0
setp timedelay_brake.off-delay 0.0
net a-vel-cmd => wcomp_vzero.in
# drive is wired so that brake is on when switch is off
# so need to invert logic
net A_stopped wcomp_vzero.out => timedelay_brake.in
net A_brake_on timedelay_brake.out => not_vzero.in
net A_brake_off not_vzero.out => hm2_7i95.0.ssr.00.out-02