Multiple hand wheel encoders
11 Feb 2016 04:01 #69974
by naz
Multiple hand wheel encoders was created by naz
Hello,
I'm still learning my way around hal and was curious if someone could post some pointers or some sample code for using multiple encoders. One for X and Z and multiple scaling for each input via 2 selectors switches. Trying to have machine with a manual machining mode via the hand encoders.
Thank you,
-Michael
I'm still learning my way around hal and was curious if someone could post some pointers or some sample code for using multiple encoders. One for X and Z and multiple scaling for each input via 2 selectors switches. Trying to have machine with a manual machining mode via the hand encoders.
Thank you,
-Michael
Please Log in or Create an account to join the conversation.
11 Feb 2016 12:41 #69989
by andypugh
Replied by andypugh on topic Multiple hand wheel encoders
The HAL pins you need are part of "motion"
linuxcnc.org/docs/2.7/html/man/man9/motion.9.html
For a shared encoder you would use one mpg connected to both axes and a select.
It is actually simpler with one wheel per axis.
The scaling can be done a number of ways. It is often easier to get it out of the GUI. For example with the Touchy GUI is it
The corresponding pin in the Axis ui is axisui.jog.increment.
If you prefer to select jog-speed with a physical switch then the mux components can be handy
linuxcnc.org/docs/2.7/html/man/man9/mux4.9.html
linuxcnc.org/docs/2.7/html/man/man9/motion.9.html
For a shared encoder you would use one mpg connected to both axes and a select.
net mpg-counts encoder.0.counts # as an example. Or hm2_7i84.0004.mpg1.counts, as another
net x-jog-sel parport.0.pin-01-in
net z-jog-sel parport.0.pin-01-in-not # only one pin, but using the complementaty outputs
...
net mpg-counts axis.0.jog-counts axis.2.jog-counts # connect the mpg to both axes
net x-jog-sel axis.0.jog-enable
net z-jog-sel axis.2.jog-enable
It is actually simpler with one wheel per axis.
net mpg-x encoder.0.counts
net mpg-z encoder.1.counts
...
net mpg-x axis.0.jog-counts
net mpg-z axis.2.jog-counts
setp axis.0.jog-enable 1
setp axis.2.jog-enable 1 # no need for a select pin
The scaling can be done a number of ways. It is often easier to get it out of the GUI. For example with the Touchy GUI is it
net jog-increment touchy.jog.wheel.increment axis.0.jog-scale axis.2.jog-scale
The corresponding pin in the Axis ui is axisui.jog.increment.
If you prefer to select jog-speed with a physical switch then the mux components can be handy
linuxcnc.org/docs/2.7/html/man/man9/mux4.9.html
Please Log in or Create an account to join the conversation.
12 Feb 2016 01:07 #70023
by naz
Replied by naz on topic Multiple hand wheel encoders
Great thanks that all helped and got first selection of things working like I wanted including using the mux4.0 and physical switch to change the feed rate. Next question that is probably simple again but I was just looking around to see if anyone has done it. Would it be possible to change those same encoders into spindle and feed overrides using a external switch to let linuxcnc know that it should change there function? Also just for other folks information added my jog.hal file.
-naz
-naz
Please Log in or Create an account to join the conversation.
12 Feb 2016 01:21 #70024
by andypugh
On a lathe it might make sense for the MPGs to be axis jogging in manual mode and feed overrides in Auto (G-code running) mode.
To do what you want, you need to connect each mpg to both "things" that it needs to do, like the one-mpg many-axis example.
But then you need to actively control the enable bit, rather than use the setp command as a one-off.
You need the spindle-override-counts and feed-override-counts from halui to make this work:
linuxcnc.org/docs/2.7/html/man/man1/halui.1.html
Replied by andypugh on topic Multiple hand wheel encoders
Great thanks that all helped and got first selection of things working like I wanted including using the mux4.0 and physical switch to change the feed rate. Next question that is probably simple again but I was just looking around to see if anyone has done it. Would it be possible to change those same encoders into spindle and feed overrides using a external switch to let linuxcnc know that it should change there function?
On a lathe it might make sense for the MPGs to be axis jogging in manual mode and feed overrides in Auto (G-code running) mode.
To do what you want, you need to connect each mpg to both "things" that it needs to do, like the one-mpg many-axis example.
But then you need to actively control the enable bit, rather than use the setp command as a one-off.
You need the spindle-override-counts and feed-override-counts from halui to make this work:
linuxcnc.org/docs/2.7/html/man/man1/halui.1.html
Please Log in or Create an account to join the conversation.
Time to create page: 0.072 seconds