переделал под мои взгляд подвключение Joystick Logitech Attack3 для токарной станок,делюсь кому надо и исправляйте где потребуется. вот и кнопочки : В хал смотрим пиньй :
Код: Выделить всё
Digital: input.0.abs-x-is-neg
Digital: input.0.abs-x-is-pos
# input.0.abs-x-counts 0 < 127 > 255
Analog: input.0.abs-x-position ....-1< 0.00389 > 1
Digital: input.0.abs-y-is-neg
Digital: input.0.abs-y-is-pos
# input.0.abs-y-counts 0 /\
127
255 \/
Analog: input.0.abs-y-position
Digital: input.0.abs-z-is-neg /\
Digital: input.0.abs-z-is-pos \/
# input.0.abs-z-counts 0 /\
255 \/
Analog: input.0.abs-z-position
Digital: input.0.btn-base
Digital: input.0.btn-base-not
Digital: input.0.btn-base2
Digital: input.0.btn-base2-not
Digital: input.0.btn-base3
Digital: input.0.btn-base3-not
Digital: input.0.btn-base4
Digital: input.0.btn-base4-not
Digital: input.0.btn-base5
Digital: input.0.btn-base5-not
Digital: input.0.btn-joystick
Digital: input.0.btn-joystick-not
Digital: input.0.btn-pinkie
Digital: input.0.btn-pinkie-not
Digital: input.0.btn-thumb
Digital: input.0.btn-thumb-not
Digital: input.0.btn-thumb2
Digital: input.0.btn-thumb2-not
Digital: input.0.btn-top
Digital: input.0.btn-top-not
Digital: input.0.btn-top2
Digital: input.0.btn-top2-not
Код: Выделить всё
# Include your customized HAL commands here
# The commands in this file are run after the AXIS GUI (including PyVCP panel) starts
# sets spindle-at-speed true
loadrt and2 count=4
loadrt not count=2
loadrt comp count=4
loadrt constant count=5
loadrt conv_s32_float count=3
loadrt scale count=1
loadrt mux2 count=1
addf and2.0 servo-thread
addf and2.1 servo-thread
addf and2.2 servo-thread
addf and2.3 servo-thread
addf not.0 servo-thread
addf not.1 servo-thread
addf mux2.0 servo-thread
addf comp.0 servo-thread
addf comp.1 servo-thread
addf comp.2 servo-thread
addf comp.3 servo-thread
addf constant.0 servo-thread
addf constant.1 servo-thread
addf constant.2 servo-thread
addf constant.3 servo-thread
addf constant.4 servo-thread
addf conv-s32-float.0 servo-thread
addf conv-s32-float.1 servo-thread
addf conv-s32-float.2 servo-thread
addf scale.0 servo-thread
setp constant.0.value 0
setp constant.1.value 255
setp constant.2.value 5
setp constant.3.value 0
setp constant.4.value 2
net estop0 halui.estop.is-activated => not.0.in => and2.0.in0
net btn11 input.0.btn-base5 => and2.0.in1 => and2.1.in1
net Rststop and2.0.out => halui.estop.reset
net estop2 not.0.out => and2.1.in0
net Setstop and2.1.out => halui.estop.activate
net machon0 halui.machine.is-on => not.1.in => and2.2.in0
net btn10 input.0.btn-base4 => and2.2.in1 => and2.3.in1
net Rstmach and2.2.out => halui.machine.off
net machon2 not.1.out => and2.3.in0
net Setmach and2.3.out => halui.machine.on
net Xconv conv-s32-float.0.in <= input.0.abs-x-counts
net Yconv conv-s32-float.1.in <= input.0.abs-y-counts
net Zconv conv-s32-float.2.in <= input.0.abs-z-counts
net scaleinp conv-s32-float.2.out => scale.0.in
net scalegain constant.2.out => scale.0.gain
net scaleofs constant.3.out => scale.0.offset
net selspeed input.0.btn-joystick => mux2.0.sel
net speed1 constant.4.out => mux2.0.in0
net speed2 scale.0.out => mux2.0.in1
net Jogspeed mux2.0.out => halui.jog-speed
net zinp conv-s32-float.0.out => comp.0.in0 => comp.1.in0
net zneg2 constant.0.out => comp.0.in1 => comp.2.in1
net zneg3 comp.0.equal => halui.jog.2.minus
net zpos2 constant.1.out => comp.1.in1 => comp.3.in1
net zpos3 comp.1.equal => halui.jog.2.plus
net xinp conv-s32-float.1.out => comp.2.in0 => comp.3.in0
net xneg3 comp.2.equal => halui.jog.0.minus
net xpos3 comp.3.equal => halui.jog.0.plus
net SpindleStart input.0.btn-pinkie => halui.spindle.start
net SpindleStop input.0.btn-base => halui.spindle.stop
net programstep input.0.btn-top => halui.program.step
net programpause input.0.btn-top2 => halui.program.pause
net programrun input.0.btn-thumb2 => halui.program.run
net programstop input.0.btn-thumb => halui.program.stop
net manualmode input.0.btn-base2 => halui.mode.manual
net automode input.0.btn-base3 => halui.mode.auto
с медленая скорост setp constant.4.value 2 ,при етом с нажатием btn-joystick едем бьйстро с скорост регулируемая ( input.0.abs-z-counts )
и мащабирована в scale с setp constant.2.value 5.
При включения станка с нажатие кнопка 11 => halui.estop.reset ,второе нажатие => halui.estop.activate.
нажатие кнопка 10 => halui.machine.on;второе нажатие => halui.machine.off.
Другие кнопочки ,включение /вьйключение шпиндель ;пуск/стоп/пауза/степ УП.
Кнопки 8 и 9 вьйбираем ручной или автоматичной режим.
Тестировано на стенд,конфигурация на шаговьйе двигатели ,крутим только двигатели ,оси нет.
P.S.Чтоб появилис пиньй , в Pnc config вьйбираем работа с джойстик без назначения пинов ,а если конфиг под степ в хал добавляем:
loadusr -W hal_input -KRAL Logitech