Jog speed using potentiometer

More
14 Nov 2016 02:15 - 14 Nov 2016 23:54 #82753 by Duc
Looking to use a potentiometer to set the jog speed for the axis movement instead of using the bar slider on the screen. Running into a few issues into the setup.

So far I have a 10K pot that reads from 16.79VDC to 24VDC for the analog input on the 7i84 which I will need to scale later on to fit the range I need.

net jog-speed <= hm2_5i25.0.7i84.0.2.analogin0

I can see the jog-speed vary in the Hal but no change in the jog-speed slider no the overall jog speed while moving a axis.


[code]# Generated by PNCconf at Fri Dec 25 14:13:58 2015
# If you make changes to this file, they will be
# overwritten when you run PNCconf again

loadrt timedelay count=1
loadrt abs count=1
loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hostmot2
loadrt hm2_pci config=" num_encoders=6 num_pwmgens=0 num_stepgens=0 sserial_port_0=0020 " 
setp    hm2_5i25.0.watchdog.timeout_ns 5000000
loadrt pid names=pid.x,pid.y,pid.z,pid.a,pid.s

addf hm2_5i25.0.read          servo-thread
addf motion-command-handler   servo-thread
addf motion-controller        servo-thread
addf pid.x.do-pid-calcs       servo-thread
addf pid.y.do-pid-calcs       servo-thread
addf pid.z.do-pid-calcs       servo-thread
addf pid.a.do-pid-calcs       servo-thread
addf pid.s.do-pid-calcs       servo-thread
addf hm2_5i25.0.write         servo-thread

#additional commands
loadrt mux16 count=4
loadrt mux_generic config="ss32,ss32"

loadrt ilowpass
loadrt comp count=1
loadrt mult2 count=1
addf timedelay.0 servo-thread
addf ilowpass.0 servo-thread
addf mux16.0 servo-thread  #jogincr
addf mux16.1 servo-thread  #Feedrate overide
addf mux16.2 servo-thread
addf mux16.3 servo-thread
addf mux-gen.00 servo-thread
addf mux-gen.01 servo-thread
addf mult2.0 servo-thread

addf abs.0 servo-thread
addf comp.0 servo-thread


loadrt near


addf near.0                   servo-thread


# external output signals
# ---COOLANT CONROL ---
net coolant-flood hm2_5i25.0.7i77.0.0.output-01

# ---LUBRICATION SYSTEM ---
# The first input to the comparator is zero.

setp comp.0.in0 0.01

# The other input to the comparator is the current axis movement velocity

net moving comp.0.in1 <= motion.current-vel

# It needs to be connected to an output bit

net pump comp.0.out => hm2_5i25.0.7i77.0.0.output-02

#Rotary input signals
net rotary.clamped <= hm2_5i25.0.7i77.0.0.input-17
net rotary.unclamped <= hm2_5i25.0.7i77.0.0.input-18



# --- SPINDLE-BRAKE ---
#net spindle-brake hm2_5i25.0.7i77.0.0.output-00
net spindle-brake => timedelay.0.in


net spindle-delayed timedelay.0.out => hm2_5i25.0.7i77.0.0.output-00
setp timedelay.0.on-delay 14
setp timedelay.0.off-delay 0


# --- BOTH-HOME-X ---
net both-home-x     <=  hm2_5i25.0.7i77.0.0.input-00

# --- BOTH-HOME-Y ---
net both-home-y     <=  hm2_5i25.0.7i77.0.0.input-01

# --- MAX-HOME-Z ---
net max-home-z     <=  hm2_5i25.0.7i77.0.0.input-03

# --- HOME-A ---
net home-a     <=  hm2_5i25.0.7i77.0.0.input-16-not


# --- MIN-Z ---
net min-z     <=  hm2_5i25.0.7i77.0.0.input-04

# --- JOINT-SELECT-a-X ---
net joint-select-a     <=  hm2_5i25.0.7i84.0.2.input-28

# --- JOINT-SELECT-b-Y ---
net joint-select-b     <=  hm2_5i25.0.7i84.0.2.input-29

# --- JOINT-SELECT-c-Z ---
net joint-select-c     <=  hm2_5i25.0.7i84.0.2.input-30

# --- JOINT-SELECT-d-A ---
net joint-select-d     <=  hm2_5i25.0.7i84.0.2.input-31

# --- JOG-INCR-A ---
net jog-incr-a     <=  hm2_5i25.0.7i84.0.2.input-11

# --- JOG-INCR-B ---
net jog-incr-b     <=  hm2_5i25.0.7i84.0.2.input-10

# --- JOG-INCR-C ---
net jog-incr-c     <=  hm2_5i25.0.7i84.0.2.input-09


# --- Feedrate overide - FO-INCR-A ---
net fo-incr-a     <=  hm2_5i25.0.7i84.0.2.input-08

# --- FO-INCR-B ---
net fo-incr-b     <=  hm2_5i25.0.7i84.0.2.input-07

# --- FO-INCR-C ---
net fo-incr-c     <=  hm2_5i25.0.7i84.0.2.input-06

# --- FO-INCR-D ---
net fo-incr-d     <=  hm2_5i25.0.7i84.0.2.input-05

# --- FO-INCR-E ---
net fo-incr-e     <=  hm2_5i25.0.7i84.0.2.input-04

# --- Spindle override - SO-INCR-A ---
net so-incr-a     <=  hm2_5i25.0.7i84.0.2.input-25

# --- SO-INCR-B ---
net so-incr-b     <=  hm2_5i25.0.7i84.0.2.input-26

# --- SO-INCR-C ---
net so-incr-c     <=  hm2_5i25.0.7i84.0.2.input-27



# --- Max velocity override - MVO-INCR-A ---
net mvo-incr-a     <=  hm2_5i25.0.7i84.0.2.input-20

# --- MVO-INCR-B ---
net mvo-incr-b     <=  hm2_5i25.0.7i84.0.2.input-21

# --- MVO-INCR-C ---
net mvo-incr-c     <=  hm2_5i25.0.7i84.0.2.input-22

# --- MVO-INCR-D ---
net mvo-incr-d     <=  hm2_5i25.0.7i84.0.2.input-23

# --- MVO-INCR-E ---
net mvo-incr-e     <=  hm2_5i25.0.7i84.0.2.input-24

# --- FO-ENABLE ---
net fo-enable      <=  hm2_5i25.0.7i84.0.2.input-14




# external input signals


#*******************
#  AXIS X
#*******************

setp   pid.x.Pgain     [AXIS_0]P
setp   pid.x.Igain     [AXIS_0]I
setp   pid.x.Dgain     [AXIS_0]D
setp   pid.x.bias      [AXIS_0]BIAS
setp   pid.x.FF0       [AXIS_0]FF0
setp   pid.x.FF1       [AXIS_0]FF1
setp   pid.x.FF2       [AXIS_0]FF2
setp   pid.x.deadband  [AXIS_0]DEADBAND
setp   pid.x.maxoutput [AXIS_0]MAX_OUTPUT
setp   pid.x.error-previous-target true
setp   pid.x.maxerror .0

net x-index-enable  <=> pid.x.index-enable
net x-enable        =>  pid.x.enable
net x-pos-cmd       =>  pid.x.command
net x-vel-cmd       =>  pid.x.command-deriv
net x-pos-fb        =>  pid.x.feedback
net x-output        =>  pid.x.output

# ---PWM Generator signals/setup---

setp   hm2_5i25.0.7i77.0.1.analogout0-scalemax  [AXIS_0]OUTPUT_SCALE
setp   hm2_5i25.0.7i77.0.1.analogout0-minlim    [AXIS_0]OUTPUT_MIN_LIMIT
setp   hm2_5i25.0.7i77.0.1.analogout0-maxlim    [AXIS_0]OUTPUT_MAX_LIMIT

net x-output                             => hm2_5i25.0.7i77.0.1.analogout0
net x-pos-cmd    axis.0.motor-pos-cmd
net x-enable     axis.0.amp-enable-out
# enable _all_ sserial pwmgens
net x-enable   hm2_5i25.0.7i77.0.1.analogena

# ---Encoder feedback signals/setup---

setp    hm2_5i25.0.encoder.03.counter-mode 0
setp    hm2_5i25.0.encoder.03.filter 1
setp    hm2_5i25.0.encoder.03.index-invert 0
setp    hm2_5i25.0.encoder.03.index-mask 0
setp    hm2_5i25.0.encoder.03.index-mask-invert 0
setp    hm2_5i25.0.encoder.03.scale  [AXIS_0]ENCODER_SCALE

net x-pos-fb               <=  hm2_5i25.0.encoder.03.position
net x-vel-fb               <=  hm2_5i25.0.encoder.03.velocity
net x-pos-fb               =>  axis.0.motor-pos-fb
net x-index-enable    axis.0.index-enable  <=>  hm2_5i25.0.encoder.03.index-enable
net x-pos-rawcounts        <=  hm2_5i25.0.encoder.03.rawcounts

# ---setup home / limit switch signals---

net both-home-x     =>  axis.0.home-sw-in
net both-home-x     =>  axis.0.neg-lim-sw-in
net both-home-x     =>  axis.0.pos-lim-sw-in

#*******************
#  AXIS Y
#*******************

