Class NiDsStadiaController
java.lang.Object
org.wpilib.driverstation.NiDsStadiaController
- All Implemented Interfaces:
HIDDevice, TelemetryLoggable
Handle input from NiDsStadia controllers connected to the Driver Station.
This class handles NiDsStadia 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
Nested ClassesModifier and TypeClassDescriptionstatic enumRepresents an axis on an NiDsStadiaController.static enumRepresents a digital button on a NiDsStadiaController. -
Constructor Summary
ConstructorsConstructorDescriptionNiDsStadiaController(int port) Construct an instance of a controller.Construct an instance of a controller with a GenericHID object. -
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.booleanRead the value of the A button on the controller.booleanWhether the A button was pressed since the last check.booleanWhether the A button was released since the last check.booleanRead the value of the B button on the controller.booleanWhether the B button was pressed since the last check.booleanWhether the B button was released since the last check.booleanRead the value of the ellipses button on the controller.booleanWhether the ellipses button was pressed since the last check.booleanWhether the ellipses button was released since the last check.booleanRead the value of the frame button on the controller.booleanWhether the frame button was pressed since the last check.booleanWhether the frame button was released since the last check.Get the type of the controller.booleanRead the value of the google button on the controller.booleanWhether the google button was pressed since the last check.booleanWhether the google button was released since the last check.booleanRead the value of the hamburger button on the controller.booleanWhether the hamburger button was pressed since the last check.booleanWhether the hamburger button was released since the last check.getHID()Get the underlying GenericHID object.booleanRead the value of the left bumper button on the controller.booleanWhether the left bumper button was pressed since the last check.booleanWhether the left bumper button was released since the last check.booleanRead the value of the left stick button on the controller.booleanWhether the left stick button was pressed since the last check.booleanWhether the left stick button was released since the last check.booleanRead the value of the left trigger button on the controller.booleanWhether the left trigger button was pressed since the last check.booleanWhether the left trigger button was released since the last check.doublegetLeftX()Get the X axis value of left side of the controller.doublegetLeftY()Get the Y axis value of left side of the controller.getName()Get the name of the controller.intgetPort()Get the port number of the controller.booleanRead the value of the right bumper button on the controller.booleanWhether the right bumper button was pressed since the last check.booleanWhether the right bumper button was released since the last check.booleanRead the value of the right stick button on the controller.booleanWhether the right stick button was pressed since the last check.booleanWhether the right stick button was released since the last check.booleanRead the value of the right trigger button on the controller.booleanWhether the right trigger button was pressed since the last check.booleanWhether the right trigger button was released since the last check.doubleGet the X axis value of right side of the controller.doubleGet the Y axis value of right side of the controller.booleanRead the value of the stadia button on the controller.booleanWhether the stadia button was pressed since the last check.booleanWhether the stadia button was released since the last check.Get the supported outputs of the controller.Gets the telemetry table type.booleanRead the value of the X button on the controller.booleanWhether the X button was pressed since the last check.booleanWhether the X button was released since the last check.booleanRead the value of the Y button on the controller.booleanWhether the Y button was pressed since the last check.booleanWhether 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.booleanGet if the controller is connected.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.voidlogTo(TelemetryTable table) Logs the object to aTelemetryTable.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.voidsetRumble(GenericHID.RumbleType type, double value) Set the rumble output for the HID.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.
-
Constructor Details
-
NiDsStadiaController
public NiDsStadiaController(int port) Construct an instance of a controller.- Parameters:
port- The port index on the Driver Station that the controller is plugged into (0-5).
-
NiDsStadiaController
Construct an instance of a controller with a GenericHID object.- Parameters:
hid- The GenericHID object to use for this controller.
-
-
Method Details
-
getHID
Get the underlying GenericHID object. -
getLeftX
public double getLeftX()Get the X axis value of left side of the controller. Right is positive.- Returns:
- The axis value.
-
getRightX
public double getRightX()Get the X axis value of right side of the controller. Right is positive.- Returns:
- The axis value.
-
getLeftY
public double getLeftY()Get the Y axis value of left side of the controller. Back is positive.- Returns:
- The axis value.
-
getRightY
public double getRightY()Get the Y axis value of right side of the controller. Back is positive.- Returns:
- The axis value.
-
getAButton
public boolean getAButton()Read the value of the A button on the controller.- Returns:
- The state of the button.
-
getAButtonPressed
public boolean getAButtonPressed()Whether the A button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getAButtonReleased
public boolean 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
public boolean getBButton()Read the value of the B button on the controller.- Returns:
- The state of the button.
-
getBButtonPressed
public boolean getBButtonPressed()Whether the B button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getBButtonReleased
public boolean 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
public boolean getXButton()Read the value of the X button on the controller.- Returns:
- The state of the button.
-
getXButtonPressed
public boolean getXButtonPressed()Whether the X button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getXButtonReleased
public boolean 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
public boolean getYButton()Read the value of the Y button on the controller.- Returns:
- The state of the button.
-
getYButtonPressed
public boolean getYButtonPressed()Whether the Y button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getYButtonReleased
public boolean 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
public boolean getLeftBumperButton()Read the value of the left bumper button on the controller.- Returns:
- The state of the button.
-
getLeftBumperButtonPressed
public boolean getLeftBumperButtonPressed()Whether the left bumper button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftBumperButtonReleased
public boolean 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
public boolean getRightBumperButton()Read the value of the right bumper button on the controller.- Returns:
- The state of the button.
-
getRightBumperButtonPressed
public boolean getRightBumperButtonPressed()Whether the right bumper button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightBumperButtonReleased
public boolean 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
public boolean getLeftStickButton()Read the value of the left stick button on the controller.- Returns:
- The state of the button.
-
getLeftStickButtonPressed
public boolean getLeftStickButtonPressed()Whether the left stick button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftStickButtonReleased
public boolean 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
public boolean getRightStickButton()Read the value of the right stick button on the controller.- Returns:
- The state of the button.
-
getRightStickButtonPressed
public boolean getRightStickButtonPressed()Whether the right stick button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightStickButtonReleased
public boolean 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
public boolean getEllipsesButton()Read the value of the ellipses button on the controller.- Returns:
- The state of the button.
-
getEllipsesButtonPressed
public boolean getEllipsesButtonPressed()Whether the ellipses button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getEllipsesButtonReleased
public boolean 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
public boolean getHamburgerButton()Read the value of the hamburger button on the controller.- Returns:
- The state of the button.
-
getHamburgerButtonPressed
public boolean getHamburgerButtonPressed()Whether the hamburger button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getHamburgerButtonReleased
public boolean 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
public boolean getStadiaButton()Read the value of the stadia button on the controller.- Returns:
- The state of the button.
-
getStadiaButtonPressed
public boolean getStadiaButtonPressed()Whether the stadia button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getStadiaButtonReleased
public boolean 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
public boolean getRightTriggerButton()Read the value of the right trigger button on the controller.- Returns:
- The state of the button.
-
getRightTriggerButtonPressed
public boolean getRightTriggerButtonPressed()Whether the right trigger button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getRightTriggerButtonReleased
public boolean 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
public boolean getLeftTriggerButton()Read the value of the left trigger button on the controller.- Returns:
- The state of the button.
-
getLeftTriggerButtonPressed
public boolean getLeftTriggerButtonPressed()Whether the left trigger button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getLeftTriggerButtonReleased
public boolean 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
public boolean getGoogleButton()Read the value of the google button on the controller.- Returns:
- The state of the button.
-
getGoogleButtonPressed
public boolean getGoogleButtonPressed()Whether the google button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getGoogleButtonReleased
public boolean 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
public boolean getFrameButton()Read the value of the frame button on the controller.- Returns:
- The state of the button.
-
getFrameButtonPressed
public boolean getFrameButtonPressed()Whether the frame button was pressed since the last check.- Returns:
- Whether the button was pressed since the last check.
-
getFrameButtonReleased
public boolean 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.
-
isConnected
public boolean isConnected()Get if the controller is connected.- Returns:
- true if the controller is connected
-
getGamepadType
Get the type of the controller.- Returns:
- the type of the controller.
-
getSupportedOutputs
Get the supported outputs of the controller.- Returns:
- the supported outputs of the controller.
-
getName
-
getPort
public int getPort()Get the port number of the controller.- Returns:
- The port number of the controller.
-
setRumble
Set the rumble output for the HID.The DS currently supports 4 rumble values: left rumble, right rumble, left trigger rumble, and right trigger rumble.
- Parameters:
type- Which rumble value to setvalue- The normalized value (0 to 1) to set the rumble to
-
getTelemetryType
Description copied from interface:TelemetryLoggableGets the telemetry table type. Default is no specified table type (null). A mismatch in type during logging results in a reported warning, so this should always return the same value.- Specified by:
getTelemetryTypein interfaceTelemetryLoggable- Returns:
- Table type
-
logTo
Description copied from interface:TelemetryLoggableLogs the object to aTelemetryTable.- Specified by:
logToin interfaceTelemetryLoggable- Parameters:
table- telemetry table
-