mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
SCRIPT Move java files
This commit is contained in:
committed by
Peter Johnson
parent
7ca1be9bae
commit
c350c5f112
781
wpilibj/src/generated/main/java/org/wpilib/driverstation/PS4Controller.java
generated
Normal file
781
wpilibj/src/generated/main/java/org/wpilib/driverstation/PS4Controller.java
generated
Normal file
@@ -0,0 +1,781 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_hids.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.event.BooleanEvent;
|
||||
import edu.wpi.first.wpilibj.event.EventLoop;
|
||||
|
||||
/**
|
||||
* Handle input from PS4 controllers connected to the Driver Station.
|
||||
*
|
||||
* <p>This class handles PS4 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 Sony 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 PS4Controller extends GenericHID implements Sendable {
|
||||
/** Represents a digital button on a PS4Controller. */
|
||||
public enum Button {
|
||||
/** Square button. */
|
||||
kSquare(0),
|
||||
/** Cross button. */
|
||||
kCross(1),
|
||||
/** Circle button. */
|
||||
kCircle(2),
|
||||
/** Triangle button. */
|
||||
kTriangle(3),
|
||||
/** Left trigger 1 button. */
|
||||
kL1(4),
|
||||
/** Right trigger 1 button. */
|
||||
kR1(5),
|
||||
/** Left trigger 2 button. */
|
||||
kL2(6),
|
||||
/** Right trigger 2 button. */
|
||||
kR2(7),
|
||||
/** Share button. */
|
||||
kShare(8),
|
||||
/** Options button. */
|
||||
kOptions(9),
|
||||
/** L3 (left stick) button. */
|
||||
kL3(10),
|
||||
/** R3 (right stick) button. */
|
||||
kR3(11),
|
||||
/** PlayStation button. */
|
||||
kPS(12),
|
||||
/** Touchpad button. */
|
||||
kTouchpad(13);
|
||||
|
||||
/** Button value. */
|
||||
public final int value;
|
||||
|
||||
Button(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-friendly name of the button, matching the relevant methods. This is done by
|
||||
* stripping the leading `k`, and appending `Button`.
|
||||
*
|
||||
* <p>Primarily used for automated unit tests.
|
||||
*
|
||||
* @return the human-friendly name of the button.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
// Remove leading `k`
|
||||
return this.name().substring(1) + "Button";
|
||||
}
|
||||
}
|
||||
|
||||
/** Represents an axis on an PS4Controller. */
|
||||
public enum Axis {
|
||||
/** Left X axis. */
|
||||
kLeftX(0),
|
||||
/** Left Y axis. */
|
||||
kLeftY(1),
|
||||
/** Right X axis. */
|
||||
kRightX(2),
|
||||
/** Right Y axis. */
|
||||
kRightY(5),
|
||||
/** Left trigger 2. */
|
||||
kL2(3),
|
||||
/** Right trigger 2. */
|
||||
kR2(4);
|
||||
|
||||
/** Axis value. */
|
||||
public final int value;
|
||||
|
||||
Axis(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-friendly name of the axis, matching the relevant methods. This is done by
|
||||
* stripping the leading `k`, and appending `Axis` if the name ends with `2`.
|
||||
*
|
||||
* <p>Primarily used for automated unit tests.
|
||||
*
|
||||
* @return the human-friendly name of the axis.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
var name = this.name().substring(1); // Remove leading `k`
|
||||
if (name.endsWith("2")) {
|
||||
return name + "Axis";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into (0-5).
|
||||
*/
|
||||
public PS4Controller(final int port) {
|
||||
super(port);
|
||||
HAL.reportUsage("HID", port, "PS4Controller");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X axis value of left side of the controller. Right is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return getRawAxis(Axis.kLeftX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y axis value of left side of the controller. Back is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return getRawAxis(Axis.kLeftY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X axis value of right side of the controller. Right is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return getRawAxis(Axis.kRightX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y axis value of right side of the controller. Back is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return getRawAxis(Axis.kRightY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the left trigger 2 axis value of the controller. Note that this axis is bound to the
|
||||
* range of [0, 1] as opposed to the usual [-1, 1].
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getL2Axis() {
|
||||
return getRawAxis(Axis.kL2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the right trigger 2 axis value of the controller. Note that this axis is bound to the
|
||||
* range of [0, 1] as opposed to the usual [-1, 1].
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getR2Axis() {
|
||||
return getRawAxis(Axis.kR2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the square button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getSquareButton() {
|
||||
return getRawButton(Button.kSquare.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the square button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getSquareButtonPressed() {
|
||||
return getRawButtonPressed(Button.kSquare.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the square button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getSquareButtonReleased() {
|
||||
return getRawButtonReleased(Button.kSquare.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the square button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the square button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent square(EventLoop loop) {
|
||||
return button(Button.kSquare.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the cross button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getCrossButton() {
|
||||
return getRawButton(Button.kCross.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the cross button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getCrossButtonPressed() {
|
||||
return getRawButtonPressed(Button.kCross.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the cross button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getCrossButtonReleased() {
|
||||
return getRawButtonReleased(Button.kCross.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the cross button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the cross button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent cross(EventLoop loop) {
|
||||
return button(Button.kCross.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the circle button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getCircleButton() {
|
||||
return getRawButton(Button.kCircle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the circle button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getCircleButtonPressed() {
|
||||
return getRawButtonPressed(Button.kCircle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the circle button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getCircleButtonReleased() {
|
||||
return getRawButtonReleased(Button.kCircle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the circle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the circle button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent circle(EventLoop loop) {
|
||||
return button(Button.kCircle.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the triangle button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getTriangleButton() {
|
||||
return getRawButton(Button.kTriangle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the triangle button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getTriangleButtonPressed() {
|
||||
return getRawButtonPressed(Button.kTriangle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the triangle button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getTriangleButtonReleased() {
|
||||
return getRawButtonReleased(Button.kTriangle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the triangle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the triangle button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent triangle(EventLoop loop) {
|
||||
return button(Button.kTriangle.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left trigger 1 button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getL1Button() {
|
||||
return getRawButton(Button.kL1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger 1 button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getL1ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kL1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger 1 button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getL1ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kL1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the left trigger 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the left trigger 1 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent L1(EventLoop loop) {
|
||||
return button(Button.kL1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right trigger 1 button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getR1Button() {
|
||||
return getRawButton(Button.kR1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger 1 button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getR1ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kR1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger 1 button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getR1ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kR1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right trigger 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right trigger 1 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent R1(EventLoop loop) {
|
||||
return button(Button.kR1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left trigger 2 button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getL2Button() {
|
||||
return getRawButton(Button.kL2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger 2 button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getL2ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kL2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger 2 button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getL2ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kL2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the left trigger 2 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the left trigger 2 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent L2(EventLoop loop) {
|
||||
return button(Button.kL2.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right trigger 2 button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getR2Button() {
|
||||
return getRawButton(Button.kR2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger 2 button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getR2ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kR2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger 2 button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getR2ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kR2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right trigger 2 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right trigger 2 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent R2(EventLoop loop) {
|
||||
return button(Button.kR2.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the share button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getShareButton() {
|
||||
return getRawButton(Button.kShare.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the share button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getShareButtonPressed() {
|
||||
return getRawButtonPressed(Button.kShare.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the share button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getShareButtonReleased() {
|
||||
return getRawButtonReleased(Button.kShare.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the share button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the share button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent share(EventLoop loop) {
|
||||
return button(Button.kShare.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the options button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getOptionsButton() {
|
||||
return getRawButton(Button.kOptions.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the options button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getOptionsButtonPressed() {
|
||||
return getRawButtonPressed(Button.kOptions.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the options button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getOptionsButtonReleased() {
|
||||
return getRawButtonReleased(Button.kOptions.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the options button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the options button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent options(EventLoop loop) {
|
||||
return button(Button.kOptions.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the L3 (left stick) button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getL3Button() {
|
||||
return getRawButton(Button.kL3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the L3 (left stick) button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getL3ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kL3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the L3 (left stick) button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getL3ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kL3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the L3 (left stick) button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the L3 (left stick) button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent L3(EventLoop loop) {
|
||||
return button(Button.kL3.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the R3 (right stick) button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getR3Button() {
|
||||
return getRawButton(Button.kR3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the R3 (right stick) button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getR3ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kR3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the R3 (right stick) button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getR3ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kR3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the R3 (right stick) button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the R3 (right stick) button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent R3(EventLoop loop) {
|
||||
return button(Button.kR3.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the PlayStation button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getPSButton() {
|
||||
return getRawButton(Button.kPS.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the PlayStation button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getPSButtonPressed() {
|
||||
return getRawButtonPressed(Button.kPS.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the PlayStation button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getPSButtonReleased() {
|
||||
return getRawButtonReleased(Button.kPS.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the PlayStation button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the PlayStation button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent PS(EventLoop loop) {
|
||||
return button(Button.kPS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the touchpad button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getTouchpadButton() {
|
||||
return getRawButton(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the touchpad button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getTouchpadButtonPressed() {
|
||||
return getRawButtonPressed(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the touchpad button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getTouchpadButtonReleased() {
|
||||
return getRawButtonReleased(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return button(Button.kTouchpad.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the touchpad on the controller.
|
||||
*
|
||||
* @return The state of the touchpad.
|
||||
* @deprecated Use {@link getTouchpadButton} instead. This function is deprecated for removal to
|
||||
* make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getTouchpad() {
|
||||
return getRawButton(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the touchpad was pressed since the last check.
|
||||
*
|
||||
* @return Whether the touchpad was pressed since the last check.
|
||||
* @deprecated Use {@link getTouchpadButtonPressed} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getTouchpadPressed() {
|
||||
return getRawButtonPressed(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the touchpad was released since the last check.
|
||||
*
|
||||
* @return Whether the touchpad was released since the last check.
|
||||
* @deprecated Use {@link getTouchpadButtonReleased} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getTouchpadReleased() {
|
||||
return getRawButtonReleased(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initSendable(SendableBuilder builder) {
|
||||
builder.setSmartDashboardType("HID");
|
||||
builder.publishConstString("ControllerType", "PS4");
|
||||
builder.addDoubleProperty("L2 Axis", this::getL2Axis, null);
|
||||
builder.addDoubleProperty("R2 Axis", this::getR2Axis, null);
|
||||
builder.addDoubleProperty("LeftX", this::getLeftX, null);
|
||||
builder.addDoubleProperty("LeftY", this::getLeftY, null);
|
||||
builder.addDoubleProperty("RightX", this::getRightX, null);
|
||||
builder.addDoubleProperty("RightY", this::getRightY, null);
|
||||
builder.addBooleanProperty("Square", this::getSquareButton, null);
|
||||
builder.addBooleanProperty("Cross", this::getCrossButton, null);
|
||||
builder.addBooleanProperty("Circle", this::getCircleButton, null);
|
||||
builder.addBooleanProperty("Triangle", this::getTriangleButton, null);
|
||||
builder.addBooleanProperty("L1", this::getL1Button, null);
|
||||
builder.addBooleanProperty("R1", this::getR1Button, null);
|
||||
builder.addBooleanProperty("L2", this::getL2Button, null);
|
||||
builder.addBooleanProperty("R2", this::getR2Button, null);
|
||||
builder.addBooleanProperty("Share", this::getShareButton, null);
|
||||
builder.addBooleanProperty("Options", this::getOptionsButton, null);
|
||||
builder.addBooleanProperty("L3", this::getL3Button, null);
|
||||
builder.addBooleanProperty("R3", this::getR3Button, null);
|
||||
builder.addBooleanProperty("PS", this::getPSButton, null);
|
||||
builder.addBooleanProperty("Touchpad", this::getTouchpadButton, null);
|
||||
}
|
||||
}
|
||||
781
wpilibj/src/generated/main/java/org/wpilib/driverstation/PS5Controller.java
generated
Normal file
781
wpilibj/src/generated/main/java/org/wpilib/driverstation/PS5Controller.java
generated
Normal file
@@ -0,0 +1,781 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_hids.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.event.BooleanEvent;
|
||||
import edu.wpi.first.wpilibj.event.EventLoop;
|
||||
|
||||
/**
|
||||
* Handle input from PS5 controllers connected to the Driver Station.
|
||||
*
|
||||
* <p>This class handles PS5 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 Sony 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 PS5Controller extends GenericHID implements Sendable {
|
||||
/** Represents a digital button on a PS5Controller. */
|
||||
public enum Button {
|
||||
/** Square button. */
|
||||
kSquare(0),
|
||||
/** Cross button. */
|
||||
kCross(1),
|
||||
/** Circle button. */
|
||||
kCircle(2),
|
||||
/** Triangle button. */
|
||||
kTriangle(3),
|
||||
/** Left trigger 1 button. */
|
||||
kL1(4),
|
||||
/** Right trigger 1 button. */
|
||||
kR1(5),
|
||||
/** Left trigger 2 button. */
|
||||
kL2(6),
|
||||
/** Right trigger 2 button. */
|
||||
kR2(7),
|
||||
/** Create button. */
|
||||
kCreate(8),
|
||||
/** Options button. */
|
||||
kOptions(9),
|
||||
/** L3 (left stick) button. */
|
||||
kL3(10),
|
||||
/** R3 (right stick) button. */
|
||||
kR3(11),
|
||||
/** PlayStation button. */
|
||||
kPS(12),
|
||||
/** Touchpad button. */
|
||||
kTouchpad(13);
|
||||
|
||||
/** Button value. */
|
||||
public final int value;
|
||||
|
||||
Button(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-friendly name of the button, matching the relevant methods. This is done by
|
||||
* stripping the leading `k`, and appending `Button`.
|
||||
*
|
||||
* <p>Primarily used for automated unit tests.
|
||||
*
|
||||
* @return the human-friendly name of the button.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
// Remove leading `k`
|
||||
return this.name().substring(1) + "Button";
|
||||
}
|
||||
}
|
||||
|
||||
/** Represents an axis on an PS5Controller. */
|
||||
public enum Axis {
|
||||
/** Left X axis. */
|
||||
kLeftX(0),
|
||||
/** Left Y axis. */
|
||||
kLeftY(1),
|
||||
/** Right X axis. */
|
||||
kRightX(2),
|
||||
/** Right Y axis. */
|
||||
kRightY(5),
|
||||
/** Left trigger 2. */
|
||||
kL2(3),
|
||||
/** Right trigger 2. */
|
||||
kR2(4);
|
||||
|
||||
/** Axis value. */
|
||||
public final int value;
|
||||
|
||||
Axis(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-friendly name of the axis, matching the relevant methods. This is done by
|
||||
* stripping the leading `k`, and appending `Axis` if the name ends with `2`.
|
||||
*
|
||||
* <p>Primarily used for automated unit tests.
|
||||
*
|
||||
* @return the human-friendly name of the axis.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
var name = this.name().substring(1); // Remove leading `k`
|
||||
if (name.endsWith("2")) {
|
||||
return name + "Axis";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into (0-5).
|
||||
*/
|
||||
public PS5Controller(final int port) {
|
||||
super(port);
|
||||
HAL.reportUsage("HID", port, "PS5Controller");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X axis value of left side of the controller. Right is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return getRawAxis(Axis.kLeftX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y axis value of left side of the controller. Back is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return getRawAxis(Axis.kLeftY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X axis value of right side of the controller. Right is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return getRawAxis(Axis.kRightX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y axis value of right side of the controller. Back is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return getRawAxis(Axis.kRightY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the left trigger 2 axis value of the controller. Note that this axis is bound to the
|
||||
* range of [0, 1] as opposed to the usual [-1, 1].
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getL2Axis() {
|
||||
return getRawAxis(Axis.kL2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the right trigger 2 axis value of the controller. Note that this axis is bound to the
|
||||
* range of [0, 1] as opposed to the usual [-1, 1].
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getR2Axis() {
|
||||
return getRawAxis(Axis.kR2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the square button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getSquareButton() {
|
||||
return getRawButton(Button.kSquare.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the square button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getSquareButtonPressed() {
|
||||
return getRawButtonPressed(Button.kSquare.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the square button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getSquareButtonReleased() {
|
||||
return getRawButtonReleased(Button.kSquare.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the square button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the square button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent square(EventLoop loop) {
|
||||
return button(Button.kSquare.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the cross button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getCrossButton() {
|
||||
return getRawButton(Button.kCross.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the cross button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getCrossButtonPressed() {
|
||||
return getRawButtonPressed(Button.kCross.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the cross button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getCrossButtonReleased() {
|
||||
return getRawButtonReleased(Button.kCross.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the cross button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the cross button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent cross(EventLoop loop) {
|
||||
return button(Button.kCross.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the circle button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getCircleButton() {
|
||||
return getRawButton(Button.kCircle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the circle button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getCircleButtonPressed() {
|
||||
return getRawButtonPressed(Button.kCircle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the circle button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getCircleButtonReleased() {
|
||||
return getRawButtonReleased(Button.kCircle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the circle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the circle button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent circle(EventLoop loop) {
|
||||
return button(Button.kCircle.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the triangle button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getTriangleButton() {
|
||||
return getRawButton(Button.kTriangle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the triangle button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getTriangleButtonPressed() {
|
||||
return getRawButtonPressed(Button.kTriangle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the triangle button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getTriangleButtonReleased() {
|
||||
return getRawButtonReleased(Button.kTriangle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the triangle button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the triangle button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent triangle(EventLoop loop) {
|
||||
return button(Button.kTriangle.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left trigger 1 button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getL1Button() {
|
||||
return getRawButton(Button.kL1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger 1 button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getL1ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kL1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger 1 button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getL1ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kL1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the left trigger 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the left trigger 1 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent L1(EventLoop loop) {
|
||||
return button(Button.kL1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right trigger 1 button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getR1Button() {
|
||||
return getRawButton(Button.kR1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger 1 button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getR1ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kR1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger 1 button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getR1ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kR1.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right trigger 1 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right trigger 1 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent R1(EventLoop loop) {
|
||||
return button(Button.kR1.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left trigger 2 button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getL2Button() {
|
||||
return getRawButton(Button.kL2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger 2 button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getL2ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kL2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger 2 button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getL2ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kL2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the left trigger 2 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the left trigger 2 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent L2(EventLoop loop) {
|
||||
return button(Button.kL2.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right trigger 2 button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getR2Button() {
|
||||
return getRawButton(Button.kR2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger 2 button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getR2ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kR2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger 2 button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getR2ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kR2.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right trigger 2 button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right trigger 2 button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent R2(EventLoop loop) {
|
||||
return button(Button.kR2.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the create button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getCreateButton() {
|
||||
return getRawButton(Button.kCreate.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the create button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getCreateButtonPressed() {
|
||||
return getRawButtonPressed(Button.kCreate.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the create button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getCreateButtonReleased() {
|
||||
return getRawButtonReleased(Button.kCreate.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the create button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the create button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent create(EventLoop loop) {
|
||||
return button(Button.kCreate.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the options button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getOptionsButton() {
|
||||
return getRawButton(Button.kOptions.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the options button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getOptionsButtonPressed() {
|
||||
return getRawButtonPressed(Button.kOptions.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the options button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getOptionsButtonReleased() {
|
||||
return getRawButtonReleased(Button.kOptions.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the options button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the options button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent options(EventLoop loop) {
|
||||
return button(Button.kOptions.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the L3 (left stick) button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getL3Button() {
|
||||
return getRawButton(Button.kL3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the L3 (left stick) button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getL3ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kL3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the L3 (left stick) button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getL3ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kL3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the L3 (left stick) button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the L3 (left stick) button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent L3(EventLoop loop) {
|
||||
return button(Button.kL3.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the R3 (right stick) button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getR3Button() {
|
||||
return getRawButton(Button.kR3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the R3 (right stick) button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getR3ButtonPressed() {
|
||||
return getRawButtonPressed(Button.kR3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the R3 (right stick) button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getR3ButtonReleased() {
|
||||
return getRawButtonReleased(Button.kR3.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the R3 (right stick) button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the R3 (right stick) button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent R3(EventLoop loop) {
|
||||
return button(Button.kR3.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the PlayStation button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getPSButton() {
|
||||
return getRawButton(Button.kPS.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the PlayStation button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getPSButtonPressed() {
|
||||
return getRawButtonPressed(Button.kPS.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the PlayStation button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getPSButtonReleased() {
|
||||
return getRawButtonReleased(Button.kPS.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the PlayStation button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the PlayStation button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent PS(EventLoop loop) {
|
||||
return button(Button.kPS.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the touchpad button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getTouchpadButton() {
|
||||
return getRawButton(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the touchpad button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getTouchpadButtonPressed() {
|
||||
return getRawButtonPressed(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the touchpad button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getTouchpadButtonReleased() {
|
||||
return getRawButtonReleased(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return button(Button.kTouchpad.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the touchpad on the controller.
|
||||
*
|
||||
* @return The state of the touchpad.
|
||||
* @deprecated Use {@link getTouchpadButton} instead. This function is deprecated for removal to
|
||||
* make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getTouchpad() {
|
||||
return getRawButton(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the touchpad was pressed since the last check.
|
||||
*
|
||||
* @return Whether the touchpad was pressed since the last check.
|
||||
* @deprecated Use {@link getTouchpadButtonPressed} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getTouchpadPressed() {
|
||||
return getRawButtonPressed(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the touchpad was released since the last check.
|
||||
*
|
||||
* @return Whether the touchpad was released since the last check.
|
||||
* @deprecated Use {@link getTouchpadButtonReleased} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getTouchpadReleased() {
|
||||
return getRawButtonReleased(Button.kTouchpad.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initSendable(SendableBuilder builder) {
|
||||
builder.setSmartDashboardType("HID");
|
||||
builder.publishConstString("ControllerType", "PS5");
|
||||
builder.addDoubleProperty("L2 Axis", this::getL2Axis, null);
|
||||
builder.addDoubleProperty("R2 Axis", this::getR2Axis, null);
|
||||
builder.addDoubleProperty("LeftX", this::getLeftX, null);
|
||||
builder.addDoubleProperty("LeftY", this::getLeftY, null);
|
||||
builder.addDoubleProperty("RightX", this::getRightX, null);
|
||||
builder.addDoubleProperty("RightY", this::getRightY, null);
|
||||
builder.addBooleanProperty("Square", this::getSquareButton, null);
|
||||
builder.addBooleanProperty("Cross", this::getCrossButton, null);
|
||||
builder.addBooleanProperty("Circle", this::getCircleButton, null);
|
||||
builder.addBooleanProperty("Triangle", this::getTriangleButton, null);
|
||||
builder.addBooleanProperty("L1", this::getL1Button, null);
|
||||
builder.addBooleanProperty("R1", this::getR1Button, null);
|
||||
builder.addBooleanProperty("L2", this::getL2Button, null);
|
||||
builder.addBooleanProperty("R2", this::getR2Button, null);
|
||||
builder.addBooleanProperty("Create", this::getCreateButton, null);
|
||||
builder.addBooleanProperty("Options", this::getOptionsButton, null);
|
||||
builder.addBooleanProperty("L3", this::getL3Button, null);
|
||||
builder.addBooleanProperty("R3", this::getR3Button, null);
|
||||
builder.addBooleanProperty("PS", this::getPSButton, null);
|
||||
builder.addBooleanProperty("Touchpad", this::getTouchpadButton, null);
|
||||
}
|
||||
}
|
||||
834
wpilibj/src/generated/main/java/org/wpilib/driverstation/StadiaController.java
generated
Normal file
834
wpilibj/src/generated/main/java/org/wpilib/driverstation/StadiaController.java
generated
Normal file
@@ -0,0 +1,834 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_hids.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.event.BooleanEvent;
|
||||
import edu.wpi.first.wpilibj.event.EventLoop;
|
||||
|
||||
/**
|
||||
* Handle input from Stadia controllers connected to the Driver Station.
|
||||
*
|
||||
* <p>This class handles Stadia 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 Google 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 StadiaController extends GenericHID implements Sendable {
|
||||
/** Represents a digital button on a StadiaController. */
|
||||
public enum Button {
|
||||
/** A button. */
|
||||
kA(0),
|
||||
/** B button. */
|
||||
kB(1),
|
||||
/** X button. */
|
||||
kX(2),
|
||||
/** Y button. */
|
||||
kY(3),
|
||||
/** Left bumper button. */
|
||||
kLeftBumper(4),
|
||||
/** Right bumper button. */
|
||||
kRightBumper(5),
|
||||
/** Left stick button. */
|
||||
kLeftStick(6),
|
||||
/** Right stick button. */
|
||||
kRightStick(7),
|
||||
/** Ellipses button. */
|
||||
kEllipses(8),
|
||||
/** Hamburger button. */
|
||||
kHamburger(9),
|
||||
/** Stadia button. */
|
||||
kStadia(10),
|
||||
/** Right trigger button. */
|
||||
kRightTrigger(11),
|
||||
/** Left trigger button. */
|
||||
kLeftTrigger(12),
|
||||
/** Google button. */
|
||||
kGoogle(13),
|
||||
/** Frame button. */
|
||||
kFrame(14);
|
||||
|
||||
/** Button value. */
|
||||
public final int value;
|
||||
|
||||
Button(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-friendly name of the button, matching the relevant methods. This is done by
|
||||
* stripping the leading `k`, and appending `Button`.
|
||||
*
|
||||
* <p>Primarily used for automated unit tests.
|
||||
*
|
||||
* @return the human-friendly name of the button.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
// Remove leading `k`
|
||||
return this.name().substring(1) + "Button";
|
||||
}
|
||||
}
|
||||
|
||||
/** Represents an axis on an StadiaController. */
|
||||
public enum Axis {
|
||||
/** Left X axis. */
|
||||
kLeftX(0),
|
||||
/** Right X axis. */
|
||||
kRightX(3),
|
||||
/** Left Y axis. */
|
||||
kLeftY(1),
|
||||
/** Right Y axis. */
|
||||
kRightY(4);
|
||||
|
||||
/** Axis value. */
|
||||
public final int value;
|
||||
|
||||
Axis(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-friendly name of the axis, matching the relevant methods. This is done by
|
||||
* stripping the leading `k`, and appending `Axis` if the name ends with `Trigger`.
|
||||
*
|
||||
* <p>Primarily used for automated unit tests.
|
||||
*
|
||||
* @return the human-friendly name of the axis.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
var name = this.name().substring(1); // Remove leading `k`
|
||||
if (name.endsWith("Trigger")) {
|
||||
return name + "Axis";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into (0-5).
|
||||
*/
|
||||
public StadiaController(final int port) {
|
||||
super(port);
|
||||
HAL.reportUsage("HID", port, "StadiaController");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X axis value of left side of the controller. Right is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return getRawAxis(Axis.kLeftX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X axis value of right side of the controller. Right is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return getRawAxis(Axis.kRightX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y axis value of left side of the controller. Back is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return getRawAxis(Axis.kLeftY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y axis value of right side of the controller. Back is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return getRawAxis(Axis.kRightY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the A button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getAButton() {
|
||||
return getRawButton(Button.kA.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the A button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getAButtonPressed() {
|
||||
return getRawButtonPressed(Button.kA.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the A button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getAButtonReleased() {
|
||||
return getRawButtonReleased(Button.kA.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the A button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the A button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent a(EventLoop loop) {
|
||||
return button(Button.kA.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the B button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getBButton() {
|
||||
return getRawButton(Button.kB.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the B button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getBButtonPressed() {
|
||||
return getRawButtonPressed(Button.kB.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the B button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getBButtonReleased() {
|
||||
return getRawButtonReleased(Button.kB.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the B button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the B button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent b(EventLoop loop) {
|
||||
return button(Button.kB.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the X button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getXButton() {
|
||||
return getRawButton(Button.kX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the X button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getXButtonPressed() {
|
||||
return getRawButtonPressed(Button.kX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the X button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getXButtonReleased() {
|
||||
return getRawButtonReleased(Button.kX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the X button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the X button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent x(EventLoop loop) {
|
||||
return button(Button.kX.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the Y button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getYButton() {
|
||||
return getRawButton(Button.kY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the Y button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getYButtonPressed() {
|
||||
return getRawButtonPressed(Button.kY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the Y button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getYButtonReleased() {
|
||||
return getRawButtonReleased(Button.kY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the Y button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the Y button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent y(EventLoop loop) {
|
||||
return button(Button.kY.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left bumper button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getLeftBumperButton() {
|
||||
return getRawButton(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left bumper button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getLeftBumperButtonPressed() {
|
||||
return getRawButtonPressed(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left bumper button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getLeftBumperButtonReleased() {
|
||||
return getRawButtonReleased(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the left bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the left bumper button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent leftBumper(EventLoop loop) {
|
||||
return button(Button.kLeftBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right bumper button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getRightBumperButton() {
|
||||
return getRawButton(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right bumper button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getRightBumperButtonPressed() {
|
||||
return getRawButtonPressed(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right bumper button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getRightBumperButtonReleased() {
|
||||
return getRawButtonReleased(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right bumper button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent rightBumper(EventLoop loop) {
|
||||
return button(Button.kRightBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left stick button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getLeftStickButton() {
|
||||
return getRawButton(Button.kLeftStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left stick button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getLeftStickButtonPressed() {
|
||||
return getRawButtonPressed(Button.kLeftStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left stick button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getLeftStickButtonReleased() {
|
||||
return getRawButtonReleased(Button.kLeftStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return button(Button.kLeftStick.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right stick button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getRightStickButton() {
|
||||
return getRawButton(Button.kRightStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right stick button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getRightStickButtonPressed() {
|
||||
return getRawButtonPressed(Button.kRightStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right stick button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getRightStickButtonReleased() {
|
||||
return getRawButtonReleased(Button.kRightStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return button(Button.kRightStick.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the ellipses button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getEllipsesButton() {
|
||||
return getRawButton(Button.kEllipses.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the ellipses button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getEllipsesButtonPressed() {
|
||||
return getRawButtonPressed(Button.kEllipses.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the ellipses button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getEllipsesButtonReleased() {
|
||||
return getRawButtonReleased(Button.kEllipses.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the ellipses button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the ellipses button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent ellipses(EventLoop loop) {
|
||||
return button(Button.kEllipses.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the hamburger button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getHamburgerButton() {
|
||||
return getRawButton(Button.kHamburger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the hamburger button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getHamburgerButtonPressed() {
|
||||
return getRawButtonPressed(Button.kHamburger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the hamburger button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getHamburgerButtonReleased() {
|
||||
return getRawButtonReleased(Button.kHamburger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the hamburger button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the hamburger button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent hamburger(EventLoop loop) {
|
||||
return button(Button.kHamburger.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the stadia button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getStadiaButton() {
|
||||
return getRawButton(Button.kStadia.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the stadia button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getStadiaButtonPressed() {
|
||||
return getRawButtonPressed(Button.kStadia.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the stadia button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getStadiaButtonReleased() {
|
||||
return getRawButtonReleased(Button.kStadia.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the stadia button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the stadia button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent stadia(EventLoop loop) {
|
||||
return button(Button.kStadia.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right trigger button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getRightTriggerButton() {
|
||||
return getRawButton(Button.kRightTrigger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getRightTriggerButtonPressed() {
|
||||
return getRawButtonPressed(Button.kRightTrigger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right trigger button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getRightTriggerButtonReleased() {
|
||||
return getRawButtonReleased(Button.kRightTrigger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right trigger button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right trigger button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent rightTrigger(EventLoop loop) {
|
||||
return button(Button.kRightTrigger.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left trigger button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getLeftTriggerButton() {
|
||||
return getRawButton(Button.kLeftTrigger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getLeftTriggerButtonPressed() {
|
||||
return getRawButtonPressed(Button.kLeftTrigger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left trigger button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getLeftTriggerButtonReleased() {
|
||||
return getRawButtonReleased(Button.kLeftTrigger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the left trigger button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the left trigger button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent leftTrigger(EventLoop loop) {
|
||||
return button(Button.kLeftTrigger.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the google button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getGoogleButton() {
|
||||
return getRawButton(Button.kGoogle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the google button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getGoogleButtonPressed() {
|
||||
return getRawButtonPressed(Button.kGoogle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the google button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getGoogleButtonReleased() {
|
||||
return getRawButtonReleased(Button.kGoogle.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the google button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the google button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent google(EventLoop loop) {
|
||||
return button(Button.kGoogle.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the frame button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getFrameButton() {
|
||||
return getRawButton(Button.kFrame.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the frame button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getFrameButtonPressed() {
|
||||
return getRawButtonPressed(Button.kFrame.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the frame button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getFrameButtonReleased() {
|
||||
return getRawButtonReleased(Button.kFrame.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the frame button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the frame button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent frame(EventLoop loop) {
|
||||
return button(Button.kFrame.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left bumper (LB) button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
* @deprecated Use {@link getLeftBumperButton} instead. This function is deprecated for removal
|
||||
* to make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getLeftBumper() {
|
||||
return getRawButton(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right bumper (RB) button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
* @deprecated Use {@link getRightBumperButton} instead. This function is deprecated for removal
|
||||
* to make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getRightBumper() {
|
||||
return getRawButton(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left bumper (LB) was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
* @deprecated Use {@link getLeftBumperButtonPressed} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getLeftBumperPressed() {
|
||||
return getRawButtonPressed(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right bumper (RB) was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
* @deprecated Use {@link getRightBumperButtonPressed} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getRightBumperPressed() {
|
||||
return getRawButtonPressed(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left bumper (LB) was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
* @deprecated Use {@link getLeftBumperButtonReleased} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getLeftBumperReleased() {
|
||||
return getRawButtonReleased(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right bumper (RB) was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
* @deprecated Use {@link getRightBumperButtonReleased} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getRightBumperReleased() {
|
||||
return getRawButtonReleased(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initSendable(SendableBuilder builder) {
|
||||
builder.setSmartDashboardType("HID");
|
||||
builder.publishConstString("ControllerType", "Stadia");
|
||||
builder.addDoubleProperty("LeftX", this::getLeftX, null);
|
||||
builder.addDoubleProperty("RightX", this::getRightX, null);
|
||||
builder.addDoubleProperty("LeftY", this::getLeftY, null);
|
||||
builder.addDoubleProperty("RightY", this::getRightY, null);
|
||||
builder.addBooleanProperty("A", this::getAButton, null);
|
||||
builder.addBooleanProperty("B", this::getBButton, null);
|
||||
builder.addBooleanProperty("X", this::getXButton, null);
|
||||
builder.addBooleanProperty("Y", this::getYButton, null);
|
||||
builder.addBooleanProperty("LeftBumper", this::getLeftBumperButton, null);
|
||||
builder.addBooleanProperty("RightBumper", this::getRightBumperButton, null);
|
||||
builder.addBooleanProperty("LeftStick", this::getLeftStickButton, null);
|
||||
builder.addBooleanProperty("RightStick", this::getRightStickButton, null);
|
||||
builder.addBooleanProperty("Ellipses", this::getEllipsesButton, null);
|
||||
builder.addBooleanProperty("Hamburger", this::getHamburgerButton, null);
|
||||
builder.addBooleanProperty("Stadia", this::getStadiaButton, null);
|
||||
builder.addBooleanProperty("RightTrigger", this::getRightTriggerButton, null);
|
||||
builder.addBooleanProperty("LeftTrigger", this::getLeftTriggerButton, null);
|
||||
builder.addBooleanProperty("Google", this::getGoogleButton, null);
|
||||
builder.addBooleanProperty("Frame", this::getFrameButton, null);
|
||||
}
|
||||
}
|
||||
707
wpilibj/src/generated/main/java/org/wpilib/driverstation/XboxController.java
generated
Normal file
707
wpilibj/src/generated/main/java/org/wpilib/driverstation/XboxController.java
generated
Normal file
@@ -0,0 +1,707 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_hids.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.util.sendable.Sendable;
|
||||
import edu.wpi.first.util.sendable.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.event.BooleanEvent;
|
||||
import edu.wpi.first.wpilibj.event.EventLoop;
|
||||
|
||||
/**
|
||||
* Handle input from Xbox controllers connected to the Driver Station.
|
||||
*
|
||||
* <p>This class handles Xbox 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 Microsoft 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 XboxController extends GenericHID implements Sendable {
|
||||
/** Represents a digital button on a XboxController. */
|
||||
public enum Button {
|
||||
/** A button. */
|
||||
kA(0),
|
||||
/** B button. */
|
||||
kB(1),
|
||||
/** X button. */
|
||||
kX(2),
|
||||
/** Y button. */
|
||||
kY(3),
|
||||
/** Left bumper button. */
|
||||
kLeftBumper(4),
|
||||
/** Right bumper button. */
|
||||
kRightBumper(5),
|
||||
/** Back button. */
|
||||
kBack(6),
|
||||
/** Start button. */
|
||||
kStart(7),
|
||||
/** Left stick button. */
|
||||
kLeftStick(8),
|
||||
/** Right stick button. */
|
||||
kRightStick(9);
|
||||
|
||||
/** Button value. */
|
||||
public final int value;
|
||||
|
||||
Button(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-friendly name of the button, matching the relevant methods. This is done by
|
||||
* stripping the leading `k`, and appending `Button`.
|
||||
*
|
||||
* <p>Primarily used for automated unit tests.
|
||||
*
|
||||
* @return the human-friendly name of the button.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
// Remove leading `k`
|
||||
return this.name().substring(1) + "Button";
|
||||
}
|
||||
}
|
||||
|
||||
/** Represents an axis on an XboxController. */
|
||||
public enum Axis {
|
||||
/** Left X axis. */
|
||||
kLeftX(0),
|
||||
/** Right X axis. */
|
||||
kRightX(4),
|
||||
/** Left Y axis. */
|
||||
kLeftY(1),
|
||||
/** Right Y axis. */
|
||||
kRightY(5),
|
||||
/** Left trigger. */
|
||||
kLeftTrigger(2),
|
||||
/** Right trigger. */
|
||||
kRightTrigger(3);
|
||||
|
||||
/** Axis value. */
|
||||
public final int value;
|
||||
|
||||
Axis(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human-friendly name of the axis, matching the relevant methods. This is done by
|
||||
* stripping the leading `k`, and appending `Axis` if the name ends with `Trigger`.
|
||||
*
|
||||
* <p>Primarily used for automated unit tests.
|
||||
*
|
||||
* @return the human-friendly name of the axis.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
var name = this.name().substring(1); // Remove leading `k`
|
||||
if (name.endsWith("Trigger")) {
|
||||
return name + "Axis";
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of a controller.
|
||||
*
|
||||
* @param port The port index on the Driver Station that the controller is plugged into (0-5).
|
||||
*/
|
||||
public XboxController(final int port) {
|
||||
super(port);
|
||||
HAL.reportUsage("HID", port, "XboxController");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X axis value of left side of the controller. Right is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftX() {
|
||||
return getRawAxis(Axis.kLeftX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X axis value of right side of the controller. Right is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightX() {
|
||||
return getRawAxis(Axis.kRightX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y axis value of left side of the controller. Back is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftY() {
|
||||
return getRawAxis(Axis.kLeftY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y axis value of right side of the controller. Back is positive.
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightY() {
|
||||
return getRawAxis(Axis.kRightY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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].
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getLeftTriggerAxis() {
|
||||
return getRawAxis(Axis.kLeftTrigger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return axisGreaterThan(Axis.kLeftTrigger.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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].
|
||||
*
|
||||
* @return The axis value.
|
||||
*/
|
||||
public double getRightTriggerAxis() {
|
||||
return getRawAxis(Axis.kRightTrigger.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return axisGreaterThan(Axis.kRightTrigger.value, threshold, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the A button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getAButton() {
|
||||
return getRawButton(Button.kA.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the A button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getAButtonPressed() {
|
||||
return getRawButtonPressed(Button.kA.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the A button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getAButtonReleased() {
|
||||
return getRawButtonReleased(Button.kA.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the A button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the A button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent a(EventLoop loop) {
|
||||
return button(Button.kA.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the B button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getBButton() {
|
||||
return getRawButton(Button.kB.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the B button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getBButtonPressed() {
|
||||
return getRawButtonPressed(Button.kB.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the B button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getBButtonReleased() {
|
||||
return getRawButtonReleased(Button.kB.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the B button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the B button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent b(EventLoop loop) {
|
||||
return button(Button.kB.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the X button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getXButton() {
|
||||
return getRawButton(Button.kX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the X button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getXButtonPressed() {
|
||||
return getRawButtonPressed(Button.kX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the X button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getXButtonReleased() {
|
||||
return getRawButtonReleased(Button.kX.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the X button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the X button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent x(EventLoop loop) {
|
||||
return button(Button.kX.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the Y button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getYButton() {
|
||||
return getRawButton(Button.kY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the Y button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getYButtonPressed() {
|
||||
return getRawButtonPressed(Button.kY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the Y button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getYButtonReleased() {
|
||||
return getRawButtonReleased(Button.kY.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the Y button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the Y button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent y(EventLoop loop) {
|
||||
return button(Button.kY.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left bumper button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getLeftBumperButton() {
|
||||
return getRawButton(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left bumper button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getLeftBumperButtonPressed() {
|
||||
return getRawButtonPressed(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left bumper button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getLeftBumperButtonReleased() {
|
||||
return getRawButtonReleased(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the left bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the left bumper button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent leftBumper(EventLoop loop) {
|
||||
return button(Button.kLeftBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right bumper button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getRightBumperButton() {
|
||||
return getRawButton(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right bumper button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getRightBumperButtonPressed() {
|
||||
return getRawButtonPressed(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right bumper button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getRightBumperButtonReleased() {
|
||||
return getRawButtonReleased(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an event instance around the right bumper button's digital signal.
|
||||
*
|
||||
* @param loop the event loop instance to attach the event to.
|
||||
* @return an event instance representing the right bumper button's digital signal
|
||||
* attached to the given loop.
|
||||
*/
|
||||
public BooleanEvent rightBumper(EventLoop loop) {
|
||||
return button(Button.kRightBumper.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the back button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getBackButton() {
|
||||
return getRawButton(Button.kBack.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the back button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getBackButtonPressed() {
|
||||
return getRawButtonPressed(Button.kBack.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the back button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getBackButtonReleased() {
|
||||
return getRawButtonReleased(Button.kBack.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return button(Button.kBack.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the start button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getStartButton() {
|
||||
return getRawButton(Button.kStart.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the start button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getStartButtonPressed() {
|
||||
return getRawButtonPressed(Button.kStart.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the start button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getStartButtonReleased() {
|
||||
return getRawButtonReleased(Button.kStart.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return button(Button.kStart.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left stick button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getLeftStickButton() {
|
||||
return getRawButton(Button.kLeftStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left stick button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getLeftStickButtonPressed() {
|
||||
return getRawButtonPressed(Button.kLeftStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left stick button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getLeftStickButtonReleased() {
|
||||
return getRawButtonReleased(Button.kLeftStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return button(Button.kLeftStick.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right stick button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
*/
|
||||
public boolean getRightStickButton() {
|
||||
return getRawButton(Button.kRightStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right stick button was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
*/
|
||||
public boolean getRightStickButtonPressed() {
|
||||
return getRawButtonPressed(Button.kRightStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right stick button was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
*/
|
||||
public boolean getRightStickButtonReleased() {
|
||||
return getRawButtonReleased(Button.kRightStick.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
return button(Button.kRightStick.value, loop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the left bumper (LB) button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
* @deprecated Use {@link getLeftBumperButton} instead. This function is deprecated for removal
|
||||
* to make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getLeftBumper() {
|
||||
return getRawButton(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the value of the right bumper (RB) button on the controller.
|
||||
*
|
||||
* @return The state of the button.
|
||||
* @deprecated Use {@link getRightBumperButton} instead. This function is deprecated for removal
|
||||
* to make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getRightBumper() {
|
||||
return getRawButton(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left bumper (LB) was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
* @deprecated Use {@link getLeftBumperButtonPressed} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getLeftBumperPressed() {
|
||||
return getRawButtonPressed(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right bumper (RB) was pressed since the last check.
|
||||
*
|
||||
* @return Whether the button was pressed since the last check.
|
||||
* @deprecated Use {@link getRightBumperButtonPressed} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getRightBumperPressed() {
|
||||
return getRawButtonPressed(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the left bumper (LB) was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
* @deprecated Use {@link getLeftBumperButtonReleased} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getLeftBumperReleased() {
|
||||
return getRawButtonReleased(Button.kLeftBumper.value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the right bumper (RB) was released since the last check.
|
||||
*
|
||||
* @return Whether the button was released since the last check.
|
||||
* @deprecated Use {@link getRightBumperButtonReleased} instead. This function is deprecated for
|
||||
* removal to make function names consistent to allow the HID classes to be automatically
|
||||
* generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public boolean getRightBumperReleased() {
|
||||
return getRawButtonReleased(Button.kRightBumper.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initSendable(SendableBuilder builder) {
|
||||
builder.setSmartDashboardType("HID");
|
||||
builder.publishConstString("ControllerType", "Xbox");
|
||||
builder.addDoubleProperty("LeftTrigger Axis", this::getLeftTriggerAxis, null);
|
||||
builder.addDoubleProperty("RightTrigger Axis", this::getRightTriggerAxis, null);
|
||||
builder.addDoubleProperty("LeftX", this::getLeftX, null);
|
||||
builder.addDoubleProperty("RightX", this::getRightX, null);
|
||||
builder.addDoubleProperty("LeftY", this::getLeftY, null);
|
||||
builder.addDoubleProperty("RightY", this::getRightY, null);
|
||||
builder.addBooleanProperty("A", this::getAButton, null);
|
||||
builder.addBooleanProperty("B", this::getBButton, null);
|
||||
builder.addBooleanProperty("X", this::getXButton, null);
|
||||
builder.addBooleanProperty("Y", this::getYButton, null);
|
||||
builder.addBooleanProperty("LeftBumper", this::getLeftBumperButton, null);
|
||||
builder.addBooleanProperty("RightBumper", this::getRightBumperButton, null);
|
||||
builder.addBooleanProperty("Back", this::getBackButton, null);
|
||||
builder.addBooleanProperty("Start", this::getStartButton, null);
|
||||
builder.addBooleanProperty("LeftStick", this::getLeftStickButton, null);
|
||||
builder.addBooleanProperty("RightStick", this::getRightStickButton, null);
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/Koors40.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/Koors40.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* AndyMark Koors40 Motor Controller.
|
||||
*
|
||||
* <p>Note that the Koors40 uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Koors40 User Manual available from
|
||||
* AndyMark.
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.004ms = full "forward"
|
||||
* <li>1.520ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.480ms = the "low end" of the deadband range
|
||||
* <li>0.997ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class Koors40 extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the Koors40 is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public Koors40(final int channel) {
|
||||
super("Koors40", channel);
|
||||
|
||||
setBoundsMicroseconds(2004, 1520, 1500, 1480, 997);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k20Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "Koors40");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMSparkFlex.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMSparkFlex.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* REV Robotics SPARK Flex Motor Controller.
|
||||
*
|
||||
* <p>Note that the SPARK Flex uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the SPARK Flex User Manual available from
|
||||
* REV Robotics.
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.003ms = full "forward"
|
||||
* <li>1.550ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.460ms = the "low end" of the deadband range
|
||||
* <li>0.999ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class PWMSparkFlex extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the SPARK Flex is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PWMSparkFlex(final int channel) {
|
||||
super("PWMSparkFlex", channel);
|
||||
|
||||
setBoundsMicroseconds(2003, 1550, 1500, 1460, 999);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "RevSparkFlexPWM");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMSparkMax.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMSparkMax.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* REV Robotics SPARK MAX Motor Controller.
|
||||
*
|
||||
* <p>Note that the SPARK MAX uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the SPARK MAX User Manual available from
|
||||
* REV Robotics.
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.003ms = full "forward"
|
||||
* <li>1.550ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.460ms = the "low end" of the deadband range
|
||||
* <li>0.999ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class PWMSparkMax extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the SPARK MAX is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PWMSparkMax(final int channel) {
|
||||
super("PWMSparkMax", channel);
|
||||
|
||||
setBoundsMicroseconds(2003, 1550, 1500, 1460, 999);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "RevSparkMaxPWM");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMTalonFX.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMTalonFX.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* Cross the Road Electronics (CTRE) Talon FX Motor Controller.
|
||||
*
|
||||
* <p>Note that the Talon FX uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Talon FX User Manual available from
|
||||
* Cross the Road Electronics (CTRE).
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.004ms = full "forward"
|
||||
* <li>1.520ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.480ms = the "low end" of the deadband range
|
||||
* <li>0.997ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class PWMTalonFX extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the Talon FX is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PWMTalonFX(final int channel) {
|
||||
super("PWMTalonFX", channel);
|
||||
|
||||
setBoundsMicroseconds(2004, 1520, 1500, 1480, 997);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "TalonFX");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMTalonSRX.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMTalonSRX.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* Cross the Road Electronics (CTRE) Talon SRX Motor Controller.
|
||||
*
|
||||
* <p>Note that the Talon SRX uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Talon SRX User Manual available from
|
||||
* Cross the Road Electronics (CTRE).
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.004ms = full "forward"
|
||||
* <li>1.520ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.480ms = the "low end" of the deadband range
|
||||
* <li>0.997ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class PWMTalonSRX extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the Talon SRX is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PWMTalonSRX(final int channel) {
|
||||
super("PWMTalonSRX", channel);
|
||||
|
||||
setBoundsMicroseconds(2004, 1520, 1500, 1480, 997);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "PWMTalonSRX");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMVenom.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMVenom.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* Playing with Fusion Venom Motor Controller.
|
||||
*
|
||||
* <p>Note that the Venom uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Venom User Manual available from
|
||||
* Playing with Fusion.
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.004ms = full "forward"
|
||||
* <li>1.520ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.480ms = the "low end" of the deadband range
|
||||
* <li>0.997ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class PWMVenom extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the Venom is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PWMVenom(final int channel) {
|
||||
super("PWMVenom", channel);
|
||||
|
||||
setBoundsMicroseconds(2004, 1520, 1500, 1480, 997);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "FusionVenom");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMVictorSPX.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/PWMVictorSPX.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* Cross the Road Electronics (CTRE) Victor SPX Motor Controller.
|
||||
*
|
||||
* <p>Note that the Victor SPX uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Victor SPX User Manual available from
|
||||
* Cross the Road Electronics (CTRE).
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.004ms = full "forward"
|
||||
* <li>1.520ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.480ms = the "low end" of the deadband range
|
||||
* <li>0.997ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class PWMVictorSPX extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the Victor SPX is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PWMVictorSPX(final int channel) {
|
||||
super("PWMVictorSPX", channel);
|
||||
|
||||
setBoundsMicroseconds(2004, 1520, 1500, 1480, 997);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "PWMVictorSPX");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/Spark.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/Spark.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* REV Robotics SPARK Motor Controller.
|
||||
*
|
||||
* <p>Note that the SPARK uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the SPARK User Manual available from
|
||||
* REV Robotics.
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.003ms = full "forward"
|
||||
* <li>1.550ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.460ms = the "low end" of the deadband range
|
||||
* <li>0.999ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class Spark extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the SPARK is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public Spark(final int channel) {
|
||||
super("Spark", channel);
|
||||
|
||||
setBoundsMicroseconds(2003, 1550, 1500, 1460, 999);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "RevSPARK");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/SparkMini.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/SparkMini.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* REV Robotics SPARKMini Motor Controller.
|
||||
*
|
||||
* <p>Note that the SPARKMini uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the SPARKMini User Manual available from
|
||||
* REV Robotics.
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.500ms = full "forward"
|
||||
* <li>1.510ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.490ms = the "low end" of the deadband range
|
||||
* <li>0.500ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class SparkMini extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the SPARKMini is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public SparkMini(final int channel) {
|
||||
super("SparkMini", channel);
|
||||
|
||||
setBoundsMicroseconds(2500, 1510, 1500, 1490, 500);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "RevSPARK");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/Talon.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/Talon.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* Cross the Road Electronics (CTRE) Talon Motor Controller.
|
||||
*
|
||||
* <p>Note that the Talon uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Talon User Manual available from
|
||||
* Cross the Road Electronics (CTRE).
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.037ms = full "forward"
|
||||
* <li>1.539ms = the "high end" of the deadband range
|
||||
* <li>1.513ms = center of the deadband range (off)
|
||||
* <li>1.487ms = the "low end" of the deadband range
|
||||
* <li>0.989ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class Talon extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the Talon is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public Talon(final int channel) {
|
||||
super("Talon", channel);
|
||||
|
||||
setBoundsMicroseconds(2037, 1539, 1513, 1487, 989);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "Talon");
|
||||
}
|
||||
}
|
||||
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/VictorSP.java
generated
Normal file
46
wpilibj/src/generated/main/java/org/wpilib/hardware/motor/VictorSP.java
generated
Normal file
@@ -0,0 +1,46 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_pwm_motor_controllers.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.motorcontrol;
|
||||
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
|
||||
/**
|
||||
* Vex Robotics Victor SP Motor Controller.
|
||||
*
|
||||
* <p>Note that the Victor SP uses the following bounds for PWM values. These values should work
|
||||
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
|
||||
* around the deadband or inability to saturate the controller in either direction, calibration is
|
||||
* recommended. The calibration procedure can be found in the Victor SP User Manual available from
|
||||
* Vex Robotics.
|
||||
*
|
||||
* <ul>
|
||||
* <li>2.004ms = full "forward"
|
||||
* <li>1.520ms = the "high end" of the deadband range
|
||||
* <li>1.500ms = center of the deadband range (off)
|
||||
* <li>1.480ms = the "low end" of the deadband range
|
||||
* <li>0.997ms = full "reverse"
|
||||
* </ul>
|
||||
*/
|
||||
public class VictorSP extends PWMMotorController {
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param channel The PWM channel that the Victor SP is attached to. 0-9 are on-board, 10-19
|
||||
* are on the MXP port
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public VictorSP(final int channel) {
|
||||
super("VictorSP", channel);
|
||||
|
||||
setBoundsMicroseconds(2004, 1520, 1500, 1480, 997);
|
||||
m_pwm.setOutputPeriod(PWM.OutputPeriod.k5Ms);
|
||||
setSpeed(0.0);
|
||||
|
||||
HAL.reportUsage("IO", getChannel(), "VictorSP");
|
||||
}
|
||||
}
|
||||
230
wpilibj/src/generated/main/java/org/wpilib/simulation/PS4ControllerSim.java
generated
Normal file
230
wpilibj/src/generated/main/java/org/wpilib/simulation/PS4ControllerSim.java
generated
Normal file
@@ -0,0 +1,230 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_hids.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.simulation;
|
||||
|
||||
import edu.wpi.first.wpilibj.PS4Controller;
|
||||
|
||||
/** Class to control a simulated PS4 controller. */
|
||||
public class PS4ControllerSim extends GenericHIDSim {
|
||||
/**
|
||||
* Constructs from a PS4Controller object.
|
||||
*
|
||||
* @param joystick controller to simulate
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PS4ControllerSim(PS4Controller joystick) {
|
||||
super(joystick);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(14);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs from a joystick port number.
|
||||
*
|
||||
* @param port port number
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PS4ControllerSim(int port) {
|
||||
super(port);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(14);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the left X value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftX(double value) {
|
||||
setRawAxis(PS4Controller.Axis.kLeftX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the left Y value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftY(double value) {
|
||||
setRawAxis(PS4Controller.Axis.kLeftY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the right X value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightX(double value) {
|
||||
setRawAxis(PS4Controller.Axis.kRightX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the right Y value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightY(double value) {
|
||||
setRawAxis(PS4Controller.Axis.kRightY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left trigger 2 axis on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setL2Axis(double value) {
|
||||
setRawAxis(PS4Controller.Axis.kL2.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right trigger 2 axis on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setR2Axis(double value) {
|
||||
setRawAxis(PS4Controller.Axis.kR2.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the square button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setSquareButton(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kSquare.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the cross button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setCrossButton(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kCross.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the circle button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setCircleButton(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kCircle.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the triangle button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setTriangleButton(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kTriangle.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left trigger 1 button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setL1Button(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kL1.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right trigger 1 button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setR1Button(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kR1.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left trigger 2 button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setL2Button(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kL2.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right trigger 2 button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setR2Button(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kR2.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the share button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setShareButton(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kShare.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the options button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setOptionsButton(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kOptions.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the L3 (left stick) button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setL3Button(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kL3.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the R3 (right stick) button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setR3Button(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kR3.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the PlayStation button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setPSButton(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kPS.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the touchpad button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setTouchpadButton(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kTouchpad.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the touchpad button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
* @deprecated Use {@link setTouchpadButton} instead. This function is deprecated for removal to
|
||||
* make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public void setTouchpad(boolean value) {
|
||||
setRawButton(PS4Controller.Button.kTouchpad.value, value);
|
||||
}
|
||||
}
|
||||
230
wpilibj/src/generated/main/java/org/wpilib/simulation/PS5ControllerSim.java
generated
Normal file
230
wpilibj/src/generated/main/java/org/wpilib/simulation/PS5ControllerSim.java
generated
Normal file
@@ -0,0 +1,230 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_hids.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.simulation;
|
||||
|
||||
import edu.wpi.first.wpilibj.PS5Controller;
|
||||
|
||||
/** Class to control a simulated PS5 controller. */
|
||||
public class PS5ControllerSim extends GenericHIDSim {
|
||||
/**
|
||||
* Constructs from a PS5Controller object.
|
||||
*
|
||||
* @param joystick controller to simulate
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PS5ControllerSim(PS5Controller joystick) {
|
||||
super(joystick);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(14);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs from a joystick port number.
|
||||
*
|
||||
* @param port port number
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public PS5ControllerSim(int port) {
|
||||
super(port);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(14);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the left X value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftX(double value) {
|
||||
setRawAxis(PS5Controller.Axis.kLeftX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the left Y value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftY(double value) {
|
||||
setRawAxis(PS5Controller.Axis.kLeftY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the right X value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightX(double value) {
|
||||
setRawAxis(PS5Controller.Axis.kRightX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the right Y value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightY(double value) {
|
||||
setRawAxis(PS5Controller.Axis.kRightY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left trigger 2 axis on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setL2Axis(double value) {
|
||||
setRawAxis(PS5Controller.Axis.kL2.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right trigger 2 axis on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setR2Axis(double value) {
|
||||
setRawAxis(PS5Controller.Axis.kR2.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the square button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setSquareButton(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kSquare.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the cross button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setCrossButton(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kCross.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the circle button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setCircleButton(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kCircle.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the triangle button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setTriangleButton(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kTriangle.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left trigger 1 button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setL1Button(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kL1.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right trigger 1 button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setR1Button(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kR1.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left trigger 2 button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setL2Button(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kL2.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right trigger 2 button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setR2Button(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kR2.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the create button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setCreateButton(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kCreate.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the options button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setOptionsButton(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kOptions.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the L3 (left stick) button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setL3Button(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kL3.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the R3 (right stick) button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setR3Button(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kR3.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the PlayStation button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setPSButton(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kPS.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the touchpad button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setTouchpadButton(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kTouchpad.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the touchpad button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
* @deprecated Use {@link setTouchpadButton} instead. This function is deprecated for removal to
|
||||
* make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public void setTouchpad(boolean value) {
|
||||
setRawButton(PS5Controller.Button.kTouchpad.value, value);
|
||||
}
|
||||
}
|
||||
209
wpilibj/src/generated/main/java/org/wpilib/simulation/StadiaControllerSim.java
generated
Normal file
209
wpilibj/src/generated/main/java/org/wpilib/simulation/StadiaControllerSim.java
generated
Normal file
@@ -0,0 +1,209 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_hids.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.simulation;
|
||||
|
||||
import edu.wpi.first.wpilibj.StadiaController;
|
||||
|
||||
/** Class to control a simulated Stadia controller. */
|
||||
public class StadiaControllerSim extends GenericHIDSim {
|
||||
/**
|
||||
* Constructs from a StadiaController object.
|
||||
*
|
||||
* @param joystick controller to simulate
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public StadiaControllerSim(StadiaController joystick) {
|
||||
super(joystick);
|
||||
setAxesMaximumIndex(4);
|
||||
setButtonsMaximumIndex(15);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs from a joystick port number.
|
||||
*
|
||||
* @param port port number
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public StadiaControllerSim(int port) {
|
||||
super(port);
|
||||
setAxesMaximumIndex(4);
|
||||
setButtonsMaximumIndex(15);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the left X value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftX(double value) {
|
||||
setRawAxis(StadiaController.Axis.kLeftX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the right X value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightX(double value) {
|
||||
setRawAxis(StadiaController.Axis.kRightX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the left Y value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftY(double value) {
|
||||
setRawAxis(StadiaController.Axis.kLeftY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the right Y value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightY(double value) {
|
||||
setRawAxis(StadiaController.Axis.kRightY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the A button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setAButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kA.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the B button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setBButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kB.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the X button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setXButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the Y button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setYButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left bumper button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftBumperButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kLeftBumper.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right bumper button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightBumperButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kRightBumper.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left stick button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftStickButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kLeftStick.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right stick button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightStickButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kRightStick.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the ellipses button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setEllipsesButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kEllipses.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the hamburger button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setHamburgerButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kHamburger.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the stadia button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setStadiaButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kStadia.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right trigger button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightTriggerButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kRightTrigger.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left trigger button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftTriggerButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kLeftTrigger.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the google button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setGoogleButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kGoogle.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the frame button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setFrameButton(boolean value) {
|
||||
setRawButton(StadiaController.Button.kFrame.value, value);
|
||||
}
|
||||
}
|
||||
206
wpilibj/src/generated/main/java/org/wpilib/simulation/XboxControllerSim.java
generated
Normal file
206
wpilibj/src/generated/main/java/org/wpilib/simulation/XboxControllerSim.java
generated
Normal file
@@ -0,0 +1,206 @@
|
||||
// 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.
|
||||
|
||||
// THIS FILE WAS AUTO-GENERATED BY ./wpilibj/generate_hids.py. DO NOT MODIFY
|
||||
|
||||
package edu.wpi.first.wpilibj.simulation;
|
||||
|
||||
import edu.wpi.first.wpilibj.XboxController;
|
||||
|
||||
/** Class to control a simulated Xbox controller. */
|
||||
public class XboxControllerSim extends GenericHIDSim {
|
||||
/**
|
||||
* Constructs from a XboxController object.
|
||||
*
|
||||
* @param joystick controller to simulate
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public XboxControllerSim(XboxController joystick) {
|
||||
super(joystick);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(10);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs from a joystick port number.
|
||||
*
|
||||
* @param port port number
|
||||
*/
|
||||
@SuppressWarnings("this-escape")
|
||||
public XboxControllerSim(int port) {
|
||||
super(port);
|
||||
setAxesMaximumIndex(6);
|
||||
setButtonsMaximumIndex(10);
|
||||
setPOVsMaximumIndex(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the left X value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftX(double value) {
|
||||
setRawAxis(XboxController.Axis.kLeftX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the right X value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightX(double value) {
|
||||
setRawAxis(XboxController.Axis.kRightX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the left Y value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftY(double value) {
|
||||
setRawAxis(XboxController.Axis.kLeftY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the right Y value of the controller's joystick.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightY(double value) {
|
||||
setRawAxis(XboxController.Axis.kRightY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left trigger axis on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftTriggerAxis(double value) {
|
||||
setRawAxis(XboxController.Axis.kLeftTrigger.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right trigger axis on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightTriggerAxis(double value) {
|
||||
setRawAxis(XboxController.Axis.kRightTrigger.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the A button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setAButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kA.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the B button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setBButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kB.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the X button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setXButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kX.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the Y button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setYButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kY.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left bumper button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftBumperButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kLeftBumper.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right bumper button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightBumperButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kRightBumper.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the back button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setBackButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kBack.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the start button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setStartButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kStart.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left stick button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setLeftStickButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kLeftStick.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right stick button on the controller.
|
||||
*
|
||||
* @param value the new value
|
||||
*/
|
||||
public void setRightStickButton(boolean value) {
|
||||
setRawButton(XboxController.Button.kRightStick.value, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the left bumper on the joystick.
|
||||
*
|
||||
* @param state the new value
|
||||
* @deprecated Use {@link setLeftBumperButton} instead. This function is deprecated for removal
|
||||
* to make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public void setLeftBumper(boolean state) {
|
||||
setRawButton(XboxController.Button.kLeftBumper.value, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the value of the right bumper on the joystick.
|
||||
*
|
||||
* @param state the new value
|
||||
* @deprecated Use {@link setRightBumperButton} instead. This function is deprecated for removal
|
||||
* to make function names consistent to allow the HID classes to be automatically generated.
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public void setRightBumper(boolean state) {
|
||||
setRawButton(XboxController.Button.kRightBumper.value, state);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user