After studing Manfredi's and Paul's joypad examples and after some hints from Alex Joni I was able to add a jog function to a joypad with little coding. The axis jog at a proportional speed to how far you push the stick and it is super easy to set up.
Some of this information was out of date as of version 2.8:
Use [Here] to learn how to identify your hal_input joypad and identify the available pins.
This is the joypad I used
The Logitech F310 supports 6 absolute axes and twelve buttons. See http://linuxcnc.org/docs/html/man/man1/hal_input.1.html for the full pin names for these axes and buttons.
Axes Names
Button Names
This wiki page shows how to connect joypad jogging for an xyz machine. HAL analog jog is slightly different for an xz lathe. To make things easier, I have attached three files. If you add these two of these files to your postgui list, you don't need to make any changes to your main configuration .ini or .hal. The first file is joystick_jog_speed.hal. The second file is determined by whether you want an xyz mill or xz lathe configuration. Keeping all your joypad .hal in separate files helps keep track of changes and allows you to simply remove the joypad from a configuration is it's not available.
upload:joystick_simple_remote_pendant.zip
The easiest way to succeed is to unzip these files into your configuration directory. Now look at the [HAL] section of your .ini file.
[HAL]
HALUI = halui
HALFILE = test.hal
HALFILE = custom.hal
POSTGUI_HALFILE = postgui_call_list.hal
Open up the POSTGUI_HALFILE and add the following two lines for an xyz machine
source joypad_jog_speed.hal source joypad_xyz_postgui.hal
or for an xz lathe:
source joypad_jog_speed.hal source joypad_xyz_postgui.hal
With a Logitech F310 and these changes you should be able to skip to Step 4 and begin enjoying your remote pendant jogging. If you have a different device, you may want to review the [Here] and follow through the steps modifying the files from the zip.
Enjoy JTrantow
# for remote joypad loadusr -W hal_input -KRAL Dual
HALUI = halui <b>TWOPASS = on<\b>
This feature makes the joypad safer to use as you must press one of three buttons before the joystick will move the machine.
Open joypad_jog_speed.hal.
You can change the jog speeds from {0.0, 1.0, 10.0, 100.0} to values relevant for your machine. The first value of 0.0 is used when no buttons are pressed. Don't change this. You can change the buttons that select the jog-speed by changing the net lines with input.0.btn-joystick/btn-thumb/btn-thumb2.
loadrt or2 names=joy_or2_sel0,joy_or2_sel1 loadrt mux4 names=joy_mux4
addf joy_or2_sel0 servo-thread addf joy_or2_sel1 servo-thread addf joy_mux4 servo-thread
# Set the jog speed for the joypad speed selection. Use numbers that make sense for your machine. setp joy_mux4.in0 0.0 # Setting this input to 0 prevents motion unless one of the other buttons is pressed. setp joy_mux4.in1 1.0 # Max jog speed when first speed select button is pressed. setp joy_mux4.in2 10.0 # Max jog speed when second speed select button is pressed. setp joy_mux4.in3 100.0 # Max jog speed when third speed select button is pressed.
# The following lines do the magic of setting the jog speed selection. You must hold at least one of the buttons while jogging. net slow <= joy_or2_sel0.in0 => input.0.btn-joystick # Button for selecting first jog speed. net medium <= joy_or2_sel1.in0 => input.0.btn-thumb # Button for selecting second jog speed. net fast <= joy_or2_sel0.in1 joy_or2_sel1.in1 => input.0.btn-thumb2 # Button for selecting third jog speed.
net joy-speed-sel0 <= joy_or2_sel0.out => joy_mux4.sel0 net joy-speed-sel1 <= joy_or2_sel1.out => joy_mux4.sel1
2.8 and later:
net jog-speed <= joy_mux4.out => halui.axis.jog-speed halui.joint.jog-speed
Older than 2.8:
net joy-speed-final <= mux4.0.out => halui.jog-speed
2.8 and later:
net joy-x-jog <= input.0.abs-x-position => halui.axis.x.analog halui.joint.0.analog net joy-y-jog <= input.0.abs-y-position => halui.axis.y.analog halui.joint.1.analog net joy-z-jog <= input.0.abs-rz-position => halui.axis.z.analog halui.joint.2.analog
Older than 2.8:
net joy-x-jog <= input.0.abs-x-position => halui.jog.0.analog net joy-y-jog <= input.0.abs-y-position => halui.jog.1.analog net joy-z-jog <= input.0.abs-rz-position => halui.jog.2.analog
setp input.0.abs-y-scale -127.5 setp input.0.abs-rz-scale -127.5
1 You must have the manual control tab selected for halui jog to work. It will not work when the MDI tab is selected
2 You must press and hold a number button then move the joystick to get movement.
This is the joypad I used
The Logitech F310 supports 6 absolute axes and twelve buttons. See http://linuxcnc.org/docs/html/man/man1/hal_input.1.html for the full pin names for these axes and buttons.
Axes Pin Names
Button Pin Names
Enjoy Big John T