bluerobotics / cockpit

An intuitive and customizable cross-platform ground control station for remote vehicles of all types.
https://blueos.cloud/docs/extensions/cockpit/1.0/overview
Other
55 stars 20 forks source link

Provide a mechanism for arbitrary input #246

Open ES-Alexander opened 1 year ago

ES-Alexander commented 1 year ago

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.

patrickelectric commented 1 year ago

That's the idea behind supporting generic / multiple controllers

rafaellehmkuhl commented 1 year ago

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.

ES-Alexander commented 1 year ago

@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 :-)