# Program custom button input Logitech controller

**URL:** <https://discuss.bluerobotics.com/t/program-custom-button-input-logitech-controller/11034>\
**Category:** QGroundControl\
**Created:** [November 19, 2021, 1:57pm UTC](https://discuss.bluerobotics.com/t/program-custom-button-input-logitech-controller/11034 "2021-11-19T13:57:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![svenobot](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@svenobot](https://discuss.bluerobotics.com/u/svenobot)\
**Post date:** [November 19, 2021, 1:57pm UTC](https://discuss.bluerobotics.com/t/program-custom-button-input-logitech-controller/11034/1 "2021-11-19T13:57:47Z")

</div>

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? 🙂  
We are currently using the Logitech F310 controller.

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [November 22, 2021, 7:23am UTC](https://discuss.bluerobotics.com/t/program-custom-button-input-logitech-controller/11034/2 "2021-11-22T07:23:52Z")

</div>

Hi @svenobot, welcome to the forum 🙂

> [@svenobot](#):
>
> My team and I are working on a custom UI based on QGC for the BlueROV2.

Sounds like an interesting project! 🙂

> [@svenobot](#):
>
> 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?

QGC’s Joystick page has a [Button Assignment](https://www.ardusub.com/reference/ardusub/joystick-setup-page.html#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`](https://www.ardusub.com/developers/full-parameter-list.html#btnnfunction-function-for-button) 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 🙂

---

<div class="post-metadata">

**Author:** ![svenobot](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@svenobot](https://discuss.bluerobotics.com/u/svenobot)\
**Post date:** [November 23, 2021, 11:12am UTC](https://discuss.bluerobotics.com/t/program-custom-button-input-logitech-controller/11034/3 "2021-11-23T11:12:11Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [November 25, 2021, 4:17am UTC](https://discuss.bluerobotics.com/t/program-custom-button-input-logitech-controller/11034/4 "2021-11-25T04:17:34Z")

</div>

> [@svenobot](#):
>
> We specifically need to bind a controller input to an action in QGC.

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](https://github.com/bluerobotics/companion-docker/issues/689) 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](https://docs.qgroundcontrol.com/master/en/SetupView/Joystick.html) 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`](https://github.com/mavlink/qgroundcontrol/blob/master/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).
