Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # kinematics
- loadrt trivkins
- # motion controller, get name and thread periods from ini file
- loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
- # standard components
- loadrt pid num_chan=5
- loadrt abs
- addf abs.0 servo-thread
- loadrt scale
- addf scale.0 servo-thread
- # hostmot2 driver
- loadrt hostmot2
- # load low-level drivers
- loadrt hm2_pci config="firmware=hm2/5i20/SVST8_4.BIT num_encoders=4 num_pwmgens=4 num_stepgens=0,firmware=hm2/5i20/SVST8_4.BIT num_encoders=4 num_pwmgens=4 num_stepgens=0"
- loadrt classicladder_rt numRungs=200 numBits=200 numWords=20 numTimersIec=40 numMonostables=2 numPhysInputs=30 numPhysOutputs=30 numArithmExpr=100 numCounters=10 numSections=1
- loadusr -w classicladder --nogui bostomatic.clp
- # 7i33 on board0 P2
- setp hm2_5i20.0.pwmgen.00.output-type 3
- setp hm2_5i20.0.pwmgen.01.output-type 3
- setp hm2_5i20.0.pwmgen.02.output-type 3
- setp hm2_5i20.0.pwmgen.03.output-type 3
- setp hm2_5i20.0.pwmgen.pdm_frequency 6000000
- # 7i33 on board1 P2
- setp hm2_5i20.1.pwmgen.00.output-type 3
- setp hm2_5i20.1.pwmgen.01.output-type 3
- setp hm2_5i20.1.pwmgen.02.output-type 3
- setp hm2_5i20.1.pwmgen.03.output-type 3
- setp hm2_5i20.1.pwmgen.pdm_frequency 6000000
- # make outputs for the 7i37 on board0 P3
- # INs are 024 through 039
- # OUTs are 040 through 047
- setp hm2_5i20.0.gpio.040.is_output 1
- setp hm2_5i20.0.gpio.041.is_output 1
- setp hm2_5i20.0.gpio.042.is_output 1
- setp hm2_5i20.0.gpio.043.is_output 1
- setp hm2_5i20.0.gpio.044.is_output 1
- setp hm2_5i20.0.gpio.045.is_output 1
- setp hm2_5i20.0.gpio.046.is_output 1
- setp hm2_5i20.0.gpio.047.is_output 1
- setp hm2_5i20.0.gpio.040.invert_output 1
- setp hm2_5i20.0.gpio.041.invert_output 1
- setp hm2_5i20.0.gpio.042.invert_output 1
- setp hm2_5i20.0.gpio.043.invert_output 1
- setp hm2_5i20.0.gpio.044.invert_output 1
- setp hm2_5i20.0.gpio.045.invert_output 1
- setp hm2_5i20.0.gpio.046.invert_output 1
- setp hm2_5i20.0.gpio.047.invert_output 1
- # make outputs for the 7i37 on board1 P3
- # INs are 024 through 039
- # OUTs are 040 through 047
- setp hm2_5i20.1.gpio.040.is_output 1
- setp hm2_5i20.1.gpio.041.is_output 1
- setp hm2_5i20.1.gpio.042.is_output 1
- setp hm2_5i20.1.gpio.043.is_output 1
- setp hm2_5i20.1.gpio.044.is_output 1
- setp hm2_5i20.1.gpio.045.is_output 1
- setp hm2_5i20.1.gpio.046.is_output 1
- setp hm2_5i20.1.gpio.047.is_output 1
- setp hm2_5i20.1.gpio.040.invert_output 1
- setp hm2_5i20.1.gpio.041.invert_output 1
- setp hm2_5i20.1.gpio.042.invert_output 1
- setp hm2_5i20.1.gpio.043.invert_output 1
- setp hm2_5i20.1.gpio.044.invert_output 1
- setp hm2_5i20.1.gpio.045.invert_output 1
- setp hm2_5i20.1.gpio.046.invert_output 1
- setp hm2_5i20.1.gpio.047.invert_output 1
- # make outputs for the 7i37 on board0 P4
- # INs are 048 through 063
- # OUTs are 064 through 071
- setp hm2_5i20.0.gpio.064.is_output 1
- setp hm2_5i20.0.gpio.065.is_output 1
- setp hm2_5i20.0.gpio.066.is_output 1
- setp hm2_5i20.0.gpio.067.is_output 1
- setp hm2_5i20.0.gpio.068.is_output 1
- setp hm2_5i20.0.gpio.069.is_output 1
- setp hm2_5i20.0.gpio.070.is_output 1
- setp hm2_5i20.0.gpio.071.is_output 1
- setp hm2_5i20.0.gpio.064.invert_output 1
- setp hm2_5i20.0.gpio.065.invert_output 1
- setp hm2_5i20.0.gpio.066.invert_output 1
- setp hm2_5i20.0.gpio.067.invert_output 1
- setp hm2_5i20.0.gpio.068.invert_output 1
- setp hm2_5i20.0.gpio.069.invert_output 1
- setp hm2_5i20.0.gpio.070.invert_output 1
- setp hm2_5i20.0.gpio.071.invert_output 1
- # make outputs for the 7i37 on board1 P4
- # INs are 048 through 063
- # OUTs are 064 through 071
- setp hm2_5i20.1.gpio.064.is_output 1
- setp hm2_5i20.1.gpio.065.is_output 1
- setp hm2_5i20.1.gpio.066.is_output 1
- setp hm2_5i20.1.gpio.067.is_output 1
- setp hm2_5i20.1.gpio.068.is_output 1
- setp hm2_5i20.1.gpio.069.is_output 1
- setp hm2_5i20.1.gpio.070.is_output 1
- setp hm2_5i20.1.gpio.071.is_output 1
- setp hm2_5i20.1.gpio.064.invert_output 1
- setp hm2_5i20.1.gpio.065.invert_output 1
- setp hm2_5i20.1.gpio.066.invert_output 1
- setp hm2_5i20.1.gpio.067.invert_output 1
- setp hm2_5i20.1.gpio.068.invert_output 1
- setp hm2_5i20.1.gpio.069.invert_output 1
- setp hm2_5i20.1.gpio.070.invert_output 1
- setp hm2_5i20.1.gpio.071.invert_output 1
- # configure both watchdogs for 10 servo cycles
- setp hm2_5i20.0.watchdog.timeout_ns 10000000
- setp hm2_5i20.1.watchdog.timeout_ns 10000000
- # ################################################
- # THREADS
- # ################################################
- addf hm2_5i20.0.read servo-thread
- addf hm2_5i20.1.read servo-thread
- addf motion-command-handler servo-thread
- addf motion-controller servo-thread
- addf pid.0.do-pid-calcs servo-thread
- addf pid.1.do-pid-calcs servo-thread
- addf pid.2.do-pid-calcs servo-thread
- addf pid.3.do-pid-calcs servo-thread
- addf pid.4.do-pid-calcs servo-thread
- addf classicladder.0.refresh servo-thread
- addf hm2_5i20.0.write servo-thread
- addf hm2_5i20.1.write servo-thread
- addf hm2_5i20.0.pet_watchdog servo-thread
- addf hm2_5i20.1.pet_watchdog servo-thread
- # ################
- # X [0] Axis
- # ################
- # axis enable chain
- newsig emcmot.00.enable bit
- sets emcmot.00.enable FALSE
- net emcmot.00.enable => pid.0.enable
- net emcmot.00.enable => hm2_5i20.0.pwmgen.00.enable
- net emcmot.00.enable => hm2_5i20.0.gpio.045.out
- net emcmot.00.enable <= axis.0.amp-enable-out
- # encoder feedback
- setp hm2_5i20.0.encoder.00.counter-mode 0
- setp hm2_5i20.0.encoder.00.filter 1
- setp hm2_5i20.0.encoder.00.index-invert 0
- setp hm2_5i20.0.encoder.00.index-mask 0
- setp hm2_5i20.0.encoder.00.index-mask-invert 0
- setp hm2_5i20.0.encoder.00.scale [AXIS_0]INPUT_SCALE
- net motor.00.pos-fb hm2_5i20.0.encoder.00.position => pid.0.feedback
- net motor.00.pos-fb => axis.0.motor-pos-fb #push copy back to Axis GUI
- # set PID loop gains from inifile
- setp pid.0.Pgain [AXIS_0]P
- setp pid.0.Igain [AXIS_0]I
- setp pid.0.Dgain [AXIS_0]D
- setp pid.0.bias [AXIS_0]BIAS
- setp pid.0.FF0 [AXIS_0]FF0
- setp pid.0.FF1 [AXIS_0]FF1
- setp pid.0.FF2 [AXIS_0]FF2
- setp pid.0.deadband [AXIS_0]DEADBAND
- setp pid.0.maxoutput [AXIS_0]MAX_OUTPUT
- # position command signals
- setp hm2_5i20.0.pwmgen.00.scale [AXIS_0]OUTPUT_SCALE
- net emcmot.00.pos-cmd axis.0.motor-pos-cmd => pid.0.command
- net motor.00.command pid.0.output => hm2_5i20.0.pwmgen.00.value
- # ################
- # Y [1] Axis
- # ################
- # axis enable chain
- newsig emcmot.01.enable bit
- sets emcmot.01.enable FALSE
- net emcmot.01.enable => pid.1.enable
- net emcmot.01.enable => hm2_5i20.0.pwmgen.01.enable
- net emcmot.01.enable <= axis.1.amp-enable-out
- # encoder feedback
- setp hm2_5i20.0.encoder.01.counter-mode 0
- setp hm2_5i20.0.encoder.01.filter 1
- setp hm2_5i20.0.encoder.01.index-invert 0
- setp hm2_5i20.0.encoder.01.index-mask 0
- setp hm2_5i20.0.encoder.01.index-mask-invert 0
- setp hm2_5i20.0.encoder.01.scale [AXIS_1]INPUT_SCALE
- net motor.01.pos-fb hm2_5i20.0.encoder.01.position => pid.1.feedback
- net motor.01.pos-fb => axis.1.motor-pos-fb #push copy back to Axis GUI
- # set PID loop gains from inifile
- setp pid.1.Pgain [AXIS_1]P
- setp pid.1.Igain [AXIS_1]I
- setp pid.1.Dgain [AXIS_1]D
- setp pid.1.bias [AXIS_1]BIAS
- setp pid.1.FF0 [AXIS_1]FF0
- setp pid.1.FF1 [AXIS_1]FF1
- setp pid.1.FF2 [AXIS_1]FF2
- setp pid.1.deadband [AXIS_1]DEADBAND
- setp pid.1.maxoutput [AXIS_1]MAX_OUTPUT
- # position command signals
- setp hm2_5i20.0.pwmgen.01.scale [AXIS_1]OUTPUT_SCALE
- net emcmot.01.pos-cmd axis.1.motor-pos-cmd => pid.1.command
- net motor.01.command pid.1.output => hm2_5i20.0.pwmgen.01.value
- # ################
- # Z [2] Axis
- # ################
- # axis enable chain
- newsig emcmot.02.enable bit
- sets emcmot.02.enable FALSE
- net emcmot.02.enable => pid.2.enable
- net emcmot.02.enable => hm2_5i20.0.pwmgen.02.enable
- net emcmot.02.enable <= axis.2.amp-enable-out
- # encoder feedback
- setp hm2_5i20.0.encoder.02.counter-mode 0
- setp hm2_5i20.0.encoder.02.filter 1
- setp hm2_5i20.0.encoder.02.index-invert 0
- setp hm2_5i20.0.encoder.02.index-mask 0
- setp hm2_5i20.0.encoder.02.index-mask-invert 0
- setp hm2_5i20.0.encoder.02.scale [AXIS_2]INPUT_SCALE
- net motor.02.pos-fb hm2_5i20.0.encoder.02.position => pid.2.feedback
- net motor.02.pos-fb => axis.2.motor-pos-fb #push copy back to Axis GUI
- # set PID loop gains from inifile
- setp pid.2.Pgain [AXIS_2]P
- setp pid.2.Igain [AXIS_2]I
- setp pid.2.Dgain [AXIS_2]D
- setp pid.2.bias [AXIS_2]BIAS
- setp pid.2.FF0 [AXIS_2]FF0
- setp pid.2.FF1 [AXIS_2]FF1
- setp pid.2.FF2 [AXIS_2]FF2
- setp pid.2.deadband [AXIS_2]DEADBAND
- setp pid.2.maxoutput [AXIS_2]MAX_OUTPUT
- # position command signals
- setp hm2_5i20.0.pwmgen.02.scale [AXIS_2]OUTPUT_SCALE
- net emcmot.02.pos-cmd axis.2.motor-pos-cmd => pid.2.command
- net motor.02.command pid.2.output => hm2_5i20.0.pwmgen.02.value
- # ################
- # A [3] Axis
- # ################
- # axis enable chain
- newsig emcmot.03.enable bit
- sets emcmot.03.enable FALSE
- net emcmot.03.enable => pid.3.enable
- net emcmot.03.enable => hm2_5i20.0.pwmgen.03.enable
- net emcmot.03.enable <= axis.3.amp-enable-out
- # encoder feedback
- setp hm2_5i20.0.encoder.03.counter-mode 0
- setp hm2_5i20.0.encoder.03.filter 1
- setp hm2_5i20.0.encoder.03.index-invert 0
- setp hm2_5i20.0.encoder.03.index-mask 0
- setp hm2_5i20.0.encoder.03.index-mask-invert 0
- setp hm2_5i20.0.encoder.03.scale [AXIS_3]INPUT_SCALE
- net motor.03.pos-fb hm2_5i20.0.encoder.03.position => pid.3.feedback
- net motor.03.pos-fb => axis.3.motor-pos-fb #push copy back to Axis GUI
- # set PID loop gains from inifile
- setp pid.3.Pgain [AXIS_3]P
- setp pid.3.Igain [AXIS_3]I
- setp pid.3.Dgain [AXIS_3]D
- setp pid.3.bias [AXIS_3]BIAS
- setp pid.3.FF0 [AXIS_3]FF0
- setp pid.3.FF1 [AXIS_3]FF1
- setp pid.3.FF2 [AXIS_3]FF2
- setp pid.3.deadband [AXIS_3]DEADBAND
- setp pid.3.maxoutput [AXIS_3]MAX_OUTPUT
- # position command signals
- setp hm2_5i20.0.pwmgen.03.scale [AXIS_3]OUTPUT_SCALE
- net emcmot.03.pos-cmd axis.3.motor-pos-cmd => pid.3.command
- net motor.03.command pid.3.output => hm2_5i20.0.pwmgen.03.value
- # ################
- # B [4] Axis
- # ################
- # axis enable chain
- newsig emcmot.04.enable bit
- sets emcmot.04.enable FALSE
- net emcmot.04.enable => pid.4.enable
- net emcmot.04.enable => hm2_5i20.1.pwmgen.00.enable
- net emcmot.04.enable <= axis.4.amp-enable-out
- # encoder feedback
- setp hm2_5i20.1.encoder.00.counter-mode 0
- setp hm2_5i20.1.encoder.00.filter 1
- setp hm2_5i20.1.encoder.00.index-invert 0
- setp hm2_5i20.1.encoder.00.index-mask 0
- setp hm2_5i20.1.encoder.00.index-mask-invert 0
- setp hm2_5i20.1.encoder.00.scale [AXIS_4]INPUT_SCALE
- net motor.04.pos-fb hm2_5i20.1.encoder.00.position => pid.4.feedback
- net motor.04.pos-fb => axis.4.motor-pos-fb #push copy back to Axis GUI
- # set PID loop gains from inifile
- setp pid.4.Pgain [AXIS_4]P
- setp pid.4.Igain [AXIS_4]I
- setp pid.4.Dgain [AXIS_4]D
- setp pid.4.bias [AXIS_4]BIAS
- setp pid.4.FF0 [AXIS_4]FF0
- setp pid.4.FF1 [AXIS_4]FF1
- setp pid.4.FF2 [AXIS_4]FF2
- setp pid.4.deadband [AXIS_4]DEADBAND
- setp pid.4.maxoutput [AXIS_4]MAX_OUTPUT
- # position command signals
- setp hm2_5i20.1.pwmgen.00.scale [AXIS_4]OUTPUT_SCALE
- net emcmot.04.pos-cmd axis.4.motor-pos-cmd => pid.4.command
- net motor.04.command pid.4.output => hm2_5i20.1.pwmgen.00.value
- # dummy axis loopback
- net Wloop axis.8.motor-pos-cmd axis.8.motor-pos-fb
- # this kind of machine does not do a prep, since it has to put
- # the old tool away before moving the carousel. so just loop it
- # back...
- net tool-prep-loop iocontrol.0.tool-prepare => iocontrol.0.tool-prepared
- # only the Y servo has an index, X and Z home without using the index
- net Xindex hm2_5i20.0.encoder.00.index-enable <=> axis.0.index-enable
- net Yindex hm2_5i20.0.encoder.01.index-enable <=> axis.1.index-enable
- net Zindex hm2_5i20.0.encoder.02.index-enable <=> axis.2.index-enable
- net Aindex hm2_5i20.0.encoder.03.index-enable <=> axis.3.index-enable
- net Bindex hm2_5i20.1.encoder.00.index-enable <=> axis.4.index-enable
- net Xlimits hm2_5i20.0.gpio.029.in => axis.0.neg-lim-sw-in axis.0.pos-lim-sw-in
- net Ylimits hm2_5i20.0.gpio.030.in => axis.1.neg-lim-sw-in axis.1.pos-lim-sw-in
- net Zlimits hm2_5i20.0.gpio.031.in => axis.2.neg-lim-sw-in axis.2.pos-lim-sw-in
- # no Alimits
- net Blimits hm2_5i20.1.gpio.032.in => axis.4.neg-lim-sw-in axis.4.pos-lim-sw-in
- net Xhome hm2_5i20.0.gpio.024.in => axis.0.home-sw-in
- net Yhome hm2_5i20.0.gpio.025.in => axis.1.home-sw-in
- net Zhome hm2_5i20.0.gpio.026.in => axis.2.home-sw-in
- net Ahome hm2_5i20.0.gpio.027.in_not => axis.3.home-sw-in
- net Bhome hm2_5i20.0.gpio.028.in => axis.4.home-sw-in
- net EstopSense hm2_5i20.0.gpio.039.in_not => iocontrol.0.emc-enable-in
- net EstopWrite iocontrol.0.user-enable-out => hm2_5i20.0.gpio.047.out
- # Spindle Direction
- net spindle-fwd motion.spindle-forward => hm2_5i20.0.gpio.041.out
- net spindle-rev motion.spindle-reverse => hm2_5i20.0.gpio.040.out
- # Speed Scale Control (0-10v Spindle Speed)
- loadrt scale count=1
- addf scale.0 servo-thread
- # 10volts / 7,000 RPM's at the Spindle = .00142857)
- setp scale.0.gain 0.00142857
- net spindle-rpm-cmd motion.spindle-speed-out => abs.0.in
- net spindle-rpm-abs abs.0.out => hm2_5i20.1.pwmgen.01.value
- # Spindle Enable
- net emcmot.01.enable hm2_5i20.1.pwmgen.01.enable
- net spindle-enable emcmot.01.enable
- net FloodOn iocontrol.0.coolant-flood => hm2_5i20.0.gpio.046.out
- net LubeOn iocontrol.0.lube => hm2_5i20.1.gpio.046.out
- net HydOn => hm2_5i20.0.gpio.043.out
- net PotCycleA hm2_5i20.1.gpio.031.in_not => classicladder.0.in-00
- net PotCycleB hm2_5i20.1.gpio.033.in_not => classicladder.0.in-01
- net ToolInSpindle hm2_5i20.1.gpio.027.in => classicladder.0.in-02
- net ArmIsIn hm2_5i20.0.gpio.035.in_not => classicladder.0.in-03
- net ArmIsOut hm2_5i20.0.gpio.037.in_not => classicladder.0.in-04
- # Z axis extra position proxes will not be needed anymore
- net ToolIndex hm2_5i20.0.gpio.033.in_not => classicladder.0.in-07
- net ToolChangeStart iocontrol.0.tool-change => classicladder.0.in-08
- # and then when it's done ladder tells iocontrol...
- # net ToolChangeDone classicladder.0.out-XXX iocontrol.0.tool-changed
- net ToolRequested iocontrol.0.tool-prep-number classicladder.0.s32in-00
- net IndexFor classicladder.0.out-00 => hm2_5i20.1.gpio.041.out
- net IndexRev classicladder.0.out-01 => hm2_5i20.1.gpio.043.out
- net MoveArmIn classicladder.0.out-06 => hm2_5i20.0.gpio.044.out
- net ToolRelease classicladder.0.out-08 => hm2_5i20.0.gpio.042.out # was ManTC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement