Home        Store        Learn        Blog

Program custom button input Logitech controller

Hi everybody!

My team and I are working on a custom UI based on QGC for the BlueROV2.
We need a controller button input, so we can call a certain action.
At the moment, we can’t really find how to bind an action to a specific button press.
Can the button actions on the controller be changed? If so, how can we do it? :slight_smile:
We are currently using the Logitech F310 controller.

Thanks for the help!

Hi @svenobot, welcome to the forum :slight_smile:

Sounds like an interesting project! :slight_smile:

QGC’s Joystick page has a Button Assignment section where you can change the main and sub (shifted) functionality of each button. The available functionalities are determined by ArduSub’s BTNn_FUNCTION parameters (noting that some functionalities are left over from ArduSub’s initial split from ArduCopter, and aren’t used).

Hopefully that answers your question, but if not feel free to follow up with clarification :slight_smile:

1 Like

Hey Eliot!

First, thanks for the reply!

We checked the ArduSub docs and it didn’t provide the answers we are searching for.
The docs only provide information for controls when talking about the ArduSub module.
We specifically need to bind a controller input to an action in QGC. For example, when we hit the “B” button, we want to instantiate an UI element and show this element.

We digged deeper in the Joystick C++ files but could not find any answers. Is it possible to bind an input to a specific c++ method or QML action?

Thanks for the help!

Right, that’s functionality that does/can exist in QGC, but is disabled/hidden at the moment for vehicles that can be controlled with a Joystick. There’s a Github Issue about potentially re-enabling that (for a different purpose), but the proposal there is to hopefully come up with some kind of better system of mixing controls between QGC actions and vehicle actions from a single joystick, since it’s quite clunky at the moment.

That said, it does seem to function there, so if you want to try that approach you should hopefully also be able to add your own custom functionalities by copying the approach for the existing functionalities. The QGroundControl Joystick docs don’t seem to discuss the assignable functionalities much, but after a search on the QGroundControl github repo it seems like the src/Joystick/Joystick.cc file is where most of the relevant code is, although I expect you’ll also need to update Joystick.h, and possibly some other places (I’m not sure, as I haven’t needed to add something here before).

1 Like