Gamepad Node

From RoboPad Wiki
Jump to navigation Jump to search

← Return to Node Catalogue

NOTICE: Gamepad support is sporadic. Different web browsers and devices support different levels of access to hardware peripherals (such as gamepads). In particular, Firefox does not allow the use of Gamepads at all. See the "Browser Support" section for details. We are working to improve this node's ability to work with gamepads across all browsers and devices, however we cannot guarantee that your specific controller/device/browser combination will work. If you encounter issues, experiment with different web browsers and/or controllers.
Gamepad Node
Inputs
    none
Outputs
  • connected
  • [...axis]
  • [...buttons]
Version Introduced
2.4-b2

The Gamepad Input Node is a Node that can be configured to search for a specific physically attached gamepad controller which, upon finding, can be configured to transmit axis (analogue stick/trigger movements) and button signals into the nodegraph.

Gamepad Nodes were introduced in firmware version 2.4-b2.

Outputs

By default the Gamepad Node only has one output port - connected. This output port emits a low (0) initially, but then a high (1) when the node's configured gamepad is found.

Further outputs of the form axis a, axis b, axis c, etc as well as button a, button b, button c, etc that track the states of physical button bushes and analogue stick movements on the physical controller.

Note that axis signals will usually present between -1 and 1, while button signals will usually present between 0 and 1. Make sure you have fully understood the signals coming out of the node with your specific configuration before you connect any outputs to any physical actuators - it is recommended to attach the outputs to an Indicator Node first to check that you understand what signals the node is emitting.

Settings

The Gamepad Input Node's settings window starts out simply with only one configurable option and a button next to "Open Gamepad Selector". In this initial state, the button indicates whether or not the currently configured gamepad is found (by default, no gamepad is configured, so the button displays "gamepad "none" detected"). Clicking the button will open up the Gamepad Selector dialogue, which allows you to select a gamepad from a drop-down list of detected gamepads and also specify which buttons and axes are tracked on that gamepad (i.e. which ones this node will use as output ports). Because the Gamepad Selector requires the configured gamepad to be connected in order to list available axes and buttons, it will wipe all selected axis and buttons if you open it without the configured gamepad detected.

Note that detecting a gamepad can often require that not only is the gamepad plugged in, but also that a joystick has been moved, or a button pressed.

  • ID: Provides a drop-down box that lists all currently connected Gamepads by their unique vendor IDs. This will automatically select the currently configured gamepad's ID, or go to "none" if it cannot be found.
  • Buttons and Axes: A list of all buttons and axes available on the currently connected (and configured) gamepad. Each one can indpendently be selected with a checkbox on its left - check this checkbox will set that axis or button as an output port on the node in order to forward gamepad signals into the nodegraph. Make sure you read the "Outputs" section above to understand how these work.
  • Sample Rate (ms): The physical gamepad must be sampled at regular intervals to read the values of each of axes and buttons set to be emitted - this setting configures the interval that this happens at. A higher interval will result in higher percieved delay lag between interacting with a physical gamepad input and the node emitting a signal, while a lower interval will result in more responsive output emissions, but might cause lag within your web browser as it attempts to rapidly sample the gamepad.

Browser Support

Gamepad support is not very well standardised across mobile devices and web browsers. As a result, gamepads may sometimes not work or not be available to the RoboPad. All versions of firefox - both mobile and PC - do not allow RoboPad access to connected gamepads due to security concerns with allowing non-https site access to peripherals. Most other browsers either allow access directly, or may have a security setting that you are required to disable to allow access:

  • Chrome, Chromium: `#restrict-gamepad-access` found by visiting [chrome://flags chrome://flags] must be set to "Disabled".
  • Edge: `#restrict-gamepad-access` found by visiting [about:flags about:flags] must be set to "Disabled".
  • Opera: `#restrict-gamepad-access` found by visiting [opera://flags opera://flags] must be set to "Disabled".

Further, you can check whether your gamepad is compatible with the webgamepad API by visiting an online gamepad tester such as Hardware Tester's GamePad Tester.

Previous Versions

In firmware versions 2.4-b2 and 2.4-b3, this node had an "Index" setting, which let you specify which gamepad the node would connect to in the situation that there were more than one type of gamepad connected with the same unique vendor ID. This was to handle the case where multiple identical controllers were pulgged into a single phone/computer connected to a RoboPad. However, this was removed in 2.4-b4 onward, as it added extra confusion to the configuration process. This feature may be re-introduced in the future, but for now is considered deprecated.