Joystick Node

From RoboPad Wiki
Jump to navigation Jump to search

← Return to Node Catalogue

Joystick Node
Inputs
    none
Outputs
  • x
  • y
Version Introduced
2.1

The Joystick Node is a UI Node that places a simulated dual-axis joystick on the controller. A joystick is a simple element that can can be dragged in two directions - up and down (the x axis) and left and right (the y axis). These values are reported out of Joystick node's x and y output ports as an x value, the position of the joystick from the left to the right, expressed as a number between 0 and 1, and the y value, the position of the joystick from the bottom to the top, again expressed as a number between 0 and 1.

Joystick Nodes were introduced in firmware version 2.1 along with all basic nodes.

The Joystick drive example robot uses a joystick as it's central input method - check that out for an example nodegraph!

Outputs

Joystick Nodes are very similar to Slider Nodes, but have an additional degree of freedom, meaning they can move in 2 axes. They are designed to mimic traditional dual-axis joystick found on a physical controller. Joystick Nodes have two output ports - x and y, reflective of the stick's position in the x axis and y axis of it's region of movement. Both outputs are emitted from 0 to 1 (clipped), every time the slider is moved when in the controller.

Settings

The Joystick Node's settings can be configured to alter it's visual presentation, mode of operation and output value mapping.

As a UI Node, the Joystick Node possesses the UI Transform and Background Colour settings. All UI Nodes draw to a region on the controller - this is an area that will be populated by the Joystick Node's display elements.

  • UI Transform: Configures the position of this Joystick Node's UI element within the controller. The Position x and y values control the position of the center of this element on the controller, from the bottom left (i.e. x and y values of 0 result in its center being in the bottom left, x and y values of 1 result in its center being in the top right). The Scale x and y values control the width and height of this Joystick Node's UI element, relative to the controller's width and height. Scaling occurs from the center of the Joystick.
  • Background Colour: Configures the background colour of this Joystick Node's UI region when it is drawn to the controller.
  • Stick Colour: Configures the colour of the stick of this joystick as it's seen in the controller.
  • X-Axis Release Behaviour: Configures what should happen to the stick when a held click or touch is released, but only along the x-axis - reset will result in the stick returning to it's x-axis (horizontal) Start Position when released - much like a spring-loaded self-centering joystick on a traditional physical controller, while hold will leave the stick in it's current position along the x-axis, similar to non-self-centering joysticks. Joysticks set to hold in the x-axis will render with three little vertical bars in the center of the stick.
  • Y-Axis Release Behaviour: This behaves identically to the X-Axis Release Behaviour, but along the y-axis (vertically).
  • X-Axis Start Position: This configures both the position the slider starts in along the x-axis (horizontally) and the position that it returns to if it's X-Axis Release Behaviour is set to reset.
  • Y-Axis Start Position: This behaves identically to the X-Axis Start Position, but along the y-axis (vertically).
  • Invert X Axis: This option inverts the output along the x-axis (horizontally). By default a fully leftwards stick position makes the output x port emit 0, and a fully right stick emits 1, however enabling this inverts that, with a stick position fully to the left emitting 1 and a fully right position emitting 0. Note that similar achievement could be achieved by using an Inverter Node on the x output port.
  • Invert Y Axis: This behaves identically to the Invert X Axis option, but inverts along the y-axis (vertically).

Gallery