Hi,everyone
I've tried to follow the orient hal map to build a hal to test if it can be workable for orient ,but met some problem. while running M3 S100,M4 S100 such command it's all OK, but when I tried to use M19 R180 ,it didnt rotate at all. Using halshow display GUI,I noticed that while I run M3/M4 command,the spindle.on is true,but while I run the M19 R180 ,it is false.I dont know if it is the reason.Wish someone could help me ,point out where is the error of my hal .Thanks
###########################################################
#
# CIA 402 example snippet Hal
#
###########################################################
###########################################################
# Setup
###########################################################
loadrt [KINS]KINEMATICS
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS
loadusr -W lcec_conf ethercat-conf.xml
loadrt lcec
loadrt cia402 count=2
loadrt pid names=pos-pid,velo-pid
loadrt orient count=1
loadrt mux2 count=1
###########################################################
# Functions servo-thread
###########################################################
addf lcec.read-all servo-thread #reading from servo
addf cia402.0.read-all servo-thread
addf cia402.1.read-all servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread #linuxcnc module ,cia402 module as a translator
addf pos-pid.do-pid-calcs servo-thread
addf velo-pid.do-pid-calcs servo-thread
addf orient.0 servo-thread
addf mux2.0 servo-thread
addf cia402.0.write-all servo-thread
addf cia402.1.write-all servo-thread #writing to servo
addf lcec.write-all servo-thread
#########################################
#nets
#########################################
net emc-enable => iocontrol.0.emc-enable-in
sets emc-enable 1
#config
#
# Joint 0
#
setp cia402.0.csp-mode 0
setp cia402.0.velo-scale 166
#FOR SPINDLE
setp velo-pid.deadband 0.3 #limit pid tolerance
setp velo-pid.maxoutput 500 #limit pid maxoutput to protect
setp pos-pid.deadband 0.3
setp pos-pid.maxoutput 500
net 0-statusword lcec.0.0.cia-statusword => cia402.0.statusword
net 0-opmode-display lcec.0.0.opmode-display => cia402.0.opmode-display
net 0-drv-act-pos lcec.0.0.actual-position => cia402.0.drv-actual-position
net 0-drv-act-velo lcec.0.0.actual-velocity => cia402.0.drv-actual-velocity
net 0-speed-fb cia402.0.velocity-fb => velo-pid.feedback
net 0-pos-fb pos-pid.feedback <= cia402.0.pos-fb => orient.0.position
#for spindle orient
#from linuxcnc motion to cia402 / cia402 to motion
#net 0-spindleON spindle.0.on => cia402.0.enable
#net 0-target-speed spindle.0.speed-out => cia402.0.velocity-cmd
net 0-home-index spindle.0.index-enable => cia402.0.home
net 0-spindleON velo-pid.enable <= spindle.0.on => cia402.0.enable
net 0-target-speed spindle.0.speed-out => velo-pid.command
net 0-orient pos-pid.enable <= spindle.0.orient => orient.0.enable => mux2.0.sel
net 0-angle spindle.0.orient-angle => orient.0.angle
net 0-orient_topos orient.0.command => pos-pid.command
net 0-pospid-tomux pos-pid.output => mux2.0.in1
net 0-velopid-tomux velo-pid.output => mux2.0.in0
net 0-muxtoabs-final-speed mux2.0.out => cia402.0.velocity-cmd
net 0-amp-fault spindle.0.amp-fault-in <= cia402.0.drv-fault
#from cia402 to servo
net 0-controlword cia402.0.controlword => lcec.0.0.cia-controlword
net 0-modes-of-operation cia402.0.opmode => lcec.0.0.opmode
net 0-drv-target-pos cia402.0.drv-target-position => lcec.0.0.target-position
net 0-drv-target-velo cia402.0.drv-target-velocity => lcec.0.0.target-velocity
#
# Joint 1
#
setp cia402.1.csp-mode 1
setp cia402.1.pos-scale 166
#from servo to cia402
net 1-statusword lcec.0.1.cia-statusword => cia402.1.statusword
net 1-opmode-display lcec.0.1.opmode-display => cia402.1.opmode-display
net 1-drv-act-pos lcec.0.1.actual-position => cia402.1.drv-actual-position
net 1-drv-act-velo lcec.0.1.actual-velocity => cia402.1.drv-actual-velocity
#from linuxcnc motion to cia402 / cia402 to motion
net 1-home-index joint.1.index-enable => cia402.1.home
net 1-enable joint.1.amp-enable-out => cia402.1.enable
net 1-amp-fault joint.1.amp-fault-in <= cia402.1.drv-fault
net 1-pos-cmd joint.1.motor-pos-cmd => cia402.1.pos-cmd
net 1-pos-fb joint.1.motor-pos-fb <= cia402.1.pos-fb
#from cia402 to servo
net 1-controlword cia402.1.controlword => lcec.0.1.cia-controlword
net 1-modes-of-operation cia402.1.opmode => lcec.0.1.opmode
net 1-drv-target-pos cia402.1.drv-target-position => lcec.0.1.target-position
net 1-drv-target-velo cia402.1.drv-target-velocity => lcec.0.1.target-velocity