Files
linuxcncAllWasm/lib/hallib/simulated_home.hal
2026-08-20 06:17:39 +08:00

30 lines
812 B
Plaintext

# This hal file simulates home switches
loadrt comp names=comp_x,comp_y,comp_z
# set fixed value for position of virtual switches (use 'in0' for positive and 'in1' for negative values)
net Xhomeswpos => comp_x.in0
net Yhomeswpos => comp_y.in0
net Zhomeswpos => comp_z.in0
sets Xhomeswpos 1
sets Yhomeswpos .5
sets Zhomeswpos 2
# link current position if simulated machine to the other input of the comp functions
net Xpos => comp_x.in1
net Ypos => comp_y.in1
net Zpos => comp_z.in1
# set hysteresis of virtual home switches
setp comp_x.hyst .02
setp comp_y.hyst .02
setp comp_z.hyst .02
net Xhomesw <= comp_x.out => joint.0.home-sw-in
net Yhomesw <= comp_y.out => joint.1.home-sw-in
net Zhomesw <= comp_z.out => joint.2.home-sw-in
addf comp_x servo-thread
addf comp_y servo-thread
addf comp_z servo-thread