Package edu.wpi.first.wpilibj
Class StadiaController
java.lang.Object
edu.wpi.first.wpilibj.GenericHID
edu.wpi.first.wpilibj.StadiaController
- All Implemented Interfaces:
Sendable
Handle input from Stadia controllers connected to the Driver Station.
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.
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Represents an axis on an StadiaController.static enum
Represents a digital button on a StadiaController.Nested classes/interfaces inherited from class edu.wpi.first.wpilibj.GenericHID
GenericHID.HIDType, GenericHID.RumbleType
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionConstructs an event instance around the A button's digital signal.Constructs an event instance around the B button's digital signal.Constructs an event instance around the ellipses button's digital signal.Constructs an event instance around the frame button's digital signal.boolean
Read the value of the A button on the controller.boolean
Whether the A button was pressed since the last check.boolean
Whether the A button was released since the last check.boolean
Read the value of the B button on the controller.boolean
Whether the B button was pressed since the last check.boolean
Whether the B button was released since the last check.boolean
Read the value of the ellipses button on the controller.boolean
Whether the ellipses button was pressed since the last check.boolean
Whether the ellipses button was released since the last check.boolean
Read the value of the frame button on the controller.boolean
Whether the frame button was pressed since the last check.boolean
Whether the frame button was released since the last check.boolean
Read the value of the google button on the controller.boolean
Whether the google button was pressed since the last check.boolean
Whether the google button was released since the last check.boolean
Read the value of the hamburger button on the controller.boolean
Whether the hamburger button was pressed since the last check.boolean
Whether the hamburger button was released since the last check.boolean
Deprecated, for removal: This API element is subject to removal in a future version.boolean
Read the value of the left bumper button on the controller.boolean
Whether the left bumper button was pressed since the last check.boolean
Whether the left bumper button was released since the last check.boolean
Deprecated, for removal: This API element is subject to removal in a future version.UsegetLeftBumperButtonPressed()
instead.boolean
Deprecated, for removal: This API element is subject to removal in a future version.UsegetLeftBumperButtonReleased()
instead.boolean
Read the value of the left stick button on the controller.boolean
Whether the left stick button was pressed since the last check.boolean
Whether the left stick button was released since the last check.boolean
Read the value of the left trigger button on the controller.boolean
Whether the left trigger button was pressed since the last check.boolean
Whether the left trigger button was released since the last check.double
getLeftX()
Get the X axis value of left side of the controller.double
getLeftY()
Get the Y axis value of left side of the controller.boolean
Deprecated, for removal: This API element is subject to removal in a future version.UsegetRightBumperButton()
instead.boolean
Read the value of the right bumper button on the controller.boolean
Whether the right bumper button was pressed since the last check.boolean
Whether the right bumper button was released since the last check.boolean
Deprecated, for removal: This API element is subject to removal in a future version.UsegetRightBumperButtonPressed()
instead.boolean
Deprecated, for removal: This API element is subject to removal in a future version.UsegetRightBumperButtonReleased()
instead.boolean
Read the value of the right stick button on the controller.boolean
Whether the right stick button was pressed since the last check.boolean
Whether the right stick button was released since the last check.boolean
Read the value of the right trigger button on the controller.boolean
Whether the right trigger button was pressed since the last check.boolean
Whether the right trigger button was released since the last check.double
Get the X axis value of right side of the controller.double
Get the Y axis value of right side of the controller.boolean
Read the value of the stadia button on the controller.boolean
Whether the stadia button was pressed since the last check.boolean
Whether the stadia button was released since the last check.boolean
Read the value of the X button on the controller.boolean
Whether the X button was pressed since the last check.boolean
Whether the X button was released since the last check.boolean
Read the value of the Y button on the controller.boolean
Whether the Y button was pressed since the last check.boolean
Whether the Y button was released since the last check.Constructs an event instance around the google button's digital signal.Constructs an event instance around the hamburger button's digital signal.void
initSendable
(SendableBuilder builder) Initializes thisSendable
object.leftBumper
(EventLoop loop) Constructs an event instance around the left bumper button's digital signal.Constructs an event instance around the left stick button's digital signal.leftTrigger
(EventLoop loop) Constructs an event instance around the left trigger button's digital signal.rightBumper
(EventLoop loop) Constructs an event instance around the right bumper button's digital signal.rightStick
(EventLoop loop) Constructs an event instance around the right stick button's digital signal.rightTrigger
(EventLoop loop) Constructs an event instance around the right trigger button's digital signal.Constructs an event instance around the stadia button's digital signal.Constructs an event instance around the X button's digital signal.Constructs an event instance around the Y button's digital signal.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 Details
-
StadiaController
Construct an instance of a controller.- Parameters:
port
- The port index on the Driver Station that the controller is plugged into (0-5).
-
-
Method Details
-
getLeftX
Get the X axis value of left side of the controller.- Returns:
- The axis value.
-
getRightX
Get the X axis value of right side of the controller.- Returns:
- The axis value.
-
getLeftY
Get the Y axis value of left side of the controller.- Returns:
- The axis value.
-
getRightY
Get the Y axis value of right side of the controller.- Returns:
- The axis value.
-
getAButton
Read the value of the A button on the controller.- Returns:
- The state of the button.
-
getAButtonPressed
Whether the A button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getAButtonReleased
Whether the A button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
a
Constructs an event instance around the A button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the A button's digital signal attached to the given loop.
-
getBButton
Read the value of the B button on the controller.- Returns:
- The state of the button.
-
getBButtonPressed
Whether the B button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getBButtonReleased
Whether the B button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
b
Constructs an event instance around the B button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the B button's digital signal attached to the given loop.
-
getXButton
Read the value of the X button on the controller.- Returns:
- The state of the button.
-
getXButtonPressed
Whether the X button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getXButtonReleased
Whether the X button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
x
Constructs an event instance around the X button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the X button's digital signal attached to the given loop.
-
getYButton
Read the value of the Y button on the controller.- Returns:
- The state of the button.
-
getYButtonPressed
Whether the Y button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getYButtonReleased
Whether the Y button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
y
Constructs an event instance around the Y button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the Y button's digital signal attached to the given loop.
-
getLeftBumperButton
Read the value of the left bumper button on the controller.- Returns:
- The state of the button.
-
getLeftBumperButtonPressed
Whether the left bumper button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftBumperButtonReleased
Whether the left bumper button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
leftBumper
Constructs an event instance around the left bumper button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the left bumper button's digital signal attached to the given loop.
-
getRightBumperButton
Read the value of the right bumper button on the controller.- Returns:
- The state of the button.
-
getRightBumperButtonPressed
Whether the right bumper button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightBumperButtonReleased
Whether the right bumper button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
rightBumper
Constructs an event instance around the right bumper button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the right bumper button's digital signal attached to the given loop.
-
getLeftStickButton
Read the value of the left stick button on the controller.- Returns:
- The state of the button.
-
getLeftStickButtonPressed
Whether the left stick button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftStickButtonReleased
Whether the left stick button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
leftStick
Constructs an event instance around the left stick button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the left stick button's digital signal attached to the given loop.
-
getRightStickButton
Read the value of the right stick button on the controller.- Returns:
- The state of the button.
-
getRightStickButtonPressed
Whether the right stick button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightStickButtonReleased
Whether the right stick button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
rightStick
Constructs an event instance around the right stick button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the right stick button's digital signal attached to the given loop.
-
getEllipsesButton
Read the value of the ellipses button on the controller.- Returns:
- The state of the button.
-
getEllipsesButtonPressed
Whether the ellipses button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getEllipsesButtonReleased
Whether the ellipses button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
ellipses
Constructs an event instance around the ellipses button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the ellipses button's digital signal attached to the given loop.
-
getHamburgerButton
Read the value of the hamburger button on the controller.- Returns:
- The state of the button.
-
getHamburgerButtonPressed
Whether the hamburger button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getHamburgerButtonReleased
Whether the hamburger button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
hamburger
Constructs an event instance around the hamburger button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the hamburger button's digital signal attached to the given loop.
-
getStadiaButton
Read the value of the stadia button on the controller.- Returns:
- The state of the button.
-
getStadiaButtonPressed
Whether the stadia button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getStadiaButtonReleased
Whether the stadia button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
stadia
Constructs an event instance around the stadia button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the stadia button's digital signal attached to the given loop.
-
getRightTriggerButton
Read the value of the right trigger button on the controller.- Returns:
- The state of the button.
-
getRightTriggerButtonPressed
Whether the right trigger button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightTriggerButtonReleased
Whether the right trigger button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
rightTrigger
Constructs an event instance around the right trigger button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the right trigger button's digital signal attached to the given loop.
-
getLeftTriggerButton
Read the value of the left trigger button on the controller.- Returns:
- The state of the button.
-
getLeftTriggerButtonPressed
Whether the left trigger button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftTriggerButtonReleased
Whether the left trigger button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
leftTrigger
Constructs an event instance around the left trigger button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the left trigger button's digital signal attached to the given loop.
-
getGoogleButton
Read the value of the google button on the controller.- Returns:
- The state of the button.
-
getGoogleButtonPressed
Whether the google button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getGoogleButtonReleased
Whether the google button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
google
Constructs an event instance around the google button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the google button's digital signal attached to the given loop.
-
getFrameButton
Read the value of the frame button on the controller.- Returns:
- The state of the button.
-
getFrameButtonPressed
Whether the frame button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getFrameButtonReleased
Whether the frame button was released since the last check.- Returns:
- Whether the button was released since the last check.
-
frame
Constructs an event instance around the frame button's digital signal.- Parameters:
loop
- the event loop instance to attach the event to.- Returns:
- an event instance representing the frame button's digital signal attached to the given loop.
-
getLeftBumper
Deprecated, for removal: This API element is subject to removal in a future version.UsegetLeftBumperButton()
instead. This function is deprecated for removal to make function names consistent to allow the HID classes to be automatically generated.Read the value of the left bumper (LB) button on the controller.- Returns:
- The state of the button.
-
getRightBumper
Deprecated, for removal: This API element is subject to removal in a future version.UsegetRightBumperButton()
instead. This function is deprecated for removal to make function names consistent to allow the HID classes to be automatically generated.Read the value of the right bumper (RB) button on the controller.- Returns:
- The state of the button.
-
getLeftBumperPressed
Deprecated, for removal: This API element is subject to removal in a future version.UsegetLeftBumperButtonPressed()
instead. This function is deprecated for removal to make function names consistent to allow the HID classes to be automatically generated.Whether the left bumper (LB) was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightBumperPressed
Deprecated, for removal: This API element is subject to removal in a future version.UsegetRightBumperButtonPressed()
instead. This function is deprecated for removal to make function names consistent to allow the HID classes to be automatically generated.Whether the right bumper (RB) was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftBumperReleased
Deprecated, for removal: This API element is subject to removal in a future version.UsegetLeftBumperButtonReleased()
instead. This function is deprecated for removal to make function names consistent to allow the HID classes to be automatically generated.Whether the left bumper (LB) was released since the last check.- Returns:
- Whether the button was released since the last check.
-
getRightBumperReleased
Deprecated, for removal: This API element is subject to removal in a future version.UsegetRightBumperButtonReleased()
instead. This function is deprecated for removal to make function names consistent to allow the HID classes to be automatically generated.Whether the right bumper (RB) was released since the last check.- Returns:
- Whether the button was released since the last check.
-
initSendable
Description copied from interface:Sendable
Initializes thisSendable
object.- Specified by:
initSendable
in interfaceSendable
- Parameters:
builder
- sendable builder
-
getLeftBumperButton()
instead.