How to handle disconnected joystick
16 Jun 2019 19:49 #137056
by geertd
How to handle disconnected joystick was created by geertd
I managed to get LinuxCNC working on my CNC router, and wanted to try to connect a usb joystick I had no other use for.
Connection as such works fine with "loadusr hal_input.....". My problem is, that connecting the joystick was meant for occasional use, but starting linuxCNC when the joystick is not connected causes an error. This is not surprising since the loadusr hal_input does not find the device it is supposed to look for.
Is there a way to configure my system in such a way that it starts OK without the joystick connected, but with the possibility to connect it at a later point ?
I could imagine adding a button to my UI that triggers the loadusr hal_input when clicked, but have not found a way to do that.
Connection as such works fine with "loadusr hal_input.....". My problem is, that connecting the joystick was meant for occasional use, but starting linuxCNC when the joystick is not connected causes an error. This is not surprising since the loadusr hal_input does not find the device it is supposed to look for.
Is there a way to configure my system in such a way that it starts OK without the joystick connected, but with the possibility to connect it at a later point ?
I could imagine adding a button to my UI that triggers the loadusr hal_input when clicked, but have not found a way to do that.
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19217
- Thank you received: 6440
16 Jun 2019 22:44 #137068
by tommylight
Replied by tommylight on topic How to handle disconnected joystick
Never used them but, the easiest way would be to make two configs and start the one you need when you need them.
The following user(s) said Thank You: geertd
Please Log in or Create an account to join the conversation.
17 Jun 2019 05:42 #137094
by geertd
Replied by geertd on topic How to handle disconnected joystick
Yes, this is what I am doing right now. I was just wondering if there is another possibility.
Please Log in or Create an account to join the conversation.
17 Jun 2019 06:30 #137100
by cmorley
Replied by cmorley on topic How to handle disconnected joystick
you could write a python component that checks to see if the joystick pins are available and if they are connect them, other wise do nothing.
linuxcnc.org/docs/2.7/html/hal/halmodule.html
Chris M
linuxcnc.org/docs/2.7/html/hal/halmodule.html
Chris M
The following user(s) said Thank You: geertd
Please Log in or Create an account to join the conversation.
17 Jun 2019 08:43 #137107
by pl7i92
Replied by pl7i92 on topic How to handle disconnected joystick
you can also use a button that loads /reloads a postgui hal to include it during runtime
The following user(s) said Thank You: geertd
Please Log in or Create an account to join the conversation.
18 Jun 2019 20:46 - 18 Jun 2019 20:46 #137226
by geertd
Replied by geertd on topic How to handle disconnected joystick
Thanks cmorley, I had a look at the link to the python component manual. It probably is above my limited capacities. I know my way in python but can I use those userspace components for more than just creating input and output pins ? I guess, to check if the joystick pins are available, I first should try to load the "hal_input" within a try-except construct and from there on, if successful, define the rest of the connections to each of the joystick pins. Is it possible to do a "loadusr hal_input" within a python file ?
Last edit: 18 Jun 2019 20:46 by geertd.
Please Log in or Create an account to join the conversation.
18 Jun 2019 20:48 #137227
by geertd
Replied by geertd on topic How to handle disconnected joystick
Thanks, pl7i92. I will definitely give it a try. Did not know if one can still load postgui hal files during runtime.
Geert
Geert
Please Log in or Create an account to join the conversation.
20 Jun 2019 13:14 #137376
by andypugh
This sounds like a job for a hal Tcl file:
linuxcnc.org/docs/2.8/html/hal/haltcl.html
Replied by andypugh on topic How to handle disconnected joystick
you could write a python component that checks to see if the joystick pins are available and if they are connect them, other wise do nothing.
This sounds like a job for a hal Tcl file:
linuxcnc.org/docs/2.8/html/hal/haltcl.html
Please Log in or Create an account to join the conversation.
Time to create page: 0.079 seconds