Keyboard re-mapping (key binding)

More
12 Jun 2021 08:23 #211859 by probamo
Any advise?

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

More
12 Jun 2021 19:16 - 12 Jun 2021 19:24 #211882 by BigJohnT
What did you try?

Did you look at the axis.py code used for rapid jogging as an example?
github.com/LinuxCNC/linuxcnc/blob/master...scripts/axis.py#L210

JT
Last edit: 12 Jun 2021 19:24 by BigJohnT.

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

More
17 Nov 2022 06:52 #256917 by slidinghawk
I need to control the buttons on my 5 axis foam cutting machine.

I made changes to the axis file

beat so

print >>sys.stderr, "note: jog_order=%r" % jog_order
print >>sys.stderr, "note: jog_invert=%r" % jog_invert
bind_axis("Left", "Right", 0)
bind_axis("Down", "Up", 1)
bind_axis("Next", "Prior", 2)
bind_axis("KP_Left", "KP_Right", 0)
bind_axis("KP_Down", "KP_Up", 1)
bind_axis("KP_Next", "KP_Prior", 2)
bind_axis("KP_4", "KP_6", 0)
bind_axis("KP_2", "KP_8", 1)
bind_axis("KP_3", "KP_9", 2)
bind_axis("bracketleft", "bracketright", 3)

changed to this
print >>sys.stderr, "note: jog_order=%r" % jog_order
print >>sys.stderr, "note: jog_invert=%r" % jog_invert
bind_axis("Right", "Left", 0)
bind_axis("Down", "Up", 1)
#bind_axis("Prior", "Next", 2)
#bind_axis("Home", "End", 3)
#bind_axis("KP_Left", "KP_Right", 0 )
#bind_axis("KP_Down", "KP_Up", 1)
#bind_axis("KP_Next", "KP_Prior", 2)
#bind_axis("KP_Home", "KP_End", 3)
bind_axis("KP_6", "KP_4", 2)
bind_axis("KP_5", "KP_8", 3)
bind_axis("KP_7", "KP_9", 4)
#bind_axis("KP_7", "KP_1", 3)
#bind_axis("bracketleft", "bracketright", 3)

According to the axes "0=X", "1=Y" everything works as it should. When the button is pressed, the command is executed; when the button is released, the command is not executed.

On the axes "2=U", "3=V", "4=C" when the button is pressed, the command is executed. When the button is released, the command continues to be executed. when the button is pressed in the other direction, the command to move in the other direction begins to be executed.

When "SHift + KP_5" is pressed, the 3 jog PLUS command will stop running. And the same for other axes.

What else needs to be changed?
Attachments:

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

More
17 Nov 2022 23:36 #256986 by andypugh
It sounds like the key-up events are getting lost. But I don't know how to fix that.

Is there any possibility of fitting physical jog buttons? Those would operate in the real-time layer and will be much more reliable than relying on GUI key handling.

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

More
18 Nov 2022 01:37 #256998 by cakeslob
I did your mod in a usercommand file and tested it in axis_9axis sim. In the sim, Im not seeing the behavior on UV. The C axis kinda describes what you mean.

I think maybe it is based on your acceleration setting
Attachments:

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

More
18 Nov 2022 07:46 #257015 by slidinghawk
maximum speed 125.75 acceleration 750 on all axes is the same.

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

More
18 Nov 2022 07:52 #257016 by slidinghawk

It sounds like the key-up events are getting lost. But I don't know how to fix that.

Is there any possibility of fitting physical jog buttons? Those would operate in the real-time layer and will be much more reliable than relying on GUI key handling.


I have a manual encoder, and switches for 6 and 4 positions. I can buy an additional LPT port and connect an encoder and switches to it. I know how to set them up in mach3, but there will be a problem with Linux–°NC.

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

More
19 Nov 2022 01:44 #257088 by cakeslob
yeah, i did a test with your ini stuff and its not related to accel related, but Im still not getting the same behavior, although I am doing my test differently. lets split the difference on this

I did a python and made a thing for you, and anyone else who wants to edit the keys.

in the example I used to test it out, my keys and joint numbers might be different to yours, so you need to change it back to what ever you were doing. restore axis to its original state, and try out this user command file, and we can narrow down the issue. Ive included instructions and many examples, but here is the main part
##########################################################################################
##########     MODIFYING AXIS KEYBINDING MADE EASY BUT NOT TOO EASY   ##########
##########################################################################################


###   this file goes into the same folder as your config
###     add this line to your ini file, under the display section (without the #)
###     USER_COMMAND_FILE = usercommand_keybind.py

###   unbind a key first (if needed), then rebind  to your new thing, for example
###         the down key is unbound
#######    root_window.unbind('<Down>')
#          then rebind it to your new command
#          root_window.bind('<Down>', select_next)

####   this is for binding axis jog keys , the number at the end is the joint
#   bind right and left keys to joint 0, usually x
#   bind_axis("Right", "Left", 0)
#   bind down and up keys to joint 1, usually y
#   bind_axis("Down", "Up", 1)
Attachments:
The following user(s) said Thank You: slidinghawk

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

Time to create page: 0.109 seconds
Powered by Kunena Forum