Open ES-Alexander opened 1 year ago
That's the idea behind supporting generic / multiple controllers
The current interface for joysticks use the Gamepad API, so to work right away one would have to create a virtual joystick (very cumbersome), but we can extend the interface with something like what patrick suggested here.
@rafaellehmkuhl if I’m understanding correctly that PR effectively adds the keyboard as an input device, but doesn’t seem to include a more general input API as could be used by scripts communicating with custom input hardware, or even onscreen buttons added to cockpit, although I suppose they could both technically be mapped to pressing keyboard combinations if we really wanted to approach it that way (it just seems error-prone and not super intuitive).
Some form of action mapper abstraction layer would of course be necessary, as is already included in that PR :-)
While there are existing plans for arbitrary joystick and keyboard support, we should also consider some simple way of getting custom inputs (from software programs (e.g. a user's script on their control station computer) and hardware (e.g. anything that has some concept of buttons)) to work as triggers in Cockpit.
This project provides relevant context - the user wanted to make a custom controller with just two buttons for controlling some lights through QGC, and they needed to use a Joystick library to do so, and set up a fake calibration process just so QGC would accept inputs from it.