# HAL config file for Vigilant Technologoes VTI PCI board
#
# install driver, this should autodetect the board
# if that doesn't work, try using base=0xABC, where ABC matches your setup
# loadrt hal_stg base=0x200
loadrt hal_vti num_chan=4 dio="IOIO"

# add functions to servo thread so they will be evaluated
# every servo period
# read inputs first
addf vti.capture-position servo-thread 1
# write outputs last
addf vti.write-dacs servo-thread -1

# connect position feedback signals to encoders
net Xpos-fb <= vti.0.position
net Ypos-fb <= vti.1.position
net Zpos-fb <= vti.2.position

# get feedback scaling from ini file
setp vti.0.position-scale [JOINT_0]INPUT_SCALE 
setp vti.1.position-scale [JOINT_1]INPUT_SCALE 
setp vti.2.position-scale [JOINT_2]INPUT_SCALE 

# connect PID output signals to DACs
net Xoutput => vti.0.dac-value
net Youtput => vti.1.dac-value
net Zoutput => vti.2.dac-value

# set output scaling from ini file 
setp vti.0.dac-gain [JOINT_0]OUTPUT_SCALE
setp vti.1.dac-gain [JOINT_1]OUTPUT_SCALE
setp vti.2.dac-gain [JOINT_2]OUTPUT_SCALE
# set output offset to zero
setp vti.0.dac-offset [JOINT_0]OUTPUT_OFFSET
setp vti.1.dac-offset [JOINT_1]OUTPUT_OFFSET
setp vti.2.dac-offset [JOINT_2]OUTPUT_OFFSET
