Adding incremental jog to Simple Remote Pendant

More
06 Aug 2012 11:23 #22895 by Rick G
Rick G created the topic: Adding incremental jog to Simple Remote Pendant
I had a little time and decided to re work the joystick control on some of my machines (cnc router, knee mill and lathe).
Originally I added several features such as incremental jog, touch off, spindle control, etc.
Some of these, such as the incremental jog required a round about way when working on earlier versions of EMC2.
Now with the available new components such as toggle and halui pins like incremental jog it is easier.

Below shows John's Simple Remote Pendant with Incremental jog added.
## comments were added to show changes.

It has not been tested yet and needs some house keeping. I will add a beep to indicate which mode it is in for machines where it is not easy to see the monitor and a indicator on the panel.

It works as originally set up but now has 3 incremental jog settings (small, med. and large)

The incremental jogs require the sticks to be pushed all the way to activate to avoid accidentally jogging the wrong axis by not pushing the stick perfectly straight.

To toggle between continuous jog and incremental jog just hit the #4 button.



# Include your customized HAL commands here
# The commands in this file are run after the AXIS GUI (including PyVCP panel) starts
## for adding incremental moves to John's Joypad Simple Remote Pendant
## need linuxcnc 2.5 or better
## might want send signal to panel to indicate if continuous or incremental move

## change
#loadrt or2 count=2
#loadrt mux4 count=1

## to
loadrt or2 count=4
loadrt mux4 count=2
loadrt toggle count=1
loadrt near count=6
loadrt and2 count=6
loadrt mux2 count=3

addf or2.0 servo-thread
addf or2.1 servo-thread
addf mux4.0 servo-thread

## addf new components
addf or2.2 servo-thread
addf or2.3 servo-thread
addf mux4.1 servo-thread
addf toggle.0 servo-thread
addf mux2.0 servo-thread
addf mux2.1 servo-thread
addf mux2.2 servo-thread
addf near.0 servo-thread
addf near.1 servo-thread
addf near.2 servo-thread
addf near.3 servo-thread
addf near.4 servo-thread
addf near.5 servo-thread
addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf and2.4 servo-thread
addf and2.5 servo-thread

## use near for incremental jog moves, must push stick all the way for movement and to avoid unexpected movement by not
## pushing stick straight, sensitivity can be adjusted

setp near.0.in1 1
setp near.1.in1 1
setp near.2.in1 1
setp near.3.in1 -1
setp near.4.in1 -1
setp near.5.in1 -1

# set the jog speed for the joypad again use numbers that make sense for your machine
setp mux4.0.in0 0 # this one must be 0 to prevent motion unless a button is pressed
setp mux4.0.in1 25
setp mux4.0.in2 100
setp mux4.0.in3 200

## set the size of incremental moves
setp mux4.1.in0 0
setp mux4.1.in1 .001
setp mux4.1.in2 .005
setp mux4.1.in3 .010

# To reverse the direction of an axis add the following, for continuous mode only
setp input.0.abs-y-scale -127.5
setp input.0.abs-rz-scale -127.5

## add for toggle to toggle between continuous and incremental jog
net jog-inc toggle.0.in <= input.0.btn-top

# the following does the magic of setting the jog speeds

### change below for change of pin name from 2.n to 2.5
### net remote-speed-slow or2.0.in0 input.0.btn-trigger
### net remote-speed-slow or2.0.in0 input.0.btn-joystick

## change below from
#net remote-speed-slow or2.0.in0 input.0.btn-joystick
#net remote-speed-medium or2.1.in0 input.0.btn-thumb
#net remote-speed-fast or2.0.in1 or2.1.in1 input.0.btn-thumb2

## to
net remote-speed-slow or2.0.in0 or2.2.in0 input.0.btn-joystick
net remote-speed-medium or2.1.in0 or2.3.in0 input.0.btn-thumb
net remote-speed-fast or2.0.in1 or2.1.in1 or2.2.in1 or2.3.in1 input.0.btn-thumb2

net joy-speed-1 mux4.0.sel0 <= or2.0.out
net joy-speed-2 mux4.0.sel1 <= or2.1.out
net joy-speed-final halui.jog-speed <= mux4.0.out

## add
net jog-size-1 mux4.1.sel0 <= or2.2.out
net jog-size-2 mux4.1.sel1 <= or2.3.out
net jog-size-final halui.jog.0.increment halui.jog.1.increment halui.jog.2.increment <= mux4.1.out

## change below from
#net joy-x-jog halui.jog.0.analog <= input.0.abs-x-position
#net joy-y-jog halui.jog.1.analog <= input.0.abs-y-position
#net joy-z-jog halui.jog.2.analog <= input.0.abs-rz-position

## to
setp mux2.0.in1 0
setp mux2.1.in1 0
setp mux2.2.in1 0

## hook up the joysticks
net joy-x-sig mux2.0.in0 near.0.in2 near.3.in2 <= input.0.abs-x-position
net joy-y-sig mux2.1.in0 near.1.in2 near.4.in2 <= input.0.abs-y-position
net joy-z-sig mux2.2.in0 near.2.in2 near.5.in2 <= input.0.abs-rz-position

## send signal to analog jog if not in incremental jog mode
net joy-x-jog halui.jog.0.analog <= mux2.0.out
net joy-y-jog halui.jog.1.analog <= mux2.1.out
net joy-z-jog halui.jog.2.analog <= mux2.2.out


## toggle from continuous to incremental jogs
net joginc and2.0.in1 and2.1.in1 and2.2.in1 and2.3.in1 and2.4.in1 and2.5.in1 mux2.0.sel mux2.1.sel mux2.2.sel <= toggle.0.out

## if toggle is set for incremental and joystick is 1 or -1 make an incremental move

## hook up near outputs to and2. inputs
net jogincx and2.0.in0 <= near.0.out
net jogincy and2.1.in0 <= near.1.out
net jogincz and2.2.in0 <= near.2.out
net jogincxn and2.3.in0 <= near.3.out
net jogincyn and2.4.in0 <= near.4.out
net joginczn and2.5.in0 <= near.5.out

## and2 outputs to halui incremental jog
net jogincx_final halui.jog.0.increment-plus <= and2.0.out
net jogincy_final halui.jog.1.increment-plus <= and2.1.out
net jogincz_final halui.jog.2.increment-plus <= and2.2.out
net jogincxn_final halui.jog.0.increment-minus <= and2.3.out
net jogincyn_final halui.jog.1.increment-minus <= and2.4.out
net joginczn_final halui.jog.2.increment-minus <= and2.5.out
More
06 Aug 2012 11:28 - 06 Aug 2012 11:29 #22897 by BigJohnT
BigJohnT replied the topic: Re:Adding incremental jog to Simple Remote Pendant
Pretty cool Rick!

Did you add this to the wiki?

John
Last Edit: 06 Aug 2012 11:29 by BigJohnT.
More
07 Aug 2012 13:32 #22947 by Rick G
Rick G replied the topic: Re:Adding incremental jog to Simple Remote Pendant
Thanks John,

Have not updated the wiki yet, that is on my list of things to do.

I plan to do away with the original as it is so dated and replace it with one that details one feature at a time stating with the incremental jog.

Rick G
More
15 Aug 2012 09:23 - 17 Oct 2012 07:05 #23230 by Rick G
Rick G replied the topic: Re:Adding incremental jog to Simple Remote Pendant
As John pointed out in his original article the jog buttons only work in Manual mode.

In case you are in MDI mode and away from the keyboard when you want to jog the below line will allow you to switch to manual mode and jog with the joy pad. Just add it to your custom_postgui.hal and when you push the left stick straight down halui will switch to manual mode.

net halui-man-mode halui.mode.manual <= input.0.btn-base5

This will not change the display in AXIS, but will allow you to jog.


Another simple change, the below line will give you an estop button, I used the number 9 button.

net halui-estop halui.estop.activate <= input.0.btn-base3


Edit:
Another later version now does allow you to change AXIS from manual and MDI mode.

Rick G
Last Edit: 17 Oct 2012 07:05 by Rick G.
More
17 Oct 2012 07:02 #25395 by Rick G
Rick G replied the topic: Re:Adding incremental jog to Simple Remote Pendant
wiki.linuxcnc.org/cgi-bin/wiki.pl?Adding...imple_Remote_Pendant

Now has some updates with...

Three proportional speeds of jogging

Three incremental jog sizes

Buttons to switch from proportional to incremental jog and back

Set coordinate for each axis with G10, can be zero on whatever makes sense on your machine with audible feedback

Toggle coolant, spindle, etc. on and off with one set of buttons

Adjust spindle speed

Adjust feed rate

E stop

Buttons to Switch from Manual to MDI mode and back

Launch sub program such as Send machine home, first retract z to chosen position then send and x y home or another sub.

Start, Pause, Resume, and Stop buttons

Rick G
Time to create page: 0.071 seconds
Powered by Kunena Forum