Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # mpg x with ilowpass filtering
- # mpg-xyz.hal
- # add this line to postgui_call_list.hal
- # ' source mpg-xyz.hal '
- # modify ini file to add .0 show the following lines in hostmot2
- # DRIVER0 = hm2_xxxx.0
- # BOARD0 = xxxx.0
- loadrt encoder num_chan=3
- loadrt mux4 count=3
- addf encoder.capture-position servo-thread
- addf encoder.update-counters base-thread
- addf mux4.0 servo-thread
- addf mux4.1 servo-thread
- addf mux4.2 servo-thread
- loadrt ilowpass
- #x-axis
- addf ilowpass.0 servo-thread
- setp ilowpass.0.scale 1000
- setp ilowpass.0.gain 0.01
- #y-axis
- addf ilowpass.1 servo-thread
- setp ilowpass.1.scale 1000
- setp ilowpass.1.gain 0.01
- #z-axis
- addf ilowpass.2 servo-thread
- setp ilowpass.2.scale 1000
- setp ilowpass.2.gain 0.01
- # If your MPG outputs a quadrature signal per click set x4 to 1
- # If your MPG puts out 1 pulse per click set x4 to 0
- setp encoder.0.x4-mode 0
- setp encoder.1.x4-mode 0
- setp encoder.2.x4-mode 0
- # For velocity mode, set to 1
- # In velocity mode the axis stops when the dial is stopped
- # even if that means the commanded motion is not completed,
- # For position mode (the default), set to 0
- # In position mode the axis will move exactly jog-scale
- # units for each count, regardless of how long that might take,
- setp axis.0.jog-vel-mode 0
- setp axis.1.jog-vel-mode 0
- setp axis.2.jog-vel-mode 0
- # the inputs to the mux4 component
- net scale1 mux4.0.sel0 <= hm2_7i43.0.gpio.014.in_not # change to select scale0 input select pin 0
- net scale2 mux4.0.sel1 <= hm2_7i43.0.gpio.014.in_not # change to select scale0 input select pin 1
- net scale3 mux4.1.sel0 <= hm2_7i43.0.gpio.014.in_not # change to select scale1 input select pin 0
- net scale4 mux4.1.sel1 <= hm2_7i43.0.gpio.014.in_not # change to select scale1 input select pin 1
- net scale5 mux4.2.sel0 <= hm2_7i43.0.gpio.014.in_not # change to select scale2 input select pin 0
- net scale6 mux4.2.sel1 <= hm2_7i43.0.gpio.014.in_not # change to select scale2 input select pin 1
- # this sets the scale that will be used based on the input to the mux4
- # the scale used here has to be multiplied by the ilowpass scale
- setp mux4.0.in0 0.0001
- setp mux4.0.in1 0.00001
- setp mux4.0.in2 0.000001
- setp mux4.1.in0 0.0001
- setp mux4.1.in1 0.00001
- setp mux4.1.in2 0.000001
- setp mux4.2.in0 0.0001
- setp mux4.2.in1 0.00001
- setp mux4.2.in2 0.000001
- # send encoder counts to ilowpass
- net mpg-out-x ilowpass.0.in <= encoder.0.counts
- net mpg-out-y ilowpass.1.in <= encoder.1.counts
- net mpg-out-z ilowpass.2.in <= encoder.2.counts
- # the output from the ilowpass is sent to each axis jog scale
- net mpg-scale-x <= ilowpass0.out
- net mpg-scale-y <= ilowpass1.out
- net mpg-scale-z <= ilowpass2.out
- net mpg-scale => axis.0.jog-scale
- net mpg-scale => axis.1.jog-scale
- net mpg-scale => axis.2.jog-scale
- # the encoder output counts to the axis. Only the selected axis will move.
- net encoder-counts-x <= encoder.0.counts
- net encoder-counts-y <= encoder.1.counts
- net encoder-counts-z <= encoder.2.counts
- net encoder-counts-x => axis.0.jog-counts
- net encoder-counts-y => axis.1.jog-counts
- net encoder-counts-z => axis.2.jog-counts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement