Feedoverride with Potentiometer
17 Oct 2019 08:13 #148091
by Aciera
Feedoverride with Potentiometer was created by Aciera
I have a potentiometer for feed-override installed on my machine panel. The value gets passed on to classicladder via modbus and reads from 0..1023. Now I connect this in the HAL to the halui.feed-override.counts and I can control the feedoverride slider in axis with the pot. The problem is that the value only changes in 10% increments and not in the desired 1% steps.
Any ideas?
Any ideas?
Please Log in or Create an account to join the conversation.
17 Oct 2019 08:25 #148092
by bevins
Replied by bevins on topic Feedoverride with Potentiometer
This is a bit more readable....
Warning: Spoiler!
# Generated by PNCconf at Sat Sep 14 11:24:43 2019
# Änderungen an dieser Datei werden beim nächsten
# overwritten when you run PNCconf again
loadrt trivkins
loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[TRAJ]AXES
loadrt hostmot2
loadrt hm2_eth board_ip="192.168.1.121" config=" num_encoders=4 num_pwmgens=0 num_stepgens=5 sserial_port_0=00xxxx"
setp hm2_7i76e.0.watchdog.timeout_ns 8000000
loadrt pid names=pid.x,pid.y,pid.z,pid.a,pid.s
loadrt classicladder_rt
loadrt scale names=scale.spindle,scale.feed
addf scale.feed servo-thread
loadrt conv_float_s32 names=conv_float_s32.feed,conv_float_s32.spindle
addf conv_float_s32.feed servo-thread
addf conv_float_s32.spindle servo-thread
addf classicladder.0.refresh servo-thread
loadusr -nogui classicladder --modmaster aciera.clp
net e-stop hm2_7i76e.0.7i76.0.0.input-31-not => halui.estop.activate
net WZ_release classicladder.0.out-00 => hm2_7i76e.0.7i76.0.0.output-09
net WZ_lock classicladder.0.out-01 => hm2_7i76e.0.7i76.0.0.output-10
#net Feed-override classicladder.0.s32out-00 => halui.feed-override.scale
# ---Potentiometer
setp halui.feed-override.count-enable TRUE
setp scale.feed.gain 0.01
setp halui.feed-override.direct-value TRUE
net feed-override-raw classicladder.0.floatout-00 => scale.feed.in
net feed-override-conv scale.feed.out => conv_float_s32.feed.in
net feed-override-set conv_float_s32.feed.out => halui.feed-override.counts
# -----
addf hm2_7i76e.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_7i76e.0.write servo-thread
setp hm2_7i76e.0.dpll.01.timer-us -50
setp hm2_7i76e.0.stepgen.timer-number 1
# ---Chargepump StepGen: 0.25 velocity = 10Khz square wave output---
setp hm2_7i76e.0.stepgen.04.dirsetup 100
setp hm2_7i76e.0.stepgen.04.dirhold 100
setp hm2_7i76e.0.stepgen.04.steplen 100
setp hm2_7i76e.0.stepgen.04.stepspace 100
setp hm2_7i76e.0.stepgen.04.position-scale 10000
setp hm2_7i76e.0.stepgen.04.step_type 2
setp hm2_7i76e.0.stepgen.04.control-type 1
setp hm2_7i76e.0.stepgen.04.maxaccel 0
setp hm2_7i76e.0.stepgen.04.maxvel 0
setp hm2_7i76e.0.stepgen.04.velocity-cmd 1.25
net x-enable => hm2_7i76e.0.stepgen.04.enable
# external output signals
# 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 .01
# Step Gen signals/setup
setp hm2_7i76e.0.stepgen.00.dirsetup [AXIS_0]DIRSETUP
setp hm2_7i76e.0.stepgen.00.dirhold [AXIS_0]DIRHOLD
setp hm2_7i76e.0.stepgen.00.steplen [AXIS_0]STEPLEN
setp hm2_7i76e.0.stepgen.00.stepspace [AXIS_0]STEPSPACE
setp hm2_7i76e.0.stepgen.00.position-scale [AXIS_0]STEP_SCALE
setp hm2_7i76e.0.stepgen.00.step_type 0
setp hm2_7i76e.0.stepgen.00.control-type 1
setp hm2_7i76e.0.stepgen.00.maxaccel [AXIS_0]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.00.maxvel [AXIS_0]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net x-index-enable pid.x.index-enable <=> axis.0.index-enable <=> hm2_7i76e.0.encoder.00.index-enable
net x-enable pid.x.enable => axis.0.amp-enable-out => hm2_7i76e.0.stepgen.00.enable
net x-pos-cmd axis.0.motor-pos-cmd => pid.x.command
net x-pos-fb pid.x.feedback <= hm2_7i76e.0.encoder.00.position => axis.0.motor-pos-fb
net x-output pid.x.output => hm2_7i76e.0.stepgen.00.velocity-cmd
net x-vel-fb <= hm2_7i76e.0.encoder.00.velocity
net x-pos-rawcounts <= hm2_7i76e.0.encoder.00.rawcounts
# ---Encoder feedback signals/setup---
setp hm2_7i76e.0.encoder.00.counter-mode 0
setp hm2_7i76e.0.encoder.00.filter 1
setp hm2_7i76e.0.encoder.00.index-invert 0
setp hm2_7i76e.0.encoder.00.index-mask 0
setp hm2_7i76e.0.encoder.00.index-mask-invert 0
setp hm2_7i76e.0.encoder.00.scale [AXIS_0]ENCODER_SCALE
# ---setup home / limit switch signals---
# --- MAX-X ---
net pos-x axis.0.pos-lim-sw-in <= hm2_7i76e.0.7i76.0.0.input-05
# --- BOTH-HOME-X ---
net both-home-x => axis.0.home-sw-in => axis.0.neg-lim-sw-in <= hm2_7i76e.0.7i76.0.0.input-04-not
#*******************
# 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 .01
# Step Gen signals/setup
setp hm2_7i76e.0.stepgen.01.dirsetup [AXIS_1]DIRSETUP
setp hm2_7i76e.0.stepgen.01.dirhold [AXIS_1]DIRHOLD
setp hm2_7i76e.0.stepgen.01.steplen [AXIS_1]STEPLEN
setp hm2_7i76e.0.stepgen.01.stepspace [AXIS_1]STEPSPACE
setp hm2_7i76e.0.stepgen.01.position-scale [AXIS_1]STEP_SCALE
setp hm2_7i76e.0.stepgen.01.step_type 0
setp hm2_7i76e.0.stepgen.01.control-type 1
setp hm2_7i76e.0.stepgen.01.maxaccel [AXIS_1]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.01.maxvel [AXIS_1]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net y-index-enable pid.y.index-enable <=> axis.1.index-enable <=> hm2_7i76e.0.encoder.01.index-enable
net y-enable pid.y.enable => axis.1.amp-enable-out => hm2_7i76e.0.stepgen.01.enable
net y-pos-cmd axis.1.motor-pos-cmd => pid.y.command
net y-pos-fb pid.y.feedback <= hm2_7i76e.0.encoder.01.position => axis.1.motor-pos-fb
net y-output pid.y.output => hm2_7i76e.0.stepgen.01.velocity-cmd
# ---Encoder feedback signals/setup---
setp hm2_7i76e.0.encoder.01.counter-mode 0
setp hm2_7i76e.0.encoder.01.filter 1
setp hm2_7i76e.0.encoder.01.index-invert 0
setp hm2_7i76e.0.encoder.01.index-mask 0
setp hm2_7i76e.0.encoder.01.index-mask-invert 0
setp hm2_7i76e.0.encoder.01.scale [AXIS_0]ENCODER_SCALE
# ---setup home / limit switch signals---
# --- MAX-Y ---
net neg-y axis.1.neg-lim-sw-in <= hm2_7i76e.0.7i76.0.0.input-07
# --- BOTH-HOME-Y ---
net both-home-y => axis.1.home-sw-in => axis.1.pos-lim-sw-in <= hm2_7i76e.0.7i76.0.0.input-06-not
#*******************
# 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 .01
# Step Gen signals/setup
setp hm2_7i76e.0.stepgen.02.dirsetup [AXIS_2]DIRSETUP
setp hm2_7i76e.0.stepgen.02.dirhold [AXIS_2]DIRHOLD
setp hm2_7i76e.0.stepgen.02.steplen [AXIS_2]STEPLEN
setp hm2_7i76e.0.stepgen.02.stepspace [AXIS_2]STEPSPACE
setp hm2_7i76e.0.stepgen.02.position-scale [AXIS_2]STEP_SCALE
setp hm2_7i76e.0.stepgen.02.step_type 0
setp hm2_7i76e.0.stepgen.02.control-type 1
setp hm2_7i76e.0.stepgen.02.maxaccel [AXIS_2]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.02.maxvel [AXIS_2]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net z-index-enable pid.z.index-enable <=> axis.2.index-enable <=> hm2_7i76e.0.encoder.02.index-enable
net z-enable pid.z.enable => axis.2.amp-enable-out => hm2_7i76e.0.stepgen.02.enable
net z-pos-cmd axis.2.motor-pos-cmd => pid.z.command
net z-pos-fb pid.z.feedback <= hm2_7i76e.0.encoder.02.position => axis.2.motor-pos-fb
net z-output pid.z.output => hm2_7i76e.0.stepgen.02.velocity-cmd
# ---Encoder feedback signals/setup---
setp hm2_7i76e.0.encoder.02.counter-mode 0
setp hm2_7i76e.0.encoder.02.filter 1
setp hm2_7i76e.0.encoder.02.index-invert 0
setp hm2_7i76e.0.encoder.02.index-mask 0
setp hm2_7i76e.0.encoder.02.index-mask-invert 0
setp hm2_7i76e.0.encoder.02.scale [AXIS_0]ENCODER_SCALE
# ---setup home / limit switch signals---
# --- MAX-Z ---
net neg-z axis.2.neg-lim-sw-in <= hm2_7i76e.0.7i76.0.0.input-09
# --- BOTH-HOME-Z ---
net both-home-z => axis.2.home-sw-in => axis.2.pos-lim-sw-in <= hm2_7i76e.0.7i76.0.0.input-08-not
#*******************
# 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 .0005
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
# Step Gen signals/setup
setp hm2_7i76e.0.stepgen.03.dirsetup [AXIS_3]DIRSETUP
setp hm2_7i76e.0.stepgen.03.dirhold [AXIS_3]DIRHOLD
setp hm2_7i76e.0.stepgen.03.steplen [AXIS_3]STEPLEN
setp hm2_7i76e.0.stepgen.03.stepspace [AXIS_3]STEPSPACE
setp hm2_7i76e.0.stepgen.03.position-scale [AXIS_3]STEP_SCALE
setp hm2_7i76e.0.stepgen.03.step_type 0
setp hm2_7i76e.0.stepgen.03.control-type 1
setp hm2_7i76e.0.stepgen.03.maxaccel [AXIS_3]STEPGEN_MAXACCEL
setp hm2_7i76e.0.stepgen.03.maxvel [AXIS_3]STEPGEN_MAXVEL
# ---closedloop stepper signals---
net a-pos-cmd <= axis.3.motor-pos-cmd
net a-vel-cmd <= axis.3.joint-vel-cmd
net a-output => hm2_7i76e.0.stepgen.03.velocity-cmd
net a-pos-fb <= hm2_7i76e.0.stepgen.03.position-fb
net a-pos-fb => axis.3.motor-pos-fb
net a-enable <= axis.3.amp-enable-out
net a-enable => hm2_7i76e.0.stepgen.03.enable
# ---setup home / limit switch signals---
net a-home-sw => 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
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
# ---digital potentionmeter output signals/setup---
setp hm2_7i76e.0.7i76.0.0.spinout-minlim [SPINDLE_9]OUTPUT_MIN_LIMIT
setp hm2_7i76e.0.7i76.0.0.spinout-maxlim [SPINDLE_9]OUTPUT_MAX_LIMIT
setp hm2_7i76e.0.7i76.0.0.spinout-scalemax [SPINDLE_9]OUTPUT_SCALE
net spindle-vel-cmd-rpm-abs => hm2_7i76e.0.7i76.0.0.spinout
net spindle-enable => hm2_7i76e.0.7i76.0.0.spinena
net spindle-ccw => hm2_7i76e.0.7i76.0.0.spindir
# ---Encoder feedback signals/setup---
setp hm2_7i76e.0.encoder.00.counter-mode 0
setp hm2_7i76e.0.encoder.00.filter 1
setp hm2_7i76e.0.encoder.00.index-invert 0
setp hm2_7i76e.0.encoder.00.index-mask 0
setp hm2_7i76e.0.encoder.00.index-mask-invert 0
setp hm2_7i76e.0.encoder.00.scale [SPINDLE_9]ENCODER_SCALE
#net spindle-revs <= hm2_7i76e.0.encoder.00.position
#net spindle-vel-fb-rps <= hm2_7i76e.0.encoder.00.velocity
#net spindle-index-enable <=> hm2_7i76e.0.encoder.00.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
# ---Setup spindle at speed signals---
sets spindle-at-speed true
#******************************
# 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
# ---motion control signals---
net in-position <= motion.in-position
net machine-is-enabled <= motion.motion-enabled
# ---digital in / out signals---
# ---estop signals---
net estop-out <= iocontrol.0.user-enable-out
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
Please Log in or Create an account to join the conversation.
17 Oct 2019 08:50 #148094
by cmorley
Replied by cmorley on topic Feedoverride with Potentiometer
might help to see the classiclader program so we know what is feeding the scale component
Chris
Chris
Please Log in or Create an account to join the conversation.
17 Oct 2019 11:13 #148108
by Aciera
Replied by Aciera on topic Feedoverride with Potentiometer
The classicladder programm is only the variable assignment "%QF0=%W0".
I can see the potmeter input in the HAL pin classicladder.0.floatout-00. Its fine going in but the halui.feed-override.counts only counts in whole numbers where 3 produces 30% override, 4 is 40% 5 is 50% and so on.
I dont understand how to get it to count in 1% increments since halui.feed-override.counts wants a s32 value.
Dave
I can see the potmeter input in the HAL pin classicladder.0.floatout-00. Its fine going in but the halui.feed-override.counts only counts in whole numbers where 3 produces 30% override, 4 is 40% 5 is 50% and so on.
I dont understand how to get it to count in 1% increments since halui.feed-override.counts wants a s32 value.
Dave
Please Log in or Create an account to join the conversation.
17 Oct 2019 11:40 #148111
by cmorley
Replied by cmorley on topic Feedoverride with Potentiometer
setp scale.feed.gain .001023
Try that
Try that
Please Log in or Create an account to join the conversation.
17 Oct 2019 17:04 #148127
by Aciera
Replied by Aciera on topic Feedoverride with Potentiometer
Thanks for the reply!
However, setting scale.feed.gain to .001023 lets me change the feedrate override only either 0 or 10 percent.
scale.feed.in changes from 0 to 1023
scale.feed.out changes from 0 to 1.05..
after the conv_float_s32 I only get 0 or 1
this then gets somehow multiplied by 10 and so I get 0% or 10%.
Where does this factor 10 come from?
However, setting scale.feed.gain to .001023 lets me change the feedrate override only either 0 or 10 percent.
scale.feed.in changes from 0 to 1023
scale.feed.out changes from 0 to 1.05..
after the conv_float_s32 I only get 0 or 1
this then gets somehow multiplied by 10 and so I get 0% or 10%.
Where does this factor 10 come from?
Please Log in or Create an account to join the conversation.
17 Oct 2019 22:56 #148155
by cmorley
Replied by cmorley on topic Feedoverride with Potentiometer
I have some more questions:
I don't see how classicladder gets the pot number - is that from modbus?
I don't see where you set the halui.feed-override.scale
in halui scale times counts = percentage
I don't see that you need the scale component.
send pot to classicladder
send out as a s32 to halui counts
set halui scale to scale counts from 0-100
Chris
I don't see how classicladder gets the pot number - is that from modbus?
I don't see where you set the halui.feed-override.scale
in halui scale times counts = percentage
I don't see that you need the scale component.
send pot to classicladder
send out as a s32 to halui counts
set halui scale to scale counts from 0-100
Chris
Please Log in or Create an account to join the conversation.
18 Oct 2019 08:30 #148174
by Aciera
Replied by Aciera on topic Feedoverride with Potentiometer
Thanks Chris!
I've tried your suggestion and sent the pot value as s32 to halui counts. However the problem remains. The halui counts value gets somehow multiplied by a factor of 10.
So halui conts value of 1 sets the feedrate override to 10%, a value of 10 results in 100%.
Anyway, I am now trying to get this working in gmoccapy.
I've tried your suggestion and sent the pot value as s32 to halui counts. However the problem remains. The halui counts value gets somehow multiplied by a factor of 10.
So halui conts value of 1 sets the feedrate override to 10%, a value of 10 results in 100%.
Anyway, I am now trying to get this working in gmoccapy.
Please Log in or Create an account to join the conversation.
18 Oct 2019 08:37 #148175
by cmorley
Replied by cmorley on topic Feedoverride with Potentiometer
What did you set halui.feed-override.scale to?
Chris
Chris
Please Log in or Create an account to join the conversation.
15 May 2020 14:00 #167844
by HansU
Replied by HansU on topic Feedoverride with Potentiometer
Interesting that this basically works on your system. I tried the same and the slider in the axis GUI is always jumping between the value set in axis an the value coming from the analog input. Does anyone have an idea about this behaviour?
Hans
Hans
Please Log in or Create an account to join the conversation.
Time to create page: 0.080 seconds