# core HAL config file for simulation

# first load all the RT modules that will be needed
# kinematics
loadrt [KINS]KINEMATICS
# motion controller, get name and thread periods from ini file
loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
addf lcec.read-all servo-thread
# add motion controller functions to servo thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread

# create HAL signals for position commands from motion module
# loop position commands back to motion module feedback
net Xpos joint.0.motor-pos-cmd => joint.0.motor-pos-fb
net Zpos joint.1.motor-pos-cmd => joint.1.motor-pos-fb
net Xpos lcec.0.0.commanded-position
net myXvel lcec.0.0.commanded-velocity joint.0.vel-cmd

# estop loopback
net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in

# create signals for tool loading loopback
net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared
net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed

net spindle-fwd spindle.0.forward
net spindle-rev spindle.0.reverse
#net spindle-speed spindle.0.speed-out

net lube iocontrol.0.lube
net flood iocontrol.0.coolant-flood
net mist iocontrol.0.coolant-mist
