
# HAL for Logitech Joggy Thing 





#################################################### 

# Load realtime and userspace modules 



loadusr W hal_input KA Dual 



#loadrt logic count=1 personality=0x104 

loadrt constant count=13 

loadrt and2 count=17 

loadrt conv_float_s32 count=1 

loadrt flipflop count=4 

loadrt mux2 count=1 

loadrt mux4 count=5 

loadrt not count=8 

loadrt or2 count=13 

loadrt scale count=7 

loadrt timedelay count=1 

loadrt toggle count=1 





#################################################### 

# Hook functions into threads 



#addf logic.0 servothread 



addf constant.0 servothread 

addf constant.1 servothread 

addf constant.2 servothread 

addf constant.3 servothread 

addf constant.4 servothread 

addf constant.5 servothread 

addf constant.6 servothread 

addf constant.7 servothread 

addf constant.8 servothread 

addf constant.9 servothread 

addf constant.10 servothread 

addf constant.11 servothread 

addf constant.12 servothread 

addf and2.0 servothread 

addf and2.1 servothread 

addf and2.2 servothread 

addf and2.3 servothread 

addf and2.4 servothread 

addf and2.5 servothread 

addf and2.6 servothread 

addf and2.7 servothread 

addf and2.8 servothread 

addf and2.9 servothread 

addf and2.10 servothread 

addf and2.11 servothread 

addf and2.12 servothread 

addf and2.13 servothread 

addf and2.14 servothread 

addf and2.15 servothread 

addf and2.16 servothread 

addf convfloats32.0 servothread 

addf toggle.0 servothread 

addf flipflop.0 servothread 

addf flipflop.1 servothread 

addf flipflop.2 servothread 

addf flipflop.3 servothread 

addf timedelay.0 servothread 

addf or2.0 servothread 

addf or2.1 servothread 

addf or2.2 servothread 

addf or2.3 servothread 

addf or2.4 servothread 

addf or2.5 servothread 

addf or2.6 servothread 

addf or2.7 servothread 

addf or2.8 servothread 

addf or2.9 servothread 

addf or2.10 servothread 

addf or2.11 servothread 

addf or2.12 servothread 

addf not.0 servothread 

addf not.1 servothread 

addf not.2 servothread 

addf not.3 servothread 

addf not.4 servothread 

addf not.5 servothread 

addf not.6 servothread 

addf not.7 servothread 

addf scale.0 servothread 

addf scale.1 servothread 

addf scale.2 servothread 

addf scale.3 servothread 

addf scale.4 servothread 

addf scale.5 servothread 

addf scale.6 servothread 

addf mux2.0 servothread 

addf mux4.0 servothread 

addf mux4.1 servothread 

addf mux4.2 servothread 

addf mux4.3 servothread 

addf mux4.4 servothread 





#################################################### 

# Set constants 



setp constant.0.value 0.1 

setp constant.1.value 20 

setp constant.2.value [TRAJ]MAX_LINEAR_VELOCITY 

setp constant.3.value [TRAJ]MAX_ANGULAR_VELOCITY 

setp constant.4.value 60 

setp constant.5.value 0.50 

setp constant.6.value 1.00 

setp constant.7.value 0.10 

setp constant.8.value 0.10 

setp constant.9.value 0.0 

setp constant.10.value 1.0 

setp constant.11.value 0.020 

setp constant.12.value 0.000 





#################################################### 

# Connect Modules with nets 



# both rear top buttons for estop, bottom right to reset 



net estopa input.0.btntop2 and2.0.in0 

net estopb input.0.btnbase and2.0.in1 

net n_13 and2.0.out halui.estop.activate 



net resetestop input.0.btnbase2 halui.estop.reset 



# button to start manual mode (probably not needed with 2.8) 



net manualmode halui.mode.manual input.0.btnbase3 



net programresume halui.program.resume input.0.btnbase4 



net n_14 or2.3.in0 input.0.btnbase5 

net n_15 or2.3.in1 input.0.btnbase6 

net n_16 toggle.0.in or2.3.out 

net n_17 convfloats32.0.out input.0.absxflat input.0.absyflat input.0.abszflat input.0.absrzflat 

net n_18 constant.1.out convfloats32.0.in 

net n_19 constant.4.out scale.0.gain 

net n_20 constant.5.out scale.1.gain 

net n_21 constant.6.out scale.2.gain 

net n_22 constant.7.out scale.3.gain 

net n_23 scale.4.gain constant.8.out 

net n_24 constant.0.out halui.axis.jogdeadband 

net n_42 or2.7.in0 input.0.absxispos 

net n_43 or2.7.in1 input.0.absxisneg 

net n_44 or2.8.in0 input.0.absyispos 

net n_45 or2.8.in1 input.0.absyisneg 

net n_46 or2.9.in0 input.0.abszispos 

net n_47 or2.9.in1 input.0.abszisneg 

net n_48 or2.10.in0 input.0.absrzispos 

net n_49 or2.10.in1 input.0.absrzisneg 

net n_51 constant.10.out scale.5.gain scale.6.gain 

net n_57 and2.1.out halui.axis.x.minus halui.joint.0.minus 

net n_58 and2.2.out halui.axis.x.plus halui.joint.0.plus 

net n_59 and2.3.out halui.axis.y.minus halui.joint.1.minus 

net n_60 and2.4.out halui.axis.y.plus halui.joint.1.plus 

