Setting Up Joypad buttons

More
29 Dec 2021 01:39 #230189 by AgentWD40
Following this guide wiki.linuxcnc.org/cgi-bin/wiki.pl?Simple_Remote_Pendant
with the exact same logitech f310 controller.

How would I go about configuring the start button, base4, to both zero x & y and then start the loaded gcode program? This is for a qtplasmac setup if that matters.

Please Log in or Create an account to join the conversation.

More
29 Dec 2021 15:17 - 29 Dec 2021 15:41 #230244 by AgentWD40
Replied by AgentWD40 on topic Setting Up Joypad buttons
Anyone have any guidance? I'm trying but I'm having a hard time following/understanding example hal files.

So far I gather this comes into play for touchoff
MDI_COMMAND = G10 L20 P0 X0 Y0

And then to cycle start would involve something like this:
net hal-joystart halui.program.run halui.mode.auto

source: wiki.linuxcnc.org/cgi-bin/wiki.pl?Adding...imple_Remote_Pendant

<edit>
Alright, I now understand that the MDI_COMMANDs need to be placed in the ini file in the HALUI section and they will be assigned pin names halui.mdi-command-XX where XX is the order number (base zero) in which the commands were placed in the ini.

input.0.btn-base4 is the "start" button

Is it even possible to string together the touch off and then the cycle start from one button push?
Last edit: 29 Dec 2021 15:41 by AgentWD40.

Please Log in or Create an account to join the conversation.

More
29 Dec 2021 16:29 #230251 by AgentWD40
Replied by AgentWD40 on topic Setting Up Joypad buttons
The water is getting slightly less murky. I've come up with the HAL code below to start the cycle. But the question remains can I zero x and y then start the cycle from the one button push? Is it even a good idea?
# feed joypad 'start' button to halui.mode.auto that is a pin for requestiong auto mode
net program-start-btn input.0.btn-base4 => halui.mode.auto 

# also feed the same signal into an and2 logic gate component/function
net program-start-btn and2.0.in0

# Send the status of is-auto into the and2 function as well
net program-run-ok halui.mode.is-auto => and2.0.in1

# When the output of the and2 component is true then start the cycle
# (in other words when the joypad start button is pressed and requesting
# auto mode AND is-auto says it's okay then start the program) 
net remote-program-run and2.0.out => halui.program.run



linuxcnc.org/docs/html/gui/halui.html
linuxcnc.org/docs/html/man/man1/hal_input.1.html
www.machinekit.io/docs/hal/halui_examples/
linuxcnc.org/docs/2.5/html/hal/halui_examples.html
linuxcnc.org/docs/html/man/man1/halui.1.html

Please Log in or Create an account to join the conversation.

More
04 Jan 2022 18:57 #230787 by AgentWD40
Replied by AgentWD40 on topic Setting Up Joypad buttons
Still no answer on the combining touch off then cycle start... but I got it working this way and I thought I'd share in case it helps anyone in the future.

The following will start a gcode program in qtplasmac if the user presses the 'Start' button
### SETUP START BUTTON TO RUN PROGRAM
loadrt and2 names=and2_start
loadrt or2 names=or2_start

addf and2_start servo-thread
addf or2_start servo-thread

# feed joypad 'start' button to halui.mode.auto that is a pin for requestiong auto mode
net program-start-btn input.0.btn-start => halui.mode.auto 

# also feed the same signal into an and2 logic gate component/function
net program-start-btn and2_start.in0

# Send the status of is-auto into the and2 function as well
net program-run-ok halui.mode.is-auto => and2_start.in1

# When the output of the and2 component is true then start the cycle
# (in other words when the joypad start button is pressed and requesting
# auto mode AND is-auto says it's okay then start the program) 
unlinkp halui.program.run #need to unlink the run pin that was setup in the main hal file by pncconf
net plasmac:program-run plasmac.program-run => or2_start.in0
net joypad-run and2_start.out => or2_start.in1
net cycle_start or2_start.out => halui.program.run

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum