Sky Controller3Gamepad
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 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:
- A buttons mapping entry allows to trigger a ButtonsMappableAction when the gamepad inputs produce some set of button events in the pressed state.
- A axis mapping entry allows to trigger an AxisMappableAction when the gamepad inputs produce some AxisEvent, optionally in conjunction with some set of button events in the pressed state.
SkyController3 RemoteControl
using: remoteControl.getPeripheral(SkyController3.class)