SkyController3Gamepad

Gamepad peripheral interface for SkyController3devices.

This peripheral allows:

  • To receive events when physical inputs (buttons/axes) on the device are triggered.
  • To configure mappings between combinations of events produced by such physical inputs and predefined actions to execute or events to forward to the application when such combinations are triggered.
To start receiving events, buttons and/or axes must be grabbed and event listeners must be provided. When a gamepad input is grabbed, the remote control will stop forwarding events associated to this input to the connected drone (if any) and instead forward those events to the application-provided listener. Each input may produce at least one, but possibly multiple specific events, which is documented in Button for button inputs, and in Axis for axis inputs.

To stop receiving events, the input must be released, and by doing so the remote control will resume forwarding that input's events back to the connected drone instead. Alternatively the application can unregister its event listeners to stop receiving events from all grabbed inputs altogether. Note, however, that doing so does not release any input, so the drone still won't receive the grabbed input events.

To receive input events, the application must register some listener to which those events will be forwarded. Event listeners come in two kind, depending on the event to be listened to:

  • A button event listener that receives events from inputs producing button events. This listener also provides the physical state of the associated input, i.e. whether the associated button is pressed or released. Note that physical axes produce a button press event every time they reach the start or end of their course, and a button release event every time they quit that position.
  • A axis event listener that receives events from inputs producing axis events. This listener also provides the current value of the associated input, i.e. an int value in range [-100, 100] that represent the current position of the axis, where -100 corresponds to the axis at start of its course (left for horizontal axes, down for vertical axes), and 100 represents the axis at end of its course (right for horizontal axes, up for vertical axes).

A mapping defines a set of actions that may each be triggered by a specific combination of inputs events (buttons, and/or axes) produced by the remote control.

SkyController 3 remote control comes with default mappings for supported drone models. Those mappings can be edited and are persisted on the remote control device: entries can be modified, removed, and new entries can be added as well.

An entry in a mapping defines the association between such an action, the drone model on which it should apply, and the combination of input events that should trigger the action. Two different kind of entries are available:

This peripheral can be obtained from a SkyController3 RemoteControl using:
remoteControl.getPeripheral(SkyController3.class)

See also

Peripheral.Provider

Types

Link copied to clipboard
enum Axis
A physical axis input that can be grabbed on SkyController3 gamepad.
Link copied to clipboard
enum Button
A physical button input that can be grabbed on SkyController3 gamepad.

Functions

Link copied to clipboard
Gets the currently active drone model.
Link copied to clipboard
Gets all axis interpolators currently applied on a given drone model.
Link copied to clipboard
Gets currently grabbed axes.
Link copied to clipboard
Gets currently grabbed buttons.
Link copied to clipboard
Gets the current state of grabbed button-event-producing inputs.
Link copied to clipboard
abstract fun getMapping(@NonNull droneModel: Drone.Model): Set<MappingEntry>
Gets a drone model mapping.
Link copied to clipboard
Gets all currently reversed axis for a given drone model.
Link copied to clipboard
Gets the drone models supported by the remote control.
Link copied to clipboard
Grabs gamepad inputs.
Link copied to clipboard
abstract fun registerMappingEntry(@NonNull mappingEntry: MappingEntry)
Registers a mapping entry.
Link copied to clipboard
Resets all supported drone models' mappings to their default (built-in) value.
Link copied to clipboard
abstract fun resetDefaultMappings(@NonNull droneModel: Drone.Model)
Resets a drone model mapping to its default (built-in) value.
Link copied to clipboard
Reverses a gamepad axis.
Link copied to clipboard
Sets the application listener for axis events.
Link copied to clipboard
Sets the interpolation formula to be applied on an axis.
Link copied to clipboard
Sets the application listener for button events.
Link copied to clipboard
abstract fun unregisterMappingEntry(@NonNull mappingEntry: MappingEntry)
Unregisters a mapping entry.
Link copied to clipboard
Gives access to the volatile mapping setting.