How do we change what skeycontroller3 buttons do?

I am working in Android, and I would like to remap the left trigger button. Currently, it points the camera gimbal straight ahead. I would like to have it do something in my app (not change change the drone at all).

// This didn’t change anything:
var buttonEventSet = HashSet(1);
// All actions just to see if anything changes
buttonEventSet.add (ButtonEvent.FRONT_BOTTOM_BUTTON)
buttonEventSet.add (ButtonEvent.FRONT_TOP_BUTTON)
buttonEventSet.add (ButtonEvent.LEFT_SLIDER_DOWN)
buttonEventSet.add (ButtonEvent.LEFT_SLIDER_UP)
buttonEventSet.add (ButtonEvent.LEFT_STICK_DOWN)
buttonEventSet.add (ButtonEvent.LEFT_STICK_LEFT)
buttonEventSet.add (ButtonEvent.LEFT_STICK_RIGHT)
buttonEventSet.add (ButtonEvent.LEFT_STICK_UP)
buttonEventSet.add (ButtonEvent.REAR_LEFT_BUTTON)
buttonEventSet.add (ButtonEvent.REAR_RIGHT_BUTTON)
buttonEventSet.add (ButtonEvent.RIGHT_SLIDER_DOWN)
buttonEventSet.add (ButtonEvent.RIGHT_SLIDER_UP)
buttonEventSet.add (ButtonEvent.RIGHT_STICK_DOWN)
buttonEventSet.add (ButtonEvent.RIGHT_STICK_LEFT)
buttonEventSet.add (ButtonEvent.RIGHT_STICK_RIGHT)
buttonEventSet.add (ButtonEvent.RIGHT_STICK_UP)
val buttonsMappingEntry = ButtonsMappingEntry (Drone.Model.ANAFI_THERMAL, ButtonsMappableAction.APP_ACTION_10, buttonEventSet);

Any help would be appreciated.

We figured this out, just had to find the documentation page:
private fun monitorRcGamepad () {
if (rc != null) {
rcGamepadRef = rc!!.getPeripheral(SkyController3Gamepad::class.java) { gamepad →

            // If this is the first time into this callback, grab the rear left button
            if (gamepad != null) {
                if (gamepad.grabbedButtons.isEmpty()) {
                    val buttons = setOf(SkyController3Gamepad.Button.REAR_LEFT_BUTTON)
                    val axis = HashSet<SkyController3Gamepad.Axis>()
                    gamepad.grabInputs(buttons, axis)
                }

                // Set up listener callback for the grabbed button(s)
                gamepad.setButtonEventListener { event, state ->
                    // Handle real left button press
                    if (event == ButtonEvent.REAR_LEFT_BUTTON) {
                        when (state) {
                            ButtonEvent.State.PRESSED  -> {
                                println("rDebug rear right button PRESSED")
                            }
                            //ButtonEvent.State.RELEASED -> println ("rDebug rear right button RELEASED")
                        }
                    }
                }
            }
        }
    }
}
2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.