From a780425a2d3a60288fa9564bde0def1c4ad9dbca Mon Sep 17 00:00:00 2001 From: electrolab Date: Sat, 5 Dec 2020 12:06:23 +0100 Subject: [PATCH] Config refactoring, not yet tested --- maurice.hal | 132 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 103 insertions(+), 29 deletions(-) diff --git a/maurice.hal b/maurice.hal index d5c010c..847096f 100644 --- a/maurice.hal +++ b/maurice.hal @@ -1,20 +1,62 @@ -loadusr -W lcec_conf maurice.xml -loadrt lcec +############################################ +# Generic section +############################################ + +#========================================== +# Components declaration +#========================================== + loadrt trivkins loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS -loadrt and2 count=2 -loadrt not count=2 -addf lcec.read-all servo-thread addf motion-command-handler servo-thread addf motion-controller servo-thread -addf lcec.write-all servo-thread -addf and2.0 servo-thread -addf and2.1 servo-thread -addf not.0 servo-thread -addf not.1 servo-thread -net ec_up lcec.state-op => iocontrol.0.emc-enable-in +#========================================== +# Global machine logic +#========================================== + +net state-op => iocontrol.0.emc-enable-in + +#========================================== +# X axis +#========================================== + +net X-amp <= joint.0.amp-enable-out +net X-fault => joint.0.amp-fault-in + +net X-poscmd <= joint.0.motor-pos-cmd +net X-posfb => joint.0.motor-pos-fb + +net X-homed => joint.0.home-sw-in +net X-homing <= joint.0.homing + +#========================================== +# Z axis +#========================================== + +net Z-amp <= joint.2.amp-enable-out +net Z-fault => joint.2.amp-fault-in + +net Z-poscmd <= joint.2.motor-pos-cmd +net Z-posfb => joint.2.motor-pos-fb + +net Z-homed => joint.2.home-sw-in +net Z-homing <= joint.2.homing + +############################################ +# Hardware section +############################################ + +#========================================== +# Components declaration +#========================================== + +loadusr -W lcec_conf maurice.xml +loadrt lcec + +addf lcec.read-all servo-thread +addf lcec.write-all servo-thread setp lcec.0.0.drivecontrol-1 1 setp lcec.0.0.drivecontrol-2 1 @@ -26,28 +68,60 @@ setp lcec.0.0.modecontrol-4 0 setp lcec.0.1.modecontrol-0 0 setp lcec.0.1.modecontrol-4 0 +loadrt and2 count=2 +loadrt not count=2 + +addf and2.0 servo-thread +addf and2.1 servo-thread +addf not.0 servo-thread +addf not.1 servo-thread + +#========================================== +# Global machine logic +#========================================== + +net state-op <= lcec.state-op + +#========================================== +# X axis +#========================================== + +net X-amp => lcec.0.0.drivecontrol-3 => lcec.0.0.drivecontrol-0 +net X-poscmd => lcec.0.0.poscommand +net X-posfb <= lcec.0.0.pos +net X-fault <= lcec.0.0.drivestatus-3 + +net X-modehome <= lcec.0.0.modestatus-3 +net X-stat4 <= lcec.0.0.drivestatus-12 + +net X-modehome => and2.0.in0 +net X-stat4 => and2.0.in1 +net X-homed <= and2.0.out + +net X-homing => not.0.in +net X-position <= not.0.out -net Xachse_AF joint.0.amp-enable-out => lcec.0.0.drivecontrol-3 => lcec.0.0.drivecontrol-0 -net Xachse_fb lcec.0.0.pos => joint.0.motor-pos-fb -net Xachse_cmd joint.0.motor-pos-cmd => lcec.0.0.poscommand -net Xaxis_fault lcec.0.0.drivestatus-3 => joint.0.amp-fault-in +net X-homing => lcec.0.0.modecontrol-1 => lcec.0.0.modecontrol-2 => lcec.0.0.drivecontrol-4 +net X-position => lcec.0.0.modecontrol-3 -net Zachse_AF joint.2.amp-enable-out => lcec.0.1.drivecontrol-3 => lcec.0.1.drivecontrol-0 -net Zachse_fb lcec.0.1.pos => joint.2.motor-pos-fb -net Zachse_cmd joint.2.motor-pos-cmd => lcec.0.1.poscommand -net Zaxis_fault lcec.0.1.drivestatus-3 => joint.2.amp-fault-in +#========================================== +# Z axis +#========================================== -net Xmodehome lcec.0.0.modestatus-3 <= and2.0.in0 -net Xstat4 lcec.0.0.drivestatus-12 <= and2.0.in1 -net Xhomed and2.0.out => joint.0.home-sw-in +net Z-amp => lcec.0.1.drivecontrol-3 => lcec.0.1.drivecontrol-0 +net Z-poscmd => lcec.0.1.poscommand +net Z-posfb <= lcec.0.1.pos +net Z-fault <= lcec.0.1.drivestatus-3 -net Xhoming joint.0.homing => lcec.0.0.modecontrol-1 => lcec.0.0.modecontrol-2 => lcec.0.0.drivecontrol-4 => not.0.in -net Xposition not.0.out => lcec.0.0.modecontrol-3 +net Z-modehome <= lcec.0.1.modestatus-3 +net Z-stat4 <= lcec.0.1.drivestatus-12 -net Zmodehome lcec.0.1.modestatus-3 <= and2.1.in0 -net Zstat4 lcec.0.1.drivestatus-12 <= and2.1.in1 -net Zhomed and2.1.out => joint.2.home-sw-in +net Z-modehome => and2.1.in0 +net Z-stat4 => and2.1.in1 +net Z-homed <= and2.1.out -net Zhoming joint.2.homing => lcec.0.1.modecontrol-1 => lcec.0.1.modecontrol-2 => lcec.0.1.drivecontrol-4 => not.1.in -net Zposition not.1.out => lcec.0.1.modecontrol-3 +net Z-homing => not.1.in +net Z-position <= not.1.out +net Z-homing => lcec.0.1.modecontrol-1 => lcec.0.1.modecontrol-2 => lcec.0.1.drivecontrol-4 +net Z-position => lcec.0.1.modecontrol-3 -- GitLab