Idea keyboard keybindings moving from pyton into c component

More
31 Aug 2018 20:33 #116926 by Grotius
Hi,

I was struggeling today with keybindings in python. It works, but it won't stop when i press a x axis move button,
and i miss a simple example. I dont't see the logic in python at the moment.

My idea is to make a component in c language where the keyboard button's are loaded for moving the following axis :
x,y,z,a,b,c,u,v,w,

This component can also be used for game consoles. Where we add double input's signal's. In fact 2 input channels.
But at this moment i have no experience how to make this in c.

Can this be a good idea for linuxcnc? Your personal opinion is usefull, alway's.

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

More
01 Sep 2018 07:09 #116942 by cmorley
getting keyboindings right is frustrating.
It won't matter what language you use.
The difficult problem is focus issues - if you are typing in an MDI window for instance, you don't want the machine to jog when you press cursor keys.

In general you should use the keybinding functions in what ever GUI toolkit your are using.
Typically you start jogging when the key is pressed and stop jogging when the key
is released.

AXIS Gscreen and Gmoccapy use python for jogging - quite successfully so it can be done.

USB game controllers (joysticks) are suported by hal_input

Chris M
The following user(s) said Thank You: Grotius

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

More
02 Sep 2018 14:43 #116975 by Grotius
Hi Chris,

I solved the problem. The x as is stopping when button is released by :
def on_keycall_XPOS(self,state,SHIFT,CNTRL,ALT):
        if state == 1:
            self.on_x_plus_pressed(state)
            return True

        if state == 0:
            self.on_x_plus_released(state)
            return True

I have done the keybindings thanks to your previous example : forum.linuxcnc.org/38-general-linuxcnc-q...ding-question#104268

Later on i will adapt the Home/End, Insert/Delete buttons for b and c axis.
For the coders, attached is the python file.
Attachments:

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

Time to create page: 0.101 seconds
Powered by Kunena Forum