RangeTrigger

class RangeTrigger @JvmOverloads constructor(loop: EventLoop = Trigger.defaultEventLoop, supplier: () -> Double) : Function0<Double>

A wrapper around an analog gamepad input (e.g. a trigger or joystick) that exposes range-based Triggers in addition to the raw value.

This allows you to bind analog inputs to command-based [Trigger]s based on their value, e.g. `gamepad.rightTrigger.isOver(0.5).onTrue(intakeCommand)`.

Constructors

Link copied to clipboard
constructor(loop: EventLoop = Trigger.defaultEventLoop, supplier: () -> Double)

Properties

Link copied to clipboard

The current value of the trigger.

Functions

Link copied to clipboard
open operator override fun invoke(): Double
Link copied to clipboard

Creates a trigger that is active while this input's value is within range (inclusive).

fun isBetween(lower: Double, upper: Double): Trigger

Creates a trigger that is active while this input's value is within lower, upper (inclusive).

Link copied to clipboard
fun isOver(threshold: Double): Trigger

Creates a trigger that is active while this input's value is greater than threshold.

Link copied to clipboard
fun isUnder(threshold: Double): Trigger

Creates a trigger that is active while this input's value is less than threshold.