set jog-scale from input pins
01 Oct 2022 11:10 - 01 Oct 2022 11:11 #253166
by furynick
set jog-scale from input pins was created by furynick
I searched for some time on forum and wiki but I can't figure out how to set jog-scale from a set of pins.
I would like to set a jog-scale value when a specific pin is enabled, eg.
I would like to set a jog-scale value when a specific pin is enabled, eg.
- input 1 => 0.01
- input 2 => 0.05
- input 3 => 0.1
- input 4 => 1
- input 5 => 10
I found an example using 3 or2 to "rebuild" an integer from 2 pins to feed mux input but I want to use a 5-pos selector and this technique seems very complex in this case.
I didn't find in man pages a way to convert a set of bit into an integer but I may have missed something.
Last edit: 01 Oct 2022 11:11 by furynick.
Please Log in or Create an account to join the conversation.
01 Oct 2022 12:25 #253170
by furynick
Replied by furynick on topic set jog-scale from input pins
Answering my own question, I found weighted_sum can do the job :
loadrt weighted_sum wsum_sizes=5
addf process_wsums servo-thread
net scale-sel-1 wsum.0.bit.0.in <= [HMOT](CARD0).7i73.0.1.input-11
net scale-sel-2 wsum.0.bit.1.in <= [HMOT](CARD0).7i73.0.1.input-12
net scale-sel-3 wsum.0.bit.2.in <= [HMOT](CARD0).7i73.0.1.input-13
net scale-sel-4 wsum.0.bit.3.in <= [HMOT](CARD0).7i73.0.1.input-14
net scale-sel-5 wsum.0.bit.4.in <= [HMOT](CARD0).7i73.0.1.input-15
setp wsum.0.bit.0.weight 1
setp wsum.0.bit.1.weight 2
setp wsum.0.bit.2.weight 3
setp wsum.0.bit.3.weight 4
setp wsum.0.bit.4.weight 5
setp wsum.0.offset -10 # Don't know why sum default to 10
net scale-conv <= wsum.0.sum
loadrt conv_s32_u32
addf conv-s32-u32.0 servo-thread
net scale-conv => conv-s32-u32.0.in
net scale-sel <= conv-s32-u32.0.out
loadrt mux_generic config="ff6"
addf mux-gen.00 servo-thread
setp mux-gen.00.suppress-no-input False
setp mux-gen.00.in-float-00 0.010000
setp mux-gen.00.in-float-01 0.050000
setp mux-gen.00.in-float-02 0.100000
setp mux-gen.00.in-float-03 0.500000
setp mux-gen.00.in-float-04 1.000000
setp mux-gen.00.in-float-05 10.000000
net jog-scale <= mux-gen.00.out-float
net scale-sel => mux-gen.00.sel-int
The following user(s) said Thank You: Aciera
Please Log in or Create an account to join the conversation.
01 Oct 2022 17:38 - 01 Oct 2022 17:41 #253191
by JPL
Replied by JPL on topic set jog-scale from input pins
Maybe have a look here too for a classic MPG 3 axes 3 step increments: linuxcnc.org/docs/devel/html/examples/mpg.html
This is using mux4 instead of weighted_sum to set the mpg/jog scale.
There's also a mux8 and a mux16 that you can use in a similar way.
This is using mux4 instead of weighted_sum to set the mpg/jog scale.
There's also a mux8 and a mux16 that you can use in a similar way.
Last edit: 01 Oct 2022 17:41 by JPL.
Please Log in or Create an account to join the conversation.
03 Oct 2022 12:02 #253339
by rodw
Replied by rodw on topic set jog-scale from input pins
Here is a 7 axis MPG with scale and axis select.
We only have 4 axes so some selections do other things.
We use Mux4 for scale select and mux8 for axis select.
Its really just an extension of the code in the docs linked earlier
We only have 4 axes so some selections do other things.
We use Mux4 for scale select and mux8 for axis select.
Its really just an extension of the code in the docs linked earlier
Warning: Spoiler!
# --- MPG JOG WHEELS FOR X AND Y AXIS ---
# ilowpass filter
setp ilowpass.0.scale 1
setp ilowpass.0.gain 0.01
# Setup Jog Pendant on each axis
setp axis.x.jog-vel-mode 0
setp axis.y.jog-vel-mode 0
setp axis.z.jog-vel-mode 0
# Scale Select
setp mux4.0.in0 0.0
setp mux4.0.in1 1.0
setp mux4.0.in2 0.01
setp mux4.0.in3 0.1
#Axis Select (0=off, 1=x, 2=z, 3=y, na, 5=6, 6=4, 7=5)
setp mux8.0.in0 0
setp mux8.0.in1 1
setp mux8.0.in2 2
setp mux8.0.in3 3
setp mux8.0.in4 4
setp mux8.0.in5 5
setp mux8.0.in6 6
setp mux8.0.in7 7
net mux8-sel0 <= hm2_7i76e.0.7i76.0.0.input-23
net mux8-sel1 <= hm2_7i76e.0.7i76.0.0.input-24
net mux8-sel2 <= hm2_7i76e.0.7i76.0.0.input-25
net mux8-sel0 => mux8.0.sel0
net mux8-sel1 => mux8.0.sel1
net mux8-sel2 => mux8.0.sel2
#setp conv-float-s32.0.clamp 0
net mux-float <= mux8.0.out
net mux-float => conv-float-s32.0.in
net mux-s32 <= conv-float-s32.0.out
net mux-s32 => select8.0.sel
net axis-select-x <= select8.0.out1
net axis-select-y <= select8.0.out3
net axis-select-z <= select8.0.out2
net axis-select-4 <= select8.0.out6
net axis-select-5 <= select8.0.out7
net axis-select-6 <= select8.0.out5
net axis-select-x => axis.x.jog-enable
net axis-select-y => axis.y.jog-enable
net axis-select-z => axis.z.jog-enable
net axis-select-4 => halui.feed-override.count-enable
net axis-select-6 => halui.rapid-override.count-enable
# Encoder counts
net jog-counter <= hm2_7i76e.0.7i76.0.0.enc0.count
net jog-counter => ilowpass.0.in
net smooth-counter <= ilowpass.0.out
#net jog-counter => axis.x.jog-counts
#net jog-counter => axis.y.jog-counts
#net jog-counter => axis.z.jog-counts
net smooth-counter => axis.x.jog-counts
net smooth-counter => axis.y.jog-counts
net smooth-counter => axis.z.jog-counts
net smooth-counter => halui.feed-override.counts
net smooth-counter => halui.rapid-override.counts
net mux4-sel1 <= hm2_7i76e.0.7i76.0.0.input-22
net mux4-sel0 <= hm2_7i76e.0.7i76.0.0.input-21
net mux4-sel1 => mux4.0.sel1
net mux4-sel0 => mux4.0.sel0
net jog-scale <= mux4.0.out
net jog-scale => axis.x.jog-scale
net jog-scale => axis.y.jog-scale
net jog-scale => axis.z.jog-scale
net jog-scale => halui.feed-override.scale
net jog-scale => halui.rapid-override.scale
The following user(s) said Thank You: my1987toyota
Please Log in or Create an account to join the conversation.
Time to create page: 0.066 seconds