USB XBox 360 controller
Forums:
I have a USB XBox 360 controller Im following your guide on Joyborg. When I run jstest /dev/input/js0 I get :
Driver version is 2.1.0.
Joystick (Microsoft X-Box 360 pad) has 8 axes (X, Y, Z, Rx, Ry, Rz, Hat0X, Hat0Y)
and 11 buttons (BtnX, BtnY, BtnTL, BtnTR, BtnTR2, BtnSelect, BtnThumbL, BtnThumbR, ?, ?, ?).
Testing ... (interrupt to exit)
Then the list of buttons / axes
When I press buttons / move sticks the numbers on the screen change and scroll. So I know its recongised and working.
Do I need to modify the JoyBorg.py script axis numbers, or are all XBox 360 controllers recognised the same by the driver and my controller should just work with the script by default ?
I ask because when I move a stick and try to see which numbers change on the screen, it seems extremely sensitive so Im having trouble working out which stick is which axis. The buttons are easy.
Is there an ccepted axis numbersing scheme for XBox360 controllers ? Do I need to change the JoyBorg.py file at all ?
Thank u.

piborg
Thu, 09/17/2015 - 18:41
Permalink
Xbox 360 button numbers
You will probably need to change the
axisLeftRight
value to4
as the axis numbers are slightly different for the Xbox controller from memory.This is the line that need to be changed:
# Settings for JoyBorg
leftDrive
=
DRIVE_1
# Drive number for left motor
rightDrive
=
DRIVE_4
# Drive number for right motor
axisUpDown
=
1
# Joystick axis to read for up / down position
axisUpDownInverted
=
False
# Set this to True if up and down appear to be swapped
axisLeftRight
=
4
# Joystick axis to read for left / right position
axisLeftRightInverted
=
False
# Set this to True if left and right appear to be swapped
interval
=
0.1
# Time between keyboard updates in seconds, smaller responds faster but uses more processor time
For reference I think these are the index numbers for the Xbox 360 controller:
0
---
1
---
---
8
3
---
4
---
---
9
---
0
---
1
---
2
---
3
2
---
---
4
5
---
---
5
---
6
---
7
The D-Pad uses the hat functionality instead of behaving like buttons, so it requires slightly different code.