Ive been working on getting input devices other than the ps3 gamepad and wii controller working seeing as i have neither. What i do have is a cheap ps2 controller to usb adapter.
Ive successfully got this controller to work
UPDATE - Ive got all the basic controls mapped out so here goes
So to get any gamepad to work navigate to:/Examples/Linux/Navigation/Sources/UI
This is within the SDK.
Then open up 'gamepad.h' in any text editor.
It seems that the demo looks directly for the specific hardware referenced in this file so find the line that begins#define GAMEPAD_PLAYSTATION3_ID 0x046dc21a
It is the code in this line that refers to the usb gamepad, to find out the code to replace this with, plug in your desired gamepad and open up a terminal and typelsusb
This will give you a list of connected use devices. Find the description for your gamepad and in that line you will seeID YYYY:YYYY
Where the Y's are alphanumeric characters. This is your device, take the code add '0x' to the start and remove the colon so we would therefore have0xYYYYYYY
Now we want to replace the ID code in gamepad.h with this new code and hey presto the demo is now pointing towards your device. Next we need to know how to map the device.
To do this we need to install the joystick program, to do this in a terminal typesudo apt-get install joystick
Now we can find out what buttons correspond to what so typejstest /dev/input/js0
You will now get an output that will show you what buttons correspond to what number. You can then edit gamepad.h by adding the corresponding number to the button you want.
So for example if i press the start button on my controller i get an 'on' in the terminal for button 9.
So in gamepad.h i find the line that says PAD_START, and edit it to PS3BTN_START = 9,
Now if i make the program as shown in the first post on here when i press the start button the drone will launch, and pressing again the drone will land.
Im going to work on getting the whole thing mapped out but hopefully this will help other people to work it out.
UPDATE Heres a list of the corresponding keymappings for basic function
PS3BTN_SELECT - Emergency, Cuts motors
PS3BTN_START - Initiates take off and landing
PS3AXIS_STICK1_LR - Pitch Left/Right
PS3AXIS_STICK1_UD - Pitch Forward/Back
PS3AXIS_STICK2_LR - Yaw counter/clockwise
PS3AXIS_STICK2_US - Height Control
So just map each button and axes to the one that corresponds to your desired controlpad.
Im currently working on setting up some dead zones on the joysticks and working out how to reduce the sensitivity of the controls as they are very sensitive.
You can see my current testing setup
Ive tethered the drone at its 4 corners to some water bottles to prevent it running away as i had happen with some incorrectly assigned controls. Its actually really good for testing purposes.