InhaltTableOfContents |
What is it about
This howto explains the configuration of a gamepad (joystick) for the Axis GUI of [http://linuxcnc.org EMC2]. It allows to control the basic operations of a 3-axes machine without a keyboard. The following approach is based on the joystick module of an [http://x.org xorg] server. Thus it is applicable for Linux or *BSD systems.
- 3-axes machine
usually a [http://en.wikipedia.org/wiki/Milling_machine milling machine]
- EMC2
the most common [http://www.gnu.org/philosophy/free-sw.html free] machine controller software. It is used for turning toolpaths (GCode) into electric pulses for the drivers of the three axes.
- Axis
- one of the available graphical user interfaces of EMC2
- gamepad
- a small hand-held device with a few buttons and one or more joysticks. It is usually connected to a computer via USB, bluetooth or another serial connector.
Hardware
The following description is based on a gamepad labeled by Hama as Black Force. It is identified by lsusb with the following attributes:
Bus 002 Device 009: ID 0079:0006 DragonRise Inc. Generic USB Joystick
Preparing the system
You need to install the joystick module for your xorg server.
Debian or Ubuntu users should run the following command as root:
apt-get install xserver-xorg-input-joystick
Keycodes for useful Axis commands
You can use xmodmap -pke for determining the keycodes of the Axis hotkeys that you want to emit via the gamepad. The following selection should be a good starting point. See [http://www.linuxcnc.org/docs/2.4/html/gui_axis.html#r1_4 hotkeys of Axis] for a list of important keys to be used within Axis.
Action |
Hotkey |
Keycode |
move X axis forward |
right |
102 |
move X axis backward |
left |
100 |
move Y axis forward |
up |
98 |
move Y axis backward |
down |
104 |
move Z axis up |
page up |
99 |
move Z axis down |
page down |
105 |
home all axes |
home |
97 |
pause program |
p |
33 |
resume program |
s |
39 |
decrease jogging speed |
. (period) |
59 |
increase jogging speed |
, (comman) |
60 |
decrese jogging step size |
i |
31 |
increase jogging step size |
I |
50, 31 |
continuous jogging mode |
c |
54 |
select axis X (e.g. for defining an offset) |
x |
53 |
select axis Y |
y |
29 |
select axis Z |
z |
52 |
zero the offset of the current axis |
END |
103 |