2025-10-25 23:03:50 -07:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
2025-11-07 19:55:43 -05:00
|
|
|
package org.wpilib.driverstation;
|
2025-10-25 23:03:50 -07:00
|
|
|
|
2026-04-18 19:56:45 -07:00
|
|
|
import org.wpilib.driverstation.internal.DriverStationBackend;
|
2025-11-07 19:57:21 -05:00
|
|
|
import org.wpilib.event.BooleanEvent;
|
|
|
|
|
import org.wpilib.event.EventLoop;
|
2025-11-07 19:55:43 -05:00
|
|
|
import org.wpilib.hardware.hal.HAL;
|
2026-05-29 16:31:48 -07:00
|
|
|
import org.wpilib.math.util.MathUtil;
|
2025-11-07 19:55:43 -05:00
|
|
|
import org.wpilib.util.sendable.Sendable;
|
|
|
|
|
import org.wpilib.util.sendable.SendableBuilder;
|
2025-10-25 23:03:50 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handle input from Gamepad controllers connected to the Driver Station.
|
|
|
|
|
*
|
|
|
|
|
* <p>This class handles Gamepad input that comes from the Driver Station. Each time a value is
|
|
|
|
|
* requested the most recent value is returned. There is a single class instance for each controller
|
|
|
|
|
* and the mapping of ports to hardware buttons depends on the code in the Driver Station.
|
|
|
|
|
*
|
|
|
|
|
* <p>Only first party controllers from Generic are guaranteed to have the correct mapping, and only
|
|
|
|
|
* through the official NI DS. Sim is not guaranteed to have the same mapping, as well as any 3rd
|
|
|
|
|
* party controllers.
|
|
|
|
|
*/
|
|
|
|
|
public class Gamepad extends GenericHID implements Sendable {
|
2026-05-29 16:31:48 -07:00
|
|
|
private static final double MAX_DEADBAND = Math.nextDown(1.0);
|
|
|
|
|
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Represents a digital button on a Gamepad. */
|
|
|
|
|
public enum Button {
|
2026-05-26 21:55:07 -07:00
|
|
|
/** Face Down button. */
|
|
|
|
|
FACE_DOWN(0, "FaceDownButton"),
|
|
|
|
|
/** Face Right button. */
|
|
|
|
|
FACE_RIGHT(1, "FaceRightButton"),
|
|
|
|
|
/** Face Left button. */
|
|
|
|
|
FACE_LEFT(2, "FaceLeftButton"),
|
|
|
|
|
/** Face Up button. */
|
|
|
|
|
FACE_UP(3, "FaceUpButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Back button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
BACK(4, "BackButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Guide button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
GUIDE(5, "GuideButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Start button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
START(6, "StartButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Left stick button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
LEFT_STICK(7, "LeftStickButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Right stick button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
RIGHT_STICK(8, "RightStickButton"),
|
2026-02-07 10:39:22 -08:00
|
|
|
/** Left bumper button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
LEFT_BUMPER(9, "LeftBumperButton"),
|
2026-02-07 10:39:22 -08:00
|
|
|
/** Right bumper button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
RIGHT_BUMPER(10, "RightBumperButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** D-pad up button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
DPAD_UP(11, "DpadUpButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** D-pad down button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
DPAD_DOWN(12, "DpadDownButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** D-pad left button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
DPAD_LEFT(13, "DpadLeftButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** D-pad right button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
DPAD_RIGHT(14, "DpadRightButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Miscellaneous 1 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
MISC_1(15, "Misc1Button"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Right Paddle 1 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
RIGHT_PADDLE_1(16, "RightPaddle1Button"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Left Paddle 1 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
LEFT_PADDLE_1(17, "LeftPaddle1Button"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Right Paddle 2 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
RIGHT_PADDLE_2(18, "RightPaddle2Button"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Left Paddle 2 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
LEFT_PADDLE_2(19, "LeftPaddle2Button"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Touchpad button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
TOUCHPAD(20, "TouchpadButton"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Miscellaneous 2 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
MISC_2(21, "Misc2Button"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Miscellaneous 3 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
MISC_3(22, "Misc3Button"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Miscellaneous 4 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
MISC_4(23, "Misc4Button"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Miscellaneous 5 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
MISC_5(24, "Misc5Button"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Miscellaneous 6 button. */
|
2026-03-17 17:19:58 -07:00
|
|
|
MISC_6(25, "Misc6Button");
|
2025-10-25 23:03:50 -07:00
|
|
|
|
|
|
|
|
/** Button value. */
|
|
|
|
|
public final int value;
|
|
|
|
|
|
2026-03-17 17:19:58 -07:00
|
|
|
private final String m_name;
|
|
|
|
|
|
|
|
|
|
Button(int value, String name) {
|
2025-10-25 23:03:50 -07:00
|
|
|
this.value = value;
|
2026-03-17 17:19:58 -07:00
|
|
|
this.m_name = name;
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-03-17 17:19:58 -07:00
|
|
|
* Get the human-friendly name of the button, matching the relevant methods.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* <p>Primarily used for automated unit tests.
|
|
|
|
|
*
|
|
|
|
|
* @return the human-friendly name of the button.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return m_name;
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Represents an axis on an Gamepad. */
|
|
|
|
|
public enum Axis {
|
|
|
|
|
/** Left X axis. */
|
2026-03-17 17:19:58 -07:00
|
|
|
LEFT_X(0, "LeftX"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Left Y axis. */
|
2026-03-17 17:19:58 -07:00
|
|
|
LEFT_Y(1, "LeftY"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Right X axis. */
|
2026-03-17 17:19:58 -07:00
|
|
|
RIGHT_X(2, "RightX"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Right Y axis. */
|
2026-03-17 17:19:58 -07:00
|
|
|
RIGHT_Y(3, "RightY"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Left trigger. */
|
2026-03-17 17:19:58 -07:00
|
|
|
LEFT_TRIGGER(4, "LeftTriggerAxis"),
|
2025-10-25 23:03:50 -07:00
|
|
|
/** Right trigger. */
|
2026-03-17 17:19:58 -07:00
|
|
|
RIGHT_TRIGGER(5, "RightTriggerAxis");
|
2025-10-25 23:03:50 -07:00
|
|
|
|
|
|
|
|
/** Axis value. */
|
|
|
|
|
public final int value;
|
|
|
|
|
|
2026-03-17 17:19:58 -07:00
|
|
|
private final String m_name;
|
|
|
|
|
|
|
|
|
|
Axis(int value, String name) {
|
2025-10-25 23:03:50 -07:00
|
|
|
this.value = value;
|
2026-03-17 17:19:58 -07:00
|
|
|
this.m_name = name;
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-03-17 17:19:58 -07:00
|
|
|
* Get the human-friendly name of the axis, matching the relevant methods.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* <p>Primarily used for automated unit tests.
|
|
|
|
|
*
|
|
|
|
|
* @return the human-friendly name of the axis.
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public String toString() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return m_name;
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-29 16:31:48 -07:00
|
|
|
private double m_leftXDeadband = 0.1;
|
|
|
|
|
private double m_leftYDeadband = 0.1;
|
|
|
|
|
private double m_rightXDeadband = 0.1;
|
|
|
|
|
private double m_rightYDeadband = 0.1;
|
|
|
|
|
private double m_leftTriggerDeadband = 0.01;
|
|
|
|
|
private double m_rightTriggerDeadband = 0.01;
|
|
|
|
|
|
|
|
|
|
private static double clampDeadband(double deadband) {
|
|
|
|
|
if (Double.isNaN(deadband)) {
|
|
|
|
|
return 0.0;
|
|
|
|
|
}
|
|
|
|
|
return Math.clamp(deadband, 0.0, MAX_DEADBAND);
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-25 23:03:50 -07:00
|
|
|
/**
|
|
|
|
|
* Construct an instance of a controller.
|
|
|
|
|
*
|
|
|
|
|
* @param port The port index on the Driver Station that the controller is plugged into (0-5).
|
|
|
|
|
*/
|
|
|
|
|
public Gamepad(final int port) {
|
|
|
|
|
super(port);
|
|
|
|
|
HAL.reportUsage("HID", port, "Gamepad");
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-29 16:31:48 -07:00
|
|
|
/**
|
|
|
|
|
* Set the deadband for the left X axis.
|
|
|
|
|
*
|
|
|
|
|
* <p>The deadband is clamped to [0, 1).
|
|
|
|
|
*
|
|
|
|
|
* @param deadband The deadband to apply.
|
|
|
|
|
*/
|
|
|
|
|
public void setLeftXDeadband(double deadband) {
|
|
|
|
|
m_leftXDeadband = clampDeadband(deadband);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the deadband for the left Y axis.
|
|
|
|
|
*
|
|
|
|
|
* <p>The deadband is clamped to [0, 1).
|
|
|
|
|
*
|
|
|
|
|
* @param deadband The deadband to apply.
|
|
|
|
|
*/
|
|
|
|
|
public void setLeftYDeadband(double deadband) {
|
|
|
|
|
m_leftYDeadband = clampDeadband(deadband);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the deadband for the right X axis.
|
|
|
|
|
*
|
|
|
|
|
* <p>The deadband is clamped to [0, 1).
|
|
|
|
|
*
|
|
|
|
|
* @param deadband The deadband to apply.
|
|
|
|
|
*/
|
|
|
|
|
public void setRightXDeadband(double deadband) {
|
|
|
|
|
m_rightXDeadband = clampDeadband(deadband);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the deadband for the right Y axis.
|
|
|
|
|
*
|
|
|
|
|
* <p>The deadband is clamped to [0, 1).
|
|
|
|
|
*
|
|
|
|
|
* @param deadband The deadband to apply.
|
|
|
|
|
*/
|
|
|
|
|
public void setRightYDeadband(double deadband) {
|
|
|
|
|
m_rightYDeadband = clampDeadband(deadband);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the deadband for the left trigger axis.
|
|
|
|
|
*
|
|
|
|
|
* <p>The deadband is clamped to [0, 1).
|
|
|
|
|
*
|
|
|
|
|
* @param deadband The deadband to apply.
|
|
|
|
|
*/
|
|
|
|
|
public void setLeftTriggerDeadband(double deadband) {
|
|
|
|
|
m_leftTriggerDeadband = clampDeadband(deadband);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the deadband for the right trigger axis.
|
|
|
|
|
*
|
|
|
|
|
* <p>The deadband is clamped to [0, 1).
|
|
|
|
|
*
|
|
|
|
|
* @param deadband The deadband to apply.
|
|
|
|
|
*/
|
|
|
|
|
public void setRightTriggerDeadband(double deadband) {
|
|
|
|
|
m_rightTriggerDeadband = clampDeadband(deadband);
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-25 23:03:50 -07:00
|
|
|
/**
|
|
|
|
|
* Get the X axis value of left side of the controller. Right is positive.
|
|
|
|
|
*
|
2026-05-29 16:31:48 -07:00
|
|
|
* <p>A deadband of 0.1 is applied by default. Use {@link #setLeftXDeadband} to change it.
|
|
|
|
|
*
|
2025-10-25 23:03:50 -07:00
|
|
|
* @return The axis value.
|
|
|
|
|
*/
|
|
|
|
|
public double getLeftX() {
|
2026-05-29 16:31:48 -07:00
|
|
|
return MathUtil.applyDeadband(getAxis(Axis.LEFT_X), m_leftXDeadband);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the Y axis value of left side of the controller. Back is positive.
|
|
|
|
|
*
|
2026-05-29 16:31:48 -07:00
|
|
|
* <p>A deadband of 0.1 is applied by default. Use {@link #setLeftYDeadband} to change it.
|
|
|
|
|
*
|
2025-10-25 23:03:50 -07:00
|
|
|
* @return The axis value.
|
|
|
|
|
*/
|
|
|
|
|
public double getLeftY() {
|
2026-05-29 16:31:48 -07:00
|
|
|
return MathUtil.applyDeadband(getAxis(Axis.LEFT_Y), m_leftYDeadband);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the X axis value of right side of the controller. Right is positive.
|
|
|
|
|
*
|
2026-05-29 16:31:48 -07:00
|
|
|
* <p>A deadband of 0.1 is applied by default. Use {@link #setRightXDeadband} to change it.
|
|
|
|
|
*
|
2025-10-25 23:03:50 -07:00
|
|
|
* @return The axis value.
|
|
|
|
|
*/
|
|
|
|
|
public double getRightX() {
|
2026-05-29 16:31:48 -07:00
|
|
|
return MathUtil.applyDeadband(getAxis(Axis.RIGHT_X), m_rightXDeadband);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the Y axis value of right side of the controller. Back is positive.
|
|
|
|
|
*
|
2026-05-29 16:31:48 -07:00
|
|
|
* <p>A deadband of 0.1 is applied by default. Use {@link #setRightYDeadband} to change it.
|
|
|
|
|
*
|
2025-10-25 23:03:50 -07:00
|
|
|
* @return The axis value.
|
|
|
|
|
*/
|
|
|
|
|
public double getRightY() {
|
2026-05-29 16:31:48 -07:00
|
|
|
return MathUtil.applyDeadband(getAxis(Axis.RIGHT_Y), m_rightYDeadband);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the left trigger axis value of the controller. Note that this axis is bound to the range of
|
|
|
|
|
* [0, 1] as opposed to the usual [-1, 1].
|
|
|
|
|
*
|
2026-05-29 16:31:48 -07:00
|
|
|
* <p>A deadband of 0.01 is applied by default. Use {@link #setLeftTriggerDeadband} to change it.
|
|
|
|
|
*
|
2025-10-25 23:03:50 -07:00
|
|
|
* @return The axis value.
|
|
|
|
|
*/
|
|
|
|
|
public double getLeftTriggerAxis() {
|
2026-05-29 16:31:48 -07:00
|
|
|
return MathUtil.applyDeadband(getAxis(Axis.LEFT_TRIGGER), m_leftTriggerDeadband);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the axis value of the left trigger. The returned trigger
|
|
|
|
|
* will be true when the axis value is greater than {@code threshold}.
|
|
|
|
|
*
|
|
|
|
|
* @param threshold the minimum axis value for the returned {@link BooleanEvent} to be true. This
|
|
|
|
|
* value should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance that is true when the left trigger's axis exceeds the provided
|
|
|
|
|
* threshold, attached to the given event loop
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent leftTrigger(double threshold, EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return axisGreaterThan(Axis.LEFT_TRIGGER, threshold, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the axis value of the left trigger. The returned trigger
|
|
|
|
|
* will be true when the axis value is greater than 0.5.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance that is true when the left trigger's axis exceeds the provided
|
|
|
|
|
* threshold, attached to the given event loop
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent leftTrigger(EventLoop loop) {
|
|
|
|
|
return leftTrigger(0.5, loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the right trigger axis value of the controller. Note that this axis is bound to the range
|
|
|
|
|
* of [0, 1] as opposed to the usual [-1, 1].
|
|
|
|
|
*
|
2026-05-29 16:31:48 -07:00
|
|
|
* <p>A deadband of 0.01 is applied by default. Use {@link #setRightTriggerDeadband} to change it.
|
|
|
|
|
*
|
2025-10-25 23:03:50 -07:00
|
|
|
* @return The axis value.
|
|
|
|
|
*/
|
|
|
|
|
public double getRightTriggerAxis() {
|
2026-05-29 16:31:48 -07:00
|
|
|
return MathUtil.applyDeadband(getAxis(Axis.RIGHT_TRIGGER), m_rightTriggerDeadband);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the axis value of the right trigger. The returned trigger
|
|
|
|
|
* will be true when the axis value is greater than {@code threshold}.
|
|
|
|
|
*
|
|
|
|
|
* @param threshold the minimum axis value for the returned {@link BooleanEvent} to be true. This
|
|
|
|
|
* value should be in the range [0, 1] where 0 is the unpressed state of the axis.
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance that is true when the right trigger's axis exceeds the provided
|
|
|
|
|
* threshold, attached to the given event loop
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent rightTrigger(double threshold, EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return axisGreaterThan(Axis.RIGHT_TRIGGER, threshold, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the axis value of the right trigger. The returned trigger
|
|
|
|
|
* will be true when the axis value is greater than 0.5.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance that is true when the right trigger's axis exceeds the provided
|
|
|
|
|
* threshold, attached to the given event loop
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent rightTrigger(EventLoop loop) {
|
|
|
|
|
return rightTrigger(0.5, loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Read the value of the Face Down button on the controller.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceDownButton() {
|
|
|
|
|
return getButton(Button.FACE_DOWN);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Whether the Face Down button was pressed since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceDownButtonPressed() {
|
|
|
|
|
return getButtonPressed(Button.FACE_DOWN);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Whether the Face Down button was released since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceDownButtonReleased() {
|
|
|
|
|
return getButtonReleased(Button.FACE_DOWN);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-14 22:08:57 -07:00
|
|
|
* Constructs an event instance around the Face Down button's digital signal.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
2026-05-14 22:08:57 -07:00
|
|
|
* @return an event instance representing the Face Down button's digital signal attached to the
|
2025-10-25 23:03:50 -07:00
|
|
|
* given loop.
|
|
|
|
|
*/
|
2026-05-14 22:08:57 -07:00
|
|
|
public BooleanEvent faceDown(EventLoop loop) {
|
2026-05-26 21:55:07 -07:00
|
|
|
return button(Button.FACE_DOWN, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Read the value of the Face Right button on the controller.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceRightButton() {
|
|
|
|
|
return getButton(Button.FACE_RIGHT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Whether the Face Right button was pressed since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceRightButtonPressed() {
|
|
|
|
|
return getButtonPressed(Button.FACE_RIGHT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Whether the Face Right button was released since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceRightButtonReleased() {
|
|
|
|
|
return getButtonReleased(Button.FACE_RIGHT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-14 22:08:57 -07:00
|
|
|
* Constructs an event instance around the Face Right button's digital signal.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
2026-05-14 22:08:57 -07:00
|
|
|
* @return an event instance representing the Face Right button's digital signal attached to the
|
2025-10-25 23:03:50 -07:00
|
|
|
* given loop.
|
|
|
|
|
*/
|
2026-05-14 22:08:57 -07:00
|
|
|
public BooleanEvent faceRight(EventLoop loop) {
|
2026-05-26 21:55:07 -07:00
|
|
|
return button(Button.FACE_RIGHT, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Read the value of the Face Left button on the controller.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceLeftButton() {
|
|
|
|
|
return getButton(Button.FACE_LEFT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Whether the Face Left button was pressed since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceLeftButtonPressed() {
|
|
|
|
|
return getButtonPressed(Button.FACE_LEFT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Whether the Face Left button was released since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceLeftButtonReleased() {
|
|
|
|
|
return getButtonReleased(Button.FACE_LEFT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-14 22:08:57 -07:00
|
|
|
* Constructs an event instance around the Face Left button's digital signal.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
2026-05-14 22:08:57 -07:00
|
|
|
* @return an event instance representing the Face Left button's digital signal attached to the
|
2025-10-25 23:03:50 -07:00
|
|
|
* given loop.
|
|
|
|
|
*/
|
2026-05-14 22:08:57 -07:00
|
|
|
public BooleanEvent faceLeft(EventLoop loop) {
|
2026-05-26 21:55:07 -07:00
|
|
|
return button(Button.FACE_LEFT, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Read the value of the Face Up button on the controller.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceUpButton() {
|
|
|
|
|
return getButton(Button.FACE_UP);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Whether the Face Up button was pressed since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceUpButtonPressed() {
|
|
|
|
|
return getButtonPressed(Button.FACE_UP);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-26 21:55:07 -07:00
|
|
|
* Whether the Face Up button was released since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
2026-05-26 21:55:07 -07:00
|
|
|
public boolean getFaceUpButtonReleased() {
|
|
|
|
|
return getButtonReleased(Button.FACE_UP);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-05-14 22:08:57 -07:00
|
|
|
* Constructs an event instance around the Face Up button's digital signal.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
2026-05-14 22:08:57 -07:00
|
|
|
* @return an event instance representing the Face Up button's digital signal attached to the
|
2025-10-25 23:03:50 -07:00
|
|
|
* given loop.
|
|
|
|
|
*/
|
2026-05-14 22:08:57 -07:00
|
|
|
public BooleanEvent faceUp(EventLoop loop) {
|
2026-05-26 21:55:07 -07:00
|
|
|
return button(Button.FACE_UP, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Back button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getBackButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.BACK);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Back button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getBackButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.BACK);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Back button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getBackButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.BACK);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Back button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Back button's digital signal attached to the given
|
|
|
|
|
* loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent back(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.BACK, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Guide button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getGuideButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.GUIDE);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Guide button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getGuideButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.GUIDE);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Guide button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getGuideButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.GUIDE);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Guide button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Guide button's digital signal attached to the given
|
|
|
|
|
* loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent guide(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.GUIDE, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Start button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getStartButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.START);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Start button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getStartButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.START);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Start button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getStartButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.START);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Start button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Start button's digital signal attached to the given
|
|
|
|
|
* loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent start(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.START, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the left stick button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getLeftStickButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.LEFT_STICK);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the left stick button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getLeftStickButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.LEFT_STICK);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the left stick button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getLeftStickButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.LEFT_STICK);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the left stick button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the left stick button's digital signal attached to the
|
|
|
|
|
* given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent leftStick(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.LEFT_STICK, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the right stick button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getRightStickButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.RIGHT_STICK);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the right stick button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getRightStickButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.RIGHT_STICK);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the right stick button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getRightStickButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.RIGHT_STICK);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the right stick button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the right stick button's digital signal attached to the
|
|
|
|
|
* given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent rightStick(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.RIGHT_STICK, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-07 10:39:22 -08:00
|
|
|
* Read the value of the right bumper button on the controller.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
2026-02-07 10:39:22 -08:00
|
|
|
public boolean getLeftBumperButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.LEFT_BUMPER);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-07 10:39:22 -08:00
|
|
|
* Whether the right bumper button was pressed since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
2026-02-07 10:39:22 -08:00
|
|
|
public boolean getLeftBumperButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.LEFT_BUMPER);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-07 10:39:22 -08:00
|
|
|
* Whether the right bumper button was released since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
2026-02-07 10:39:22 -08:00
|
|
|
public boolean getLeftBumperButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.LEFT_BUMPER);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-07 10:39:22 -08:00
|
|
|
* Constructs an event instance around the right bumper button's digital signal.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
2026-02-07 10:39:22 -08:00
|
|
|
* @return an event instance representing the right bumper button's digital signal attached to the
|
|
|
|
|
* given loop.
|
2025-10-25 23:03:50 -07:00
|
|
|
*/
|
2026-02-07 10:39:22 -08:00
|
|
|
public BooleanEvent leftBumper(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.LEFT_BUMPER, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-07 10:39:22 -08:00
|
|
|
* Read the value of the right bumper button on the controller.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
2026-02-07 10:39:22 -08:00
|
|
|
public boolean getRightBumperButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.RIGHT_BUMPER);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-07 10:39:22 -08:00
|
|
|
* Whether the right bumper button was pressed since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
2026-02-07 10:39:22 -08:00
|
|
|
public boolean getRightBumperButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.RIGHT_BUMPER);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-07 10:39:22 -08:00
|
|
|
* Whether the right bumper button was released since the last check.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
2026-02-07 10:39:22 -08:00
|
|
|
public boolean getRightBumperButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.RIGHT_BUMPER);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-07 10:39:22 -08:00
|
|
|
* Constructs an event instance around the right bumper button's digital signal.
|
2025-10-25 23:03:50 -07:00
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
2026-02-07 10:39:22 -08:00
|
|
|
* @return an event instance representing the right bumper button's digital signal attached to the
|
|
|
|
|
* given loop.
|
2025-10-25 23:03:50 -07:00
|
|
|
*/
|
2026-02-07 10:39:22 -08:00
|
|
|
public BooleanEvent rightBumper(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.RIGHT_BUMPER, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the D-pad up button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadUpButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.DPAD_UP);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the D-pad up button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadUpButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.DPAD_UP);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the D-pad up button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadUpButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.DPAD_UP);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the D-pad up button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the D-pad up button's digital signal attached to the
|
|
|
|
|
* given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent dpadUp(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.DPAD_UP, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the D-pad down button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadDownButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.DPAD_DOWN);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the D-pad down button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadDownButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.DPAD_DOWN);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the D-pad down button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadDownButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.DPAD_DOWN);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the D-pad down button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the D-pad down button's digital signal attached to the
|
|
|
|
|
* given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent dpadDown(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.DPAD_DOWN, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the D-pad left button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadLeftButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.DPAD_LEFT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the D-pad left button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadLeftButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.DPAD_LEFT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the D-pad left button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadLeftButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.DPAD_LEFT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the D-pad left button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the D-pad left button's digital signal attached to the
|
|
|
|
|
* given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent dpadLeft(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.DPAD_LEFT, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the D-pad right button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadRightButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.DPAD_RIGHT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the D-pad right button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadRightButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.DPAD_RIGHT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the D-pad right button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getDpadRightButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.DPAD_RIGHT);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the D-pad right button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the D-pad right button's digital signal attached to the
|
|
|
|
|
* given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent dpadRight(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.DPAD_RIGHT, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Miscellaneous 1 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc1Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.MISC_1);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 1 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc1ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.MISC_1);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 1 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc1ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.MISC_1);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Miscellaneous 1 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Miscellaneous 1 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent misc1(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.MISC_1, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Right Paddle 1 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getRightPaddle1Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.RIGHT_PADDLE_1);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Right Paddle 1 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getRightPaddle1ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.RIGHT_PADDLE_1);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Right Paddle 1 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getRightPaddle1ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.RIGHT_PADDLE_1);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Right Paddle 1 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Right Paddle 1 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent rightPaddle1(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.RIGHT_PADDLE_1, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Left Paddle 1 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getLeftPaddle1Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.LEFT_PADDLE_1);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Left Paddle 1 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getLeftPaddle1ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.LEFT_PADDLE_1);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Left Paddle 1 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getLeftPaddle1ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.LEFT_PADDLE_1);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Left Paddle 1 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Left Paddle 1 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent leftPaddle1(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.LEFT_PADDLE_1, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Right Paddle 2 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getRightPaddle2Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.RIGHT_PADDLE_2);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Right Paddle 2 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getRightPaddle2ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.RIGHT_PADDLE_2);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Right Paddle 2 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getRightPaddle2ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.RIGHT_PADDLE_2);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Right Paddle 2 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Right Paddle 2 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent rightPaddle2(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.RIGHT_PADDLE_2, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Left Paddle 2 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getLeftPaddle2Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.LEFT_PADDLE_2);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Left Paddle 2 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getLeftPaddle2ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.LEFT_PADDLE_2);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Left Paddle 2 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getLeftPaddle2ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.LEFT_PADDLE_2);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Left Paddle 2 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Left Paddle 2 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent leftPaddle2(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.LEFT_PADDLE_2, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Touchpad button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getTouchpadButton() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.TOUCHPAD);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Touchpad button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getTouchpadButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.TOUCHPAD);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Touchpad button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getTouchpadButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.TOUCHPAD);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Touchpad button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Touchpad button's digital signal attached to the
|
|
|
|
|
* given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent touchpad(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.TOUCHPAD, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Miscellaneous 2 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc2Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.MISC_2);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 2 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc2ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.MISC_2);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 2 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc2ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.MISC_2);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Miscellaneous 2 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Miscellaneous 2 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent misc2(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.MISC_2, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Miscellaneous 3 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc3Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.MISC_3);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 3 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc3ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.MISC_3);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 3 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc3ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.MISC_3);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Miscellaneous 3 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Miscellaneous 3 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent misc3(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.MISC_3, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Miscellaneous 4 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc4Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.MISC_4);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 4 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc4ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.MISC_4);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 4 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc4ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.MISC_4);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Miscellaneous 4 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Miscellaneous 4 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent misc4(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.MISC_4, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Miscellaneous 5 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc5Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.MISC_5);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 5 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc5ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.MISC_5);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 5 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc5ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.MISC_5);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Miscellaneous 5 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Miscellaneous 5 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent misc5(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.MISC_5, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Read the value of the Miscellaneous 6 button on the controller.
|
|
|
|
|
*
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc6Button() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButton(Button.MISC_6);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 6 button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc6ButtonPressed() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonPressed(Button.MISC_6);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the Miscellaneous 6 button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getMisc6ButtonReleased() {
|
2026-03-17 17:19:58 -07:00
|
|
|
return getButtonReleased(Button.MISC_6);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around the Miscellaneous 6 button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the Miscellaneous 6 button's digital signal attached to
|
|
|
|
|
* the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent misc6(EventLoop loop) {
|
2026-03-17 17:19:58 -07:00
|
|
|
return button(Button.MISC_6, loop);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-17 17:19:58 -07:00
|
|
|
/**
|
|
|
|
|
* Get the button value (starting at button 1).
|
|
|
|
|
*
|
|
|
|
|
* <p>This method returns true if the button is being held down at the time that this method is
|
|
|
|
|
* being called.
|
|
|
|
|
*
|
|
|
|
|
* @param button The button
|
|
|
|
|
* @return The state of the button.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getButton(Button button) {
|
|
|
|
|
return getRawButton(button.value);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-17 17:19:58 -07:00
|
|
|
/**
|
|
|
|
|
* Whether the button was pressed since the last check.
|
|
|
|
|
*
|
|
|
|
|
* <p>This method returns true if the button went from not pressed to held down since the last
|
|
|
|
|
* time this method was called. This is useful if you only want to call a function once when you
|
|
|
|
|
* press the button.
|
|
|
|
|
*
|
|
|
|
|
* @param button The button
|
|
|
|
|
* @return Whether the button was pressed since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getButtonPressed(Button button) {
|
|
|
|
|
return getRawButtonPressed(button.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether the button was released since the last check.
|
|
|
|
|
*
|
|
|
|
|
* <p>This method returns true if the button went from held down to not pressed since the last
|
|
|
|
|
* time this method was called. This is useful if you only want to call a function once when you
|
|
|
|
|
* release the button.
|
|
|
|
|
*
|
|
|
|
|
* @param button The button
|
|
|
|
|
* @return Whether the button was released since the last check.
|
|
|
|
|
*/
|
|
|
|
|
public boolean getButtonReleased(Button button) {
|
|
|
|
|
return getRawButtonReleased(button.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance around this button's digital signal.
|
|
|
|
|
*
|
|
|
|
|
* @param button the button
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance representing the button's digital signal attached to the given loop.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent button(Button button, EventLoop loop) {
|
|
|
|
|
return super.button(button.value, loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the value of the axis.
|
|
|
|
|
*
|
|
|
|
|
* @param axis The axis to read
|
|
|
|
|
* @return The value of the axis.
|
|
|
|
|
*/
|
|
|
|
|
public double getAxis(Axis axis) {
|
|
|
|
|
return getRawAxis(axis.value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance that is true when the axis value is less than {@code threshold},
|
|
|
|
|
* attached to the given loop.
|
|
|
|
|
*
|
|
|
|
|
* @param axis The axis to read, starting at 0
|
|
|
|
|
* @param threshold The value below which this event should return true.
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance that is true when the axis value is less than the provided threshold.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent axisLessThan(Axis axis, double threshold, EventLoop loop) {
|
|
|
|
|
return super.axisLessThan(axis.value, threshold, loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Constructs an event instance that is true when the axis value is greater than {@code
|
|
|
|
|
* threshold}, attached to the given loop.
|
|
|
|
|
*
|
|
|
|
|
* @param axis The axis to read, starting at 0
|
|
|
|
|
* @param threshold The value above which this event should return true.
|
|
|
|
|
* @param loop the event loop instance to attach the event to.
|
|
|
|
|
* @return an event instance that is true when the axis value is greater than the provided
|
|
|
|
|
* threshold.
|
|
|
|
|
*/
|
|
|
|
|
public BooleanEvent axisGreaterThan(Axis axis, double threshold, EventLoop loop) {
|
|
|
|
|
return super.axisGreaterThan(axis.value, threshold, loop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private double getAxisForSendable(Axis axis) {
|
2026-04-18 19:56:45 -07:00
|
|
|
return DriverStationBackend.getStickAxisIfAvailable(getPort(), axis.value).orElse(0.0);
|
2026-03-17 17:19:58 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean getButtonForSendable(Button button) {
|
2026-04-18 19:56:45 -07:00
|
|
|
return DriverStationBackend.getStickButtonIfAvailable(getPort(), button.value).orElse(false);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void initSendable(SendableBuilder builder) {
|
|
|
|
|
builder.setSmartDashboardType("HID");
|
|
|
|
|
builder.publishConstString("ControllerType", "Gamepad");
|
|
|
|
|
builder.addDoubleProperty(
|
2026-03-17 17:19:58 -07:00
|
|
|
"LeftTrigger Axis", () -> getAxisForSendable(Axis.LEFT_TRIGGER), null);
|
2025-10-25 23:03:50 -07:00
|
|
|
builder.addDoubleProperty(
|
2026-03-17 17:19:58 -07:00
|
|
|
"RightTrigger Axis", () -> getAxisForSendable(Axis.RIGHT_TRIGGER), null);
|
|
|
|
|
builder.addDoubleProperty("LeftX", () -> getAxisForSendable(Axis.LEFT_X), null);
|
|
|
|
|
builder.addDoubleProperty("LeftY", () -> getAxisForSendable(Axis.LEFT_Y), null);
|
|
|
|
|
builder.addDoubleProperty("RightX", () -> getAxisForSendable(Axis.RIGHT_X), null);
|
|
|
|
|
builder.addDoubleProperty("RightY", () -> getAxisForSendable(Axis.RIGHT_Y), null);
|
2026-05-26 21:55:07 -07:00
|
|
|
builder.addBooleanProperty("FaceDown", () -> getButtonForSendable(Button.FACE_DOWN), null);
|
|
|
|
|
builder.addBooleanProperty("FaceRight", () -> getButtonForSendable(Button.FACE_RIGHT), null);
|
|
|
|
|
builder.addBooleanProperty("FaceLeft", () -> getButtonForSendable(Button.FACE_LEFT), null);
|
|
|
|
|
builder.addBooleanProperty("FaceUp", () -> getButtonForSendable(Button.FACE_UP), null);
|
2026-03-17 17:19:58 -07:00
|
|
|
builder.addBooleanProperty("Back", () -> getButtonForSendable(Button.BACK), null);
|
|
|
|
|
builder.addBooleanProperty("Guide", () -> getButtonForSendable(Button.GUIDE), null);
|
|
|
|
|
builder.addBooleanProperty("Start", () -> getButtonForSendable(Button.START), null);
|
|
|
|
|
builder.addBooleanProperty("LeftStick", () -> getButtonForSendable(Button.LEFT_STICK), null);
|
|
|
|
|
builder.addBooleanProperty("RightStick", () -> getButtonForSendable(Button.RIGHT_STICK), null);
|
|
|
|
|
builder.addBooleanProperty("LeftBumper", () -> getButtonForSendable(Button.LEFT_BUMPER), null);
|
2025-10-25 23:03:50 -07:00
|
|
|
builder.addBooleanProperty(
|
2026-03-17 17:19:58 -07:00
|
|
|
"RightBumper", () -> getButtonForSendable(Button.RIGHT_BUMPER), null);
|
|
|
|
|
builder.addBooleanProperty("DpadUp", () -> getButtonForSendable(Button.DPAD_UP), null);
|
|
|
|
|
builder.addBooleanProperty("DpadDown", () -> getButtonForSendable(Button.DPAD_DOWN), null);
|
|
|
|
|
builder.addBooleanProperty("DpadLeft", () -> getButtonForSendable(Button.DPAD_LEFT), null);
|
|
|
|
|
builder.addBooleanProperty("DpadRight", () -> getButtonForSendable(Button.DPAD_RIGHT), null);
|
|
|
|
|
builder.addBooleanProperty("Misc1", () -> getButtonForSendable(Button.MISC_1), null);
|
2025-10-25 23:03:50 -07:00
|
|
|
builder.addBooleanProperty(
|
2026-03-17 17:19:58 -07:00
|
|
|
"RightPaddle1", () -> getButtonForSendable(Button.RIGHT_PADDLE_1), null);
|
2025-10-25 23:03:50 -07:00
|
|
|
builder.addBooleanProperty(
|
2026-03-17 17:19:58 -07:00
|
|
|
"LeftPaddle1", () -> getButtonForSendable(Button.LEFT_PADDLE_1), null);
|
2025-10-25 23:03:50 -07:00
|
|
|
builder.addBooleanProperty(
|
2026-03-17 17:19:58 -07:00
|
|
|
"RightPaddle2", () -> getButtonForSendable(Button.RIGHT_PADDLE_2), null);
|
2025-10-25 23:03:50 -07:00
|
|
|
builder.addBooleanProperty(
|
2026-03-17 17:19:58 -07:00
|
|
|
"LeftPaddle2", () -> getButtonForSendable(Button.LEFT_PADDLE_2), null);
|
|
|
|
|
builder.addBooleanProperty("Touchpad", () -> getButtonForSendable(Button.TOUCHPAD), null);
|
|
|
|
|
builder.addBooleanProperty("Misc2", () -> getButtonForSendable(Button.MISC_2), null);
|
|
|
|
|
builder.addBooleanProperty("Misc3", () -> getButtonForSendable(Button.MISC_3), null);
|
|
|
|
|
builder.addBooleanProperty("Misc4", () -> getButtonForSendable(Button.MISC_4), null);
|
|
|
|
|
builder.addBooleanProperty("Misc5", () -> getButtonForSendable(Button.MISC_5), null);
|
|
|
|
|
builder.addBooleanProperty("Misc6", () -> getButtonForSendable(Button.MISC_6), null);
|
2025-10-25 23:03:50 -07:00
|
|
|
}
|
|
|
|
|
}
|