Class XboxController
- java.lang.Object
-
- edu.wpi.first.wpilibj.GenericHID
-
- edu.wpi.first.wpilibj.XboxController
-
- com.alumiboti5590.eop.controllers.XboxController
-
public class XboxController extends edu.wpi.first.wpilibj.XboxController
A subclass of the WPILib XboxController containing useful additions such as deadzone management and Triggers for Command-based programming. It aims to be a mix between XboxController and CommandXboxController which are provided by WPILib. This class works for both Xbox 360 and Xbox One controllers.- See Also:
- WPILib XboxController, Joysticks on WPILib
-
-
Constructor Summary
Constructors Constructor Description XboxController(int port)
Creates a new XboxController listener on the provided port.XboxController(int port, double triggerAsTriggerDeadzones)
Creates a new XboxController listener on the provided port with the provided deadzone values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description edu.wpi.first.wpilibj2.command.button.Trigger
getAButtonTrigger()
Returns the A button press as a Trigger to be used in Command-based programming.edu.wpi.first.wpilibj2.command.button.Trigger
getBackButtonTrigger()
Returns the Back button press as a Trigger to be used in Command-based programming.edu.wpi.first.wpilibj2.command.button.Trigger
getBButtonTrigger()
Returns the B button press as a Trigger to be used in Command-based programming.edu.wpi.first.wpilibj2.command.button.Trigger
getLeftBumperTrigger()
Returns the Left Bumper button press as a Trigger to be used in Command-based programming.edu.wpi.first.wpilibj2.command.button.Trigger
getLeftStickButtonTrigger()
Returns the Left Stick button press as a Trigger to be used in Command-based programming.edu.wpi.first.wpilibj2.command.button.Trigger
getLeftTrigger()
Returns the Left Trigger pressed as a Trigger to be used in Command-based programming.boolean
getLeftTriggerPressed()
Returns if the Left Trigger axis is pushed in enough to be considered "pressed", usingtriggerAsTriggerDeadzones
as the minimum value required to be considered "pressed".edu.wpi.first.wpilibj2.command.button.Trigger
getRightBumperTrigger()
Returns the Right Bumper button press as a Trigger to be used in Command-based programming.edu.wpi.first.wpilibj2.command.button.Trigger
getRightStickButtonTrigger()
Returns the Right Stick button press as a Trigger to be used in Command-based programming.edu.wpi.first.wpilibj2.command.button.Trigger
getRightTrigger()
Returns the Right Trigger pressed as a Trigger to be used in Command-based programming.boolean
getRightTriggerPressed()
Returns if the Right Trigger axis is pushed in enough to be considered "pressed", usingtriggerAsTriggerDeadzones
as the minimum value required to be considered "pressed".edu.wpi.first.wpilibj2.command.button.Trigger
getStartButtonTrigger()
Returns the Start button press as a Trigger to be used in Command-based programming.edu.wpi.first.wpilibj2.command.button.Trigger
getXButtonTrigger()
Returns the X button press as a Trigger to be used in Command-based programming.edu.wpi.first.wpilibj2.command.button.Trigger
getYButtonTrigger()
Returns the Y button press as a Trigger to be used in Command-based programming.-
Methods inherited from class edu.wpi.first.wpilibj.XboxController
a, b, back, getAButton, getAButtonPressed, getAButtonReleased, getBackButton, getBackButtonPressed, getBackButtonReleased, getBButton, getBButtonPressed, getBButtonReleased, getLeftBumper, getLeftBumperPressed, getLeftBumperReleased, getLeftStickButton, getLeftStickButtonPressed, getLeftStickButtonReleased, getLeftTriggerAxis, getLeftX, getLeftY, getRightBumper, getRightBumperPressed, getRightBumperReleased, getRightStickButton, getRightStickButtonPressed, getRightStickButtonReleased, getRightTriggerAxis, getRightX, getRightY, getStartButton, getStartButtonPressed, getStartButtonReleased, getXButton, getXButtonPressed, getXButtonReleased, getYButton, getYButtonPressed, getYButtonReleased, leftBumper, leftStick, leftTrigger, leftTrigger, rightBumper, rightStick, rightTrigger, rightTrigger, start, x, y
-
Methods inherited from class edu.wpi.first.wpilibj.GenericHID
axisGreaterThan, axisLessThan, button, getAxisCount, getAxisType, getButtonCount, getName, getPort, getPOV, getPOV, getPOVCount, getRawAxis, getRawButton, getRawButtonPressed, getRawButtonReleased, getType, isConnected, pov, pov, povCenter, povDown, povDownLeft, povDownRight, povLeft, povRight, povUp, povUpLeft, povUpRight, setOutput, setOutputs, setRumble
-
-
-
-
Constructor Detail
-
XboxController
public XboxController(int port)
Creates a new XboxController listener on the provided port. The port is managed by the USB tab of the Driver Station, and you can 'Rescan' and 'Drag-n-Drop' reorder the controllers to make them fit what is expected.- Parameters:
port
- the port of the controller in Driver Station
-
XboxController
public XboxController(int port, double triggerAsTriggerDeadzones)
Creates a new XboxController listener on the provided port with the provided deadzone values. The port is managed by the USB tab of the Driver Station, and you can 'Rescan' and 'Drag-n-Drop' reorder the controllers to make them fit what is expected.- Parameters:
port
- the port of the controller in Driver StationtriggerAsTriggerDeadzones
- the minimum value to register a trigger as being "pressed"
-
-
Method Detail
-
getAButtonTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getAButtonTrigger()
Returns the A button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getBackButtonTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getBackButtonTrigger()
Returns the Back button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getBButtonTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getBButtonTrigger()
Returns the B button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getLeftBumperTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getLeftBumperTrigger()
Returns the Left Bumper button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getLeftStickButtonTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getLeftStickButtonTrigger()
Returns the Left Stick button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getLeftTriggerPressed
public boolean getLeftTriggerPressed()
Returns if the Left Trigger axis is pushed in enough to be considered "pressed", usingtriggerAsTriggerDeadzones
as the minimum value required to be considered "pressed".- Returns:
- if the trigger is pressed or not
-
getLeftTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getLeftTrigger()
Returns the Left Trigger pressed as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getRightBumperTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getRightBumperTrigger()
Returns the Right Bumper button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getRightStickButtonTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getRightStickButtonTrigger()
Returns the Right Stick button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getRightTriggerPressed
public boolean getRightTriggerPressed()
Returns if the Right Trigger axis is pushed in enough to be considered "pressed", usingtriggerAsTriggerDeadzones
as the minimum value required to be considered "pressed".- Returns:
- if the trigger is pressed or not
-
getRightTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getRightTrigger()
Returns the Right Trigger pressed as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getStartButtonTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getStartButtonTrigger()
Returns the Start button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getXButtonTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getXButtonTrigger()
Returns the X button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
getYButtonTrigger
public edu.wpi.first.wpilibj2.command.button.Trigger getYButtonTrigger()
Returns the Y button press as a Trigger to be used in Command-based programming.- Returns:
- the button as a Trigger
- See Also:
- Binding Commands to Triggers
-
-