Hello,
I have modified the simulated_switch.hal (see attached file) to simulate the tool setter. Also, it includes an offset based on tool number to simulate different tool lengths. Very useful to validate my "Tn M6" remap routines and associated Gmoccapy/Machineface GUI modifications.
Frederic.

Le 2015-09-26 20:18, John Kasunich a écrit :
You should be able to simulate a probe in your sim HAL file.
A comparator looking at axis position and driving the probe
input true when the position is above (or below) a specific
value....


loadrt and2 names=and2_0,and2_1
loadrt comp names=comp_x,comp_y,comp_z,comp_probe_x,comp_probe_y,comp_probe_z
loadrt sum2 names=sum_offset_z
loadrt conv_s32_float names=cnv1

net Xhomeswpos => comp_x.in0
net Yhomeswpos => comp_y.in0
net Zhomeswpos => comp_z.in0

net Xprobe_swpos => comp_probe_x.in0
net Yprobe_swpos => comp_probe_y.in0

# Simulate different tool length with tool number

net Zprobe_swpos => sum_offset_z.in0
net tool-number iocontrol.0.tool-number => cnv1.in
net fake_offset cnv1.out => sum_offset_z.in1
net z_with_offset sum_offset_z.out => comp_probe_z.in0

sets Xhomeswpos 1.5
sets Yhomeswpos 1.5
sets Zhomeswpos 1.5

sets Xprobe_swpos [TOOLSENSOR]X
sets Yprobe_swpos [TOOLSENSOR]Y
sets Zprobe_swpos -70

setp comp_probe_x.hyst 2
setp comp_probe_y.hyst 2
setp comp_probe_z.hyst 2

net x2 axis.0.joint-pos-fb => comp_x.in1 comp_probe_x.in1
net y2 axis.1.joint-pos-fb => comp_y.in1 comp_probe_y.in1
net z2 axis.2.joint-pos-fb => comp_z.in1 comp_probe_z.in1

net Xhomesw <= comp_x.out => axis.0.home-sw-in
net Yhomesw <= comp_y.out => axis.1.home-sw-in
net Zhomesw <= comp_z.out => axis.2.home-sw-in

net px comp_probe_x.equal => and2_0.in0
net py comp_probe_y.equal => and2_0.in1
net pz comp_probe_z.equal => and2_1.in0
net pxy and2_0.out => and2_1.in1

net probe-in <= and2_1.out

addf comp_x servo-thread
addf comp_y servo-thread
addf comp_z servo-thread
addf comp_probe_x servo-thread
addf comp_probe_y servo-thread
addf comp_probe_z servo-thread

addf and2_0 servo-thread
addf and2_1 servo-thread
addf sum_offset_z servo-thread
addf cnv1 servo-thread

newsig pressure-is-ok bit

------------------------------------------------------------------------------
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to