ardrone-webflight icon indicating copy to clipboard operation
ardrone-webflight copied to clipboard

Add support for controlling via a gamepad

Open eschnou opened this issue 11 years ago • 5 comments

HTML5 Gamepad API: http://active.tutsplus.com/tutorials/games/an-introduction-to-the-html5-gamepad-api/

eschnou avatar May 30 '13 20:05 eschnou

I started working on this, then noticed this issue :)

You may want to consider moving some of backend piloting functionality from the pilot plugin into the core (via Cockpit), so it can be used by multiple plugins. Making movement happen in one place would also make it possible to add a conflict resolution strategy in the case of incompatible movement commands from different sources. Imagine pressing left arrow on the keyboard while I'm trying to yaw right on my gamepad--or even if one person in browser A is pressing "takeoff" while another person in browser B is pressing "land".

wiseman avatar May 31 '13 23:05 wiseman

I've got a first cut that does front/back/left/right/clockwise/counterClockwise at https://github.com/wiseman/webflight-gamepad

It works for my Logitech Extreme 3D Pro joystick and but I'll probably have to come up with some sort of mapping scheme for other devices. Roll and pitch (axes 0 & 1) should work on most devices but yaw (axis 5 on the Logitech) might have to be handled differently.

wiseman avatar Jun 01 '13 02:06 wiseman

@wiseman Good idea, I added issue #17 for this.

Great work on the gamepad plugin !! Being able to pilot via a joystick makes this baby looks a lot more like a truly functional Ground Control Station.

eschnou avatar Jun 01 '13 12:06 eschnou

pitch/roll/yaw/altitude control are all complete. I don't have another gamepad device to test with, unfortunately.

This seems small & core enough to consider putting into the webflight project itself.

wiseman avatar Jun 01 '13 22:06 wiseman

Great!! Don't have any joystick to try this, but this gave me a good excuse to buy one :-) It would be great to have this in the core indeed. I can just make a copy or you can send a PR.

eschnou avatar Jun 02 '13 20:06 eschnou