dá uma olhada Alebe
# Hal configuration file to move a cnc machine using a joypad using joyhandle component
# Copyright 2008 Paul Willutzki <paul[at]willutzki[dot]de>
# Licence: GPL
# Version 3
# This Hal-File needs the joyhandle component.
# This uses the following formula for a non linear joypad movements:
# y = (scale * (a*x^power + b*x)) + offset
#
# The parameters a and b are adjusted in such a way, that the function starts at (deadband,offset) and ends at (1,scale+offset).
# Negative values will be treated point symetrically to origin. Values -deadband < x < +deadband will be set to zero.
# Values x > 1 and x < -1 will be skipped to +-scale+offset. Negative scale values invert the movement.
# With power one can adjust the nonlinearity (default = 2).
# Default for deadband is 0.
# Valid values are: power >= 1.0 (reasonable values are 1.x .. 4-5), 0 <= deadband < 0.99 (reasonable 0.1). If you use high deadbands (>0.5) you need higher power values to smoothly start at (deadband,offset).
# The additional offset component can be set in special cases (default = 0).
# All values can be adjusted for each instance (joypad axis) separately.
# Please take also a look at the manpages for johandle.
# Insert the following lines in the INI-File (section [HAL])
# HALUI = halui
# HALFILE = joypad_V3.hal
# Explicações dos Botões e Comando
#
http://wiki.linuxcnc.org/emcinfo.pl?Using_A_Joypad_To_J og_And_Control_Spin dle_Speeds# Load the hal_input component that creates pins for axes and buttons
# See man hal_input for details and finding input devices
loadusr -W hal_input -KRAL USB
loadrt or2 count=2
loadrt mux4 count=1
addf or2.0 servo-thread
addf or2.1 servo-thread
addf mux4.0 servo-thread
setp mux4.0.in0 4000 # this one must be 0 to prevent motion unless a button is pressed
setp mux4.0.in1 500
setp mux4.0.in2 1500
net remote-speed-slow or2.0.in0 input.0.btn-top2
net remote-speed-medium or2.1.in0 input.0.btn-base
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
net joy-x-jog halui.jog.0.analog <= input.0.abs-x-position
loadrt sum2 count=2 # 1 for each axis you need to reverse, also check to make sure you don't all ready have sum2 loaded
addf sum2.0 servo-thread # in my case I needed to reverse the Y and Z axis
addf sum2.1 servo-thread
setp sum2.0.gain0 -1
net reverse-y sum2.0.in0 <= input.0.abs-y-position
net joy-y-jog halui.jog.1.analog <= sum2.0.out
setp sum2.1.gain0 -1
net reverse-z sum2.1.in0 <= input.0.abs-rx-position
net joy-z-jog halui.jog.2.analog <= sum2.1.out
# [BUTTON-SAMPLES] use your own joypad pin-names
#One button sample
#net spindleOff input.0.btn-base3 => halui.spindle.stop
#net spindleOn input.0.btn-base4 => halui.spindle.start
net remote-home-all halui.mdi-command-04 <= input.0.btn-trigger
net remote-tool-home halui.mdi-command-05 <= input.0.btn-thumb
net remote-zero-all halui.mdi-command-00 <= input.0.btn-thumb2
net remote-tool-change halui.mdi-command-06 <= input.0.btn-top
net remote-resume halui.program.resum
e <= input.0.btn-pinkie
net remote-stop halui.program.pause <= input.0.btn-base2
net remote-tool-autozero halui.mdi-command-08 <= input.0.btn-base3
net remote-start halui.program.run halui.mode.auto <= input.0.btn-base4
Obrigado pela ajuda Alebe.
Gostaria tb de agradecer a ajuda de todos do forum.
Valeu