setp   pid.y.Pgain     [AXIS_1]P
setp   pid.y.Igain     [AXIS_1]I
setp   pid.y.Dgain     [AXIS_1]D
setp   pid.y.bias      [AXIS_1]BIAS
setp   pid.y.FF0       [AXIS_1]FF0
setp   pid.y.FF1       [AXIS_1]FF1
setp   pid.y.FF2       [AXIS_1]FF2
setp   pid.y.deadband  [AXIS_1]DEADBAND
setp   pid.y.maxoutput [AXIS_1]MAX_OUTPUT
setp   pid.y.error-previous-target true
setp   pid.y.maxerror .000

net y-index-enable  <=> pid.y.index-enable
net y-enable        =>  pid.y.enable
net y-pos-cmd       =>  pid.y.command
net y-vel-cmd       =>  pid.y.command-deriv
net y-pos-fb        =>  pid.y.feedback
net y-output        =>  pid.y.output

# ---PWM Generator signals/setup---

setp   hm2_5i25.0.7i77.0.1.analogout1-scalemax  [AXIS_1]OUTPUT_SCALE
setp   hm2_5i25.0.7i77.0.1.analogout1-minlim    [AXIS_1]OUTPUT_MIN_LIMIT
setp   hm2_5i25.0.7i77.0.1.analogout1-maxlim    [AXIS_1]OUTPUT_MAX_LIMIT

net y-output                             => hm2_5i25.0.7i77.0.1.analogout1
net y-pos-cmd    axis.1.motor-pos-cmd
net y-enable     axis.1.amp-enable-out

# ---Encoder feedback signals/setup---

setp    hm2_5i25.0.encoder.01.counter-mode 0
setp    hm2_5i25.0.encoder.01.filter 1
setp    hm2_5i25.0.encoder.01.index-invert 0
setp    hm2_5i25.0.encoder.01.index-mask 0
setp    hm2_5i25.0.encoder.01.index-mask-invert 0
setp    hm2_5i25.0.encoder.01.scale  [AXIS_1]ENCODER_SCALE

net y-pos-fb               <=  hm2_5i25.0.encoder.01.position
net y-vel-fb               <=  hm2_5i25.0.encoder.01.velocity
net y-pos-fb               =>  axis.1.motor-pos-fb
net y-index-enable    axis.1.index-enable  <=>  hm2_5i25.0.encoder.01.index-enable
net y-pos-rawcounts        <=  hm2_5i25.0.encoder.01.rawcounts

# ---setup home / limit switch signals---

net both-home-y     =>  axis.1.home-sw-in
net both-home-y     =>  axis.1.neg-lim-sw-in
net both-home-y     =>  axis.1.pos-lim-sw-in

#*******************
#  AXIS Z
#*******************

setp   pid.z.Pgain     [AXIS_2]P
setp   pid.z.Igain     [AXIS_2]I
setp   pid.z.Dgain     [AXIS_2]D
setp   pid.z.bias      [AXIS_2]BIAS
setp   pid.z.FF0       [AXIS_2]FF0
setp   pid.z.FF1       [AXIS_2]FF1
setp   pid.z.FF2       [AXIS_2]FF2
setp   pid.z.deadband  [AXIS_2]DEADBAND
setp   pid.z.maxoutput [AXIS_2]MAX_OUTPUT
setp   pid.z.error-previous-target true
setp   pid.z.maxerror .000

net z-index-enable  <=> pid.z.index-enable
net z-enable        =>  pid.z.enable
net z-pos-cmd       =>  pid.z.command
net z-vel-cmd       =>  pid.z.command-deriv
net z-pos-fb        =>  pid.z.feedback
net z-output        =>  pid.z.output

# ---PWM Generator signals/setup---

setp   hm2_5i25.0.7i77.0.1.analogout2-scalemax  [AXIS_2]OUTPUT_SCALE
setp   hm2_5i25.0.7i77.0.1.analogout2-minlim    [AXIS_2]OUTPUT_MIN_LIMIT
setp   hm2_5i25.0.7i77.0.1.analogout2-maxlim    [AXIS_2]OUTPUT_MAX_LIMIT

net z-output                             => hm2_5i25.0.7i77.0.1.analogout2
net z-pos-cmd    axis.2.motor-pos-cmd
net z-enable     axis.2.amp-enable-out

# ---Encoder feedback signals/setup---

setp    hm2_5i25.0.encoder.02.counter-mode 0
setp    hm2_5i25.0.encoder.02.filter 1
setp    hm2_5i25.0.encoder.02.index-invert 0
setp    hm2_5i25.0.encoder.02.index-mask 0
setp    hm2_5i25.0.encoder.02.index-mask-invert 0
setp    hm2_5i25.0.encoder.02.scale  [AXIS_2]ENCODER_SCALE

net z-pos-fb               <=  hm2_5i25.0.encoder.02.position
net z-vel-fb               <=  hm2_5i25.0.encoder.02.velocity
net z-pos-fb               =>  axis.2.motor-pos-fb
net z-index-enable    axis.2.index-enable  <=>  hm2_5i25.0.encoder.02.index-enable
net z-pos-rawcounts        <=  hm2_5i25.0.encoder.02.rawcounts

# ---setup home / limit switch signals---

net max-home-z     =>  axis.2.home-sw-in
net min-z          =>  axis.2.neg-lim-sw-in
net max-home-z     =>  axis.2.pos-lim-sw-in

#*******************
#  AXIS W
#*******************

# ---Encoder feedback signals/setup---

setp    hm2_5i25.0.encoder.00.counter-mode 0
setp    hm2_5i25.0.encoder.00.filter 1
setp    hm2_5i25.0.encoder.00.index-invert 0
setp    hm2_5i25.0.encoder.00.index-mask 0
setp    hm2_5i25.0.encoder.00.index-mask-invert 0
setp    hm2_5i25.0.encoder.00.scale  [AXIS_8]ENCODER_SCALE

net w-pos-fb               <=  hm2_5i25.0.encoder.00.position
net w-vel-fb               <=  hm2_5i25.0.encoder.00.velocity
#net w-pos-fb               =>  axis.4.motor-pos-fb
#net w-index-enable    axis.4.index-enable  <=>  hm2_5i25.0.encoder.00.index-enable
net w-pos-rawcounts        <=  hm2_5i25.0.encoder.00.rawcounts




#*******************
#  AXIS A
#*******************

setp   pid.a.Pgain     [AXIS_3]P
setp   pid.a.Igain     [AXIS_3]I
setp   pid.a.Dgain     [AXIS_3]D
setp   pid.a.bias      [AXIS_3]BIAS
setp   pid.a.FF0       [AXIS_3]FF0
setp   pid.a.FF1       [AXIS_3]FF1
setp   pid.a.FF2       [AXIS_3]FF2
setp   pid.a.deadband  [AXIS_3]DEADBAND
setp   pid.a.maxoutput [AXIS_3]MAX_OUTPUT
setp   pid.a.error-previous-target true
setp   pid.a.maxerror .000

net a-index-enable  <=> pid.a.index-enable
net a-enable        =>  pid.a.enable
net a-pos-cmd       =>  pid.a.command
net a-vel-cmd       =>  pid.a.command-deriv
net a-pos-fb        =>  pid.a.feedback
net a-output        =>  pid.a.output

# ---PWM Generator signals/setup---

setp   hm2_5i25.0.7i77.0.1.analogout3-scalemax  [AXIS_3]OUTPUT_SCALE
setp   hm2_5i25.0.7i77.0.1.analogout3-minlim    [AXIS_3]OUTPUT_MIN_LIMIT
setp   hm2_5i25.0.7i77.0.1.analogout3-maxlim    [AXIS_3]OUTPUT_MAX_LIMIT

net a-output     => hm2_5i25.0.7i77.0.1.analogout3
net a-pos-cmd    axis.3.motor-pos-cmd
net a-enable     axis.3.amp-enable-out

# ---Encoder feedback signals/setup---

setp    hm2_5i25.0.encoder.04.counter-mode 0
setp    hm2_5i25.0.encoder.04.filter 1
setp    hm2_5i25.0.encoder.04.index-invert 0
setp    hm2_5i25.0.encoder.04.index-mask 0
setp    hm2_5i25.0.encoder.04.index-mask-invert 0
setp    hm2_5i25.0.encoder.04.scale  [AXIS_3]ENCODER_SCALE

net a-pos-fb               <=  hm2_5i25.0.encoder.04.position
net a-vel-fb               <=  hm2_5i25.0.encoder.04.velocity
net a-pos-fb               =>  axis.3.motor-pos-fb
net a-index-enable    axis.3.index-enable  <=>  hm2_5i25.0.encoder.04.index-enable
net a-pos-rawcounts        <=  hm2_5i25.0.encoder.04.rawcounts

# ---setup home / limit switch signals---

net home-a     =>  axis.3.home-sw-in
net a-neg-limit     =>  axis.3.neg-lim-sw-in
net a-pos-limit     =>  axis.3.pos-lim-sw-in

#*******************
#  SPINDLE S
#*******************
setp   pid.s.Pgain     [SPINDLE_9]P
setp   pid.s.Igain     [SPINDLE_9]I
setp   pid.s.Dgain     [SPINDLE_9]D
setp   pid.s.bias      [SPINDLE_9]BIAS
setp   pid.s.FF0       [SPINDLE_9]FF0
setp   pid.s.FF1       [SPINDLE_9]FF1
setp   pid.s.FF2       [SPINDLE_9]FF2
setp   pid.s.deadband  [SPINDLE_9]DEADBAND
setp   pid.s.maxoutput [SPINDLE_9]MAX_OUTPUT
setp   pid.s.error-previous-target true
setp   pid.s.maxerror .0000

net spindle-index-enable  <=> pid.s.index-enable
net spindle-enable        =>  pid.s.enable
net spindle-vel-cmd-rpm-abs     => pid.s.command
net spindle-vel-fb-rpm-abs      => pid.s.feedback
net spindle-output        <=  pid.s.output

# ---PWM Generator signals/setup---

setp   hm2_5i25.0.7i77.0.1.analogout5-scalemax  [SPINDLE_9]OUTPUT_SCALE
setp   hm2_5i25.0.7i77.0.1.analogout5-minlim    [SPINDLE_9]OUTPUT_MIN_LIMIT
setp   hm2_5i25.0.7i77.0.1.analogout5-maxlim    [SPINDLE_9]OUTPUT_MAX_LIMIT

net spindle-output      => hm2_5i25.0.7i77.0.1.analogout5
net spindle-enable      => hm2_5i25.0.7i77.0.1.spinena

# ---Encoder feedback signals/setup---

setp    hm2_5i25.0.encoder.05.counter-mode 0
setp    hm2_5i25.0.encoder.05.filter 1
setp    hm2_5i25.0.encoder.05.index-invert 0
setp    hm2_5i25.0.encoder.05.index-mask 0
setp    hm2_5i25.0.encoder.05.index-mask-invert 0
setp    hm2_5i25.0.encoder.05.scale  [SPINDLE_9]ENCODER_SCALE

net spindle-revs             <=   hm2_5i25.0.encoder.05.position
net spindle-vel-fb-rps  abs.0.in     <=   hm2_5i25.0.encoder.05.velocity
net spindle-index-enable     <=>  hm2_5i25.0.encoder.05.index-enable

# ---setup spindle control signals---

net spindle-vel-cmd-rps        <=  motion.spindle-speed-out-rps
net spindle-vel-cmd-rps-abs    <=  motion.spindle-speed-out-rps-abs
net spindle-vel-cmd-rpm        <=  motion.spindle-speed-out
net spindle-vel-cmd-rpm-abs    <=  motion.spindle-speed-out-abs
net spindle-enable             <=  motion.spindle-on
net spindle-cw                 <=  motion.spindle-forward
net spindle-ccw                <=  motion.spindle-reverse
net spindle-brake              <=  motion.spindle-brake
net spindle-revs               =>  motion.spindle-revs
net spindle-at-speed           =>  motion.spindle-at-speed
net spindle-vel-fb-rps         =>  motion.spindle-speed-in
net spindle-index-enable      <=>  motion.spindle-index-enable

net spindle-cw          => hm2_5i25.0.7i77.0.0.output-04
net spindle-ccw          => hm2_5i25.0.7i77.0.0.output-05


net  spindle-vel-fb-rps-abs <= abs.0.out


# ---Setup spindle at speed signals---
net spindle-vel-cmd-rpm-abs    =>  near.0.in1
net spindle-vel-fb-rpm         =>  near.0.in2
net spindle-at-speed       <=  near.0.out
setp near.0.scale 1.000000
setp near.0.difference 75.0
setp mult2.0.in0 60
net spindle-vel-fb-rps-abs => mult2.0.in1
net spindle-vel-fb-rpm <= mult2.0.out



#  Use ACTUAL spindle velocity from spindle encoder
#  spindle-velocity bounces around so we filter it with lowpass
#  spindle-velocity is signed so we use absolute component to remove sign
#  ACTUAL velocity is in RPS not RPM so we scale it.

#setp     scale.spindle.gain 60
#setp     lowpass.spindle.gain 1.000000
#net spindle-vel-fb-rps        =>     scale.spindle.in
#net spindle-fb-rpm               scale.spindle.out       =>   abs.spindle.in
#net spindle-fb-rpm-abs           abs.spindle.out         =>   lowpass.spindle.in
#net spindle-fb-rpm-abs-filtered  lowpass.spindle.out 

#******************************
# connect miscellaneous signals
#******************************

#  ---HALUI signals---

net joint-select-a        halui.joint.0.select
net x-is-homed            halui.joint.0.is-homed
net jog-x-pos             halui.jog.0.plus
net jog-x-neg             halui.jog.0.minus
net jog-x-analog          halui.jog.0.analog
net joint-select-b        halui.joint.1.select
net y-is-homed            halui.joint.1.is-homed
net jog-y-pos             halui.jog.1.plus
net jog-y-neg             halui.jog.1.minus
net jog-y-analog          halui.jog.1.analog
net joint-select-c        halui.joint.2.select
net z-is-homed            halui.joint.2.is-homed
net jog-z-pos             halui.jog.2.plus
net jog-z-neg             halui.jog.2.minus
net jog-z-analog          halui.jog.2.analog
net joint-select-d        halui.joint.3.select
net a-is-homed            halui.joint.3.is-homed
net jog-a-pos             halui.jog.3.plus
net jog-a-neg             halui.jog.3.minus
net jog-a-analog          halui.jog.3.analog
net jog-selected-pos      halui.jog.selected.plus
net jog-selected-neg      halui.jog.selected.minus
net spindle-manual-cw     halui.spindle.forward
net spindle-manual-ccw    halui.spindle.reverse
net spindle-manual-stop   halui.spindle.stop
net machine-is-on         halui.machine.is-on
net jog-speed             halui.jog-speed 
net MDI-mode              halui.mode.is-mdi

#  ---coolant signals---

net coolant-mist      <=  iocontrol.0.coolant-mist
net coolant-flood     <=  iocontrol.0.coolant-flood

#  ---probe signal---

net probe-in     =>  motion.probe-input


# ---jog button signals---
net jog-speed  <=  hm2_5i25.0.7i84.0.2.analogin0
#sets    jog-speed .16
## MPG stuff##########

# ---jogwheel signals to mesa encoder - shared MPG---

net joint-selected-count     <=  hm2_5i25.0.7i84.0.2.enc0.count
setp    hm2_5i25.0.encoder.00.filter true
setp    hm2_5i25.0.encoder.00.counter-mode true

#  ---mpg signals---

#       for axis x MPG
setp    axis.0.jog-vel-mode 0
net selected-jog-incr    =>  axis.0.jog-scale
net joint-select-a       =>  axis.0.jog-enable
net joint-selected-count =>  axis.0.jog-counts

#       for axis y MPG
setp    axis.1.jog-vel-mode 0
net selected-jog-incr    =>  axis.1.jog-scale
net joint-select-b       =>  axis.1.jog-enable
net joint-selected-count =>  axis.1.jog-counts

#       for axis z MPG
setp    axis.2.jog-vel-mode 0
net selected-jog-incr    =>  axis.2.jog-scale
net joint-select-c       =>  axis.2.jog-enable
net joint-selected-count =>  axis.2.jog-counts

#       for axis a MPG
setp    axis.3.jog-vel-mode 0
net selected-jog-incr    =>  axis.3.jog-scale
net joint-select-d       =>  axis.3.jog-enable
net joint-selected-count =>  axis.3.jog-counts


##connect jog incr override increments
net jog-incr-a           =>  mux16.0.sel0
net jog-incr-b           =>  mux16.0.sel1
net jog-incr-c           =>  mux16.0.sel2
net jog-incr-d           =>  mux16.0.sel3
net selected-jog-incr   <=  mux16.0.out-f
    setp mux16.0.debounce-time      0.200000
    setp mux16.0.use-graycode      False
    setp mux16.0.suppress-no-input False
    setp mux16.0.in00          0.0001
    setp mux16.0.in01          0.001
    setp mux16.0.in02          .01
    setp mux16.0.in03          .1
    setp mux16.0.in04          1



# connect feed overide increments - switches

    setp halui.feed-override.count-enable true
    setp halui.feed-override.direct-value true
    setp halui.feed-override.scale .01
net feedoverride-incr   =>  halui.feed-override.counts
net fo-incr-a           =>  mux-gen.00.sel-bit-00
net fo-incr-b           =>  mux-gen.00.sel-bit-01
net fo-incr-c           =>  mux-gen.00.sel-bit-02
net fo-incr-d           =>  mux-gen.00.sel-bit-03
net fo-incr-e           =>  mux-gen.00.sel-bit-04
net feedoverride-incr   <=  mux-gen.00.out-s32
    setp mux-gen.00.debounce-us      200000
    setp mux-gen.00.suppress-no-input False
    setp mux-gen.00.in-s32-00          0
    setp mux-gen.00.in-s32-01          10
    setp mux-gen.00.in-s32-02          20
    setp mux-gen.00.in-s32-03          30
    setp mux-gen.00.in-s32-04          40
    setp mux-gen.00.in-s32-05          50
    setp mux-gen.00.in-s32-06          60
    setp mux-gen.00.in-s32-07          70
    setp mux-gen.00.in-s32-08          80
    setp mux-gen.00.in-s32-09          90
    setp mux-gen.00.in-s32-10          100
    setp mux-gen.00.in-s32-11          110
    setp mux-gen.00.in-s32-12          120
    setp mux-gen.00.in-s32-13          130
    setp mux-gen.00.in-s32-14          140
    setp mux-gen.00.in-s32-15          150
    setp mux-gen.00.in-s32-16          160
    setp mux-gen.00.in-s32-17          170
    setp mux-gen.00.in-s32-18          180
    setp mux-gen.00.in-s32-19          190
    setp mux-gen.00.in-s32-20          200

# connect max velocity overide increments - switches

    setp halui.max-velocity.count-enable true
    setp halui.max-velocity.direct-value true
    setp halui.max-velocity.scale 0.016670
net max-vel-override-incr   =>  halui.max-velocity.counts
net mvo-incr-a           =>  mux-gen.01.sel-bit-00
net mvo-incr-b           =>  mux-gen.01.sel-bit-01
net mvo-incr-c           =>  mux-gen.01.sel-bit-02
net mvo-incr-d           =>  mux-gen.01.sel-bit-03
net mvo-incr-e           =>  mux-gen.01.sel-bit-04
net max-vel-override-incr   <=  mux-gen.01.out-s32
    setp mux-gen.01.debounce-us      200000
    setp mux-gen.01.suppress-no-input False
    setp mux-gen.01.in-s32-00          0
    setp mux-gen.01.in-s32-01          2
    setp mux-gen.01.in-s32-02          4
    setp mux-gen.01.in-s32-03          6
    setp mux-gen.01.in-s32-04          8
    setp mux-gen.01.in-s32-05          10
    setp mux-gen.01.in-s32-06          12
    setp mux-gen.01.in-s32-07          14
    setp mux-gen.01.in-s32-08          16
    setp mux-gen.01.in-s32-09          18
    setp mux-gen.01.in-s32-10          20
    setp mux-gen.01.in-s32-11          25
    setp mux-gen.01.in-s32-12          30
    setp mux-gen.01.in-s32-13          35
    setp mux-gen.01.in-s32-14          40
    setp mux-gen.01.in-s32-15          45
    setp mux-gen.01.in-s32-16          50
    setp mux-gen.01.in-s32-17          55
    setp mux-gen.01.in-s32-18          60


# connect spindle overide increments 

    setp halui.spindle-override.count-enable true
    setp halui.spindle-override.direct-value true
    setp halui.spindle-override.scale .01
net spindleoverride-incr  =>  halui.spindle-override.counts
net so-incr-a             =>  mux16.3.sel0
net so-incr-b             =>  mux16.3.sel1
net so-incr-c             =>  mux16.3.sel2
net spindleoverride-incr  <=  mux16.3.out-s
    setp mux16.3.debounce-time      0.200000
    setp mux16.3.use-graycode      False
    setp mux16.3.suppress-no-input False
    setp mux16.3.in00          100.000000
    setp mux16.3.in01          90.000000
    setp mux16.3.in02          70.000000
    setp mux16.3.in03          80.000000
    setp mux16.3.in04          110.000000
    setp mux16.3.in05          120.000000
    setp mux16.3.in06          60.000000
    setp mux16.3.in07          50.000000
#  ---motion control signals---

net in-position               <=  motion.in-position
net machine-is-enabled        <=  motion.motion-enabled

#  ---digital in / out signals---

#  ---estop signals---

#  ---estop signals---

net estop-out	<= hm2_5i25.0.7i84.0.2.input-15

net estop-out     =>  iocontrol.0.emc-enable-in

#  ---manual tool change signals---

loadusr -W hal_manualtoolchange
net tool-change-request     iocontrol.0.tool-change       =>  hal_manualtoolchange.change
net tool-change-confirmed   iocontrol.0.tool-changed      <=  hal_manualtoolchange.changed
net tool-number             iocontrol.0.tool-prep-number  =>  hal_manualtoolchange.number
net tool-prepare-loopback   iocontrol.0.tool-prepare      =>  iocontrol.0.tool-prepared
[/code]
Last edit: 14 Nov 2016 23:54 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 03:51 #82759 by tommylight
Not my forte but,
You mention that the voltage changes from 17.xx to 24 on the input of mesa card, right?
Well that means you have only 2 wires from the potentiometer connected, or you have all 3 wires connected but at wrong places.
So, you have to connect the centre wire from the potentiometer to the input of the mesa card, the other 2 wires on the left and right on the potentiometer go: one to gnd and the other to +24V. That is if the analogue input on the mesa card is for 24V.
After you test and it works, only after it works see if it is correctly wired to up the speed as you turn it right. If not, just switch places of +24V and GND on the potentiometer. Do not under any circumstances wire the middle potentiometer pin to anything else except the analogue input on the card.
Just in case you find out that the potentiometer does not adjust speed linearly, check to see if it is a linear or logarithmic version, you need it to be linear. If it is linear and it still does not adjust properly, change the potentiometer, as that is a sure sign that it is fried due to miss wiring.
Phew, that should be all the possibilities of wiring a potentiometer .

Please Log in or Create an account to join the conversation.

More
14 Nov 2016 11:41 #82765 by andypugh

I can see the jog-speed vary in the Hal but no change in the jog-speed slider no the overall jog speed while moving a axis.


I am not particularly clear what you are trying to do, looking at the HAL.

You have a lot of mux components for setting the MPG jog rates. I assume that is working?
But, you also seem to be trying to use the analog input to set the keyboard(?) jog speed.

Which LinuxCNC GUI are you using? I don't know if any of them allow you to set the jog slider from an external input (because the on-screen slider has no way to do the reverse, move the physical knob)

Please Log in or Create an account to join the conversation.

More
15 Nov 2016 02:15 #82820 by Duc
Replied by Duc on topic Jog speed using potentiometer

I can see the jog-speed vary in the Hal but no change in the jog-speed slider no the overall jog speed while moving a axis.


I am not particularly clear what you are trying to do, looking at the HAL.

You have a lot of mux components for setting the MPG jog rates. I assume that is working?
But, you also seem to be trying to use the analog input to set the keyboard(?) jog speed.

Which LinuxCNC GUI are you using? I don't know if any of them allow you to set the jog slider from an external input (because the on-screen slider has no way to do the reverse, move the physical knob)


Using AXIS
All the mux are working fine MPG jog rates, spindle rpm and feed override. I see the slider change in AXIS gui when I adjust the knobs for those items. I do not see anything change for the jog-speed when I adjust the knob, only the I/O value for jog-speed and the analogin.0

I would like to use the knob to adjust the jog speed for when I use the keyboard to move the table around. The end game for the setup is a switch to turn a jog on like what is used on a manual mill equipped with a power drive unit.

Please Log in or Create an account to join the conversation.

More
15 Nov 2016 02:16 #82821 by Duc
Replied by Duc on topic Jog speed using potentiometer

Not my forte but,
You mention that the voltage changes from 17.xx to 24 on the input of mesa card, right?
Well that means you have only 2 wires from the potentiometer connected, or you have all 3 wires connected but at wrong places.
So, you have to connect the centre wire from the potentiometer to the input of the mesa card, the other 2 wires on the left and right on the potentiometer go: one to gnd and the other to +24V. That is if the analogue input on the mesa card is for 24V.
After you test and it works, only after it works see if it is correctly wired to up the speed as you turn it right. If not, just switch places of +24V and GND on the potentiometer. Do not under any circumstances wire the middle potentiometer pin to anything else except the analogue input on the card.
Just in case you find out that the potentiometer does not adjust speed linearly, check to see if it is a linear or logarithmic version, you need it to be linear. If it is linear and it still does not adjust properly, change the potentiometer, as that is a sure sign that it is fried due to miss wiring.
Phew, that should be all the possibilities of wiring a potentiometer .


Not sure why I forgot the 3rd leg but I will fix that once I have the I/O working.

Thanks

Please Log in or Create an account to join the conversation.

More
15 Nov 2016 18:19 #82841 by andypugh

Using AXIS
All the mux are working fine MPG jog rates, spindle rpm and feed override. I see the slider change in AXIS gui when I adjust the knobs for those items. I do not see anything change for the jog-speed when I adjust the knob.


There is a difference between an MPG and a potentiometer. A potentiometer is an absolute device and an MPG is a relative device.

This means that an MPG and a GUI slider can work together to alter a setting, this isn't possible with a potentiometer.

Would it be possible to use a small encoder in place of the potentiometer? There are some low-count ones available in the same form-factor as the pot. ( www.ebay.co.uk/itm/261857741214 ).
You can count those perfectly OK with a software encoder counter in HAL (running in the servo thread, you won't make 1000 clicks per second) if you have run out of MPG inputs on your cards.

Please Log in or Create an account to join the conversation.

More
18 Dec 2017 15:58 #103293 by Bello
Replied by Bello on topic Jog speed using potentiometer
so isn't possible to use a potentiometer on MPG?

Please Log in or Create an account to join the conversation.

More
18 Dec 2017 16:23 #103296 by andypugh

so isn't possible to use a potentiometer on MPG?


Everything is possible, but some things are difficult.

A potentiometer only turns through a limited range, how do you propose to deal with that?
Or do you want the pot to control jog speed? (and is so, how do you actually stop?)

Please Log in or Create an account to join the conversation.

More
18 Dec 2017 16:47 #103297 by Bello
Replied by Bello on topic Jog speed using potentiometer
I could use a joypad for example.
I'm trying to use it infact but I 'm in the same situation: I see in halmeter the correct value but the velocity not increasing....

Please Log in or Create an account to join the conversation.

More
18 Dec 2017 19:07 #103303 by Bello
Replied by Bello on topic Jog speed using potentiometer
I have 4 encoder in quadrature mode that are working fine.
The problem is that I cannot found a way to configure the halui.jog-speed dynamically using the max velocity value from halui.max-velocity.value.
I saw that halui.jog-speed is increasing following halui.max-velocity.value after I have se it as the following:

net jog-speed <= halui.max-velocity.value
net jog-speed halui.jog-speed

but I cannot see any increasing on the real speed machine.
Any idea?

Please Log in or Create an account to join the conversation.

Time to create page: 0.177 seconds
Powered by Kunena Forum