net n_61 and2.5.out halui.axis.z.minus halui.joint.2.minus 

net n_62 and2.6.out halui.axis.z.plus halui.joint.2.plus 

net n_63 and2.7.out halui.axis.a.minus halui.joint.3.minus 

net n_64 and2.8.out halui.axis.a.plus halui.joint.3.plus 



# sort out jog speeds 



net azbuttonsactive or2.1.out or2.12.in1 

net xybuttonsactive or2.5.out or2.12.in0 

net anybuttonsactive or2.12.out mux4.0.sel0 timedelay.0.in 



net n_54 constant.11.out timedelay.0.ondelay 

net n_55 constant.12.out timedelay.0.offdelay 

net n_56 timedelay.0.out and2.1.in1 and2.2.in1 and2.3.in1 and2.4.in1 and2.5.in1 and2.6.in1 and2.7.in1 and2.8.in1 



net jogcrawl toggle.0.out mux4.0.sel1 

net knobfast scale.1.out mux4.0.in0 scale.3.in 

net buttonfast scale.2.out mux4.0.in1 scale.4.in 

net knobcrawl scale.3.out mux4.0.in2 

net buttoncrawl scale.4.out mux4.0.in3 

net jogspeed mux4.0.out halui.axis.jogspeed halui.joint.jogspeed 



net angular_motion or2.11.out mux2.0.sel 

net n_25 constant.2.out mux2.0.in0 

net n_26 constant.3.out mux2.0.in1 

net velpersecond mux2.0.out scale.0.in 



net velperminute scale.0.out scale.1.in scale.2.in 



net azreset and2.14.out flipflop.2.reset flipflop.3.reset 

net xyreset and2.10.out flipflop.0.reset flipflop.1.reset 



# hold jog speed unchanged until machine turns on 

# mux S&H from https://wiki.linuxcnc.org/cgibin/wiki.pl?Simple_Remote_Pendant 



net jogmuxenable halui.machine.ison mux4.1.sel1 mux4.2.sel1 mux4.3.sel1 mux4.4.sel1 



net axisdisabledvalue constant.9.out mux4.1.in2 mux4.2.in2 mux4.3.in2 mux4.4.in2 



net xanalog mux4.1.out mux4.1.in0 mux4.1.in1 halui.axis.x.analog halui.joint.0.analog 

net yanalog mux4.2.out mux4.2.in0 mux4.2.in1 halui.axis.y.analog halui.joint.1.analog 

net zanalog mux4.3.out mux4.3.in0 mux4.3.in1 halui.axis.z.analog halui.joint.2.analog 

net aanalog mux4.4.out mux4.4.in0 mux4.4.in1 halui.axis.a.analog halui.joint.3.analog 



#net xampenable logic.0.in00 

#net yampenable logic.0.in01 

#net zampenable logic.0.in02 

#net aampenable logic.0.in03 



net xbuttonsactive or2.4.out or2.5.in0 

net xdisable not.4.out and2.12.in1 

net xenable flipflop.0.out not.4.in mux4.1.sel0 

net xhatminus or2.4.in1 input.0.abshat0xisneg and2.1.in0 

net xhatplus or2.4.in0 input.0.abshat0xispos and2.2.in0 

net xjog input.0.absxposition mux4.1.in3 

net xknobactive or2.7.out not.0.in and2.9.in0 

net xknobinactive not.0.out and2.10.in0 and2.11.in0 

net xset and2.9.out flipflop.0.set 



net ybuttonsactive or2.6.out or2.5.in1 

net ydisable not.5.out and2.9.in1 

net yenable flipflop.1.out not.5.in mux4.2.sel0 

net yhatminus or2.6.in1 input.0.abshat0yisneg and2.4.in0 

net yhatplus or2.6.in0 input.0.abshat0yispos and2.3.in0 

net yjog input.0.absyposition scale.5.in 

net yjogreversed scale.5.out mux4.2.in3 

net yknobactive not.1.in or2.8.out and2.11.in1 

net yknobinactive not.1.out and2.10.in1 

net yselect and2.12.in0 and2.11.out 

net yset flipflop.1.set and2.12.out 



net zbuttonminus or2.2.in0 input.0.btnthumb and2.5.in0 

net zbuttonplus or2.2.in1 input.0.btntop and2.6.in0 

net zbuttonsactive or2.2.out or2.1.in1 

net zdisable not.6.out and2.16.in1 

net zenable not.6.in flipflop.2.out mux4.3.sel0 

net zjog input.0.absrzposition scale.6.in 

net zjogreversed scale.6.out mux4.3.in3 

net zknobactive not.3.in or2.10.out and2.13.in0 

net zknobinactive not.3.out and2.15.in0 and2.14.in0 

net zset and2.13.out flipflop.2.set 



net abuttonminus or2.0.in0 input.0.btnjoystick and2.7.in0 

net abuttonplus or2.0.in1 input.0.btnthumb2 and2.8.in0 

net abuttonsactive or2.0.out or2.1.in0 or2.11.in1 

net adisable not.7.out and2.13.in1 

net aenable or2.11.in0 flipflop.3.out not.7.in mux4.4.sel0 

net ajog input.0.abszposition mux4.4.in3 

net aknobactive or2.9.out not.2.in and2.15.in1 

net aknobinactive not.2.out and2.14.in1 

net aselect and2.16.in0 and2.15.out 

net aset flipflop.3.set and2.16.out 