DualSenseController
- class wpilib.DualSenseController(*args, **kwargs)
Bases:
HIDDevice,SendableHandle input from DualSense controllers connected to the Driver Station.
This class handles DualSense input that comes from the Driver Station. Each time a value is requested the most recent value is returned.
Overloaded function.
__init__(self: wpilib._wpilib.DualSenseController, port: typing.SupportsInt | typing.SupportsIndex) -> None
Construct an instance of a controller.
The controller index is the USB port on the Driver Station.
- Parameters:
port – The port on the Driver Station that the controller is plugged into.
__init__(self: wpilib._wpilib.DualSenseController, hid: wpilib._wpilib.GenericHID) -> None
Construct an instance of a controller with a GenericHID object.
- Parameters:
hid – The GenericHID object to use for this controller.
- class Axis
Bases:
pybind11_objectRepresents an axis on a DualSenseController.
- L2 = 4
- LEFT_X = 0
- LEFT_Y = 1
- R2 = 5
- RIGHT_X = 2
- RIGHT_Y = 3
- class Button
Bases:
pybind11_objectRepresents a digital button on a DualSenseController.
- CIRCLE = 1
- CREATE = 4
- CROSS = 0
- DPAD_DOWN = 12
- DPAD_LEFT = 13
- DPAD_RIGHT = 14
- DPAD_UP = 11
- L1 = 9
- L3 = 7
- MICROPHONE = 15
- OPTIONS = 6
- PS = 5
- R1 = 10
- R3 = 8
- SQUARE = 2
- TOUCHPAD = 20
- TRIANGLE = 3
- L1(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the L 1 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the L 1 button’s digital signal attached to the given loop.
- L3(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the L 3 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the L 3 button’s digital signal attached to the given loop.
- PS(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the PS button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the PS button’s digital signal attached to the given loop.
- R1(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the R 1 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the R 1 button’s digital signal attached to the given loop.
- R3(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the R 3 button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the R 3 button’s digital signal attached to the given loop.
- SUPPORTED_OUTPUTS = <SupportedOutputs.???: 26>
- SUPPORTS_MONO_LED = False
- SUPPORTS_RGB_LED = True
- SUPPORTS_RUMBLE = True
- SUPPORTS_TRIGGER_RUMBLE = True
- TOUCHPAD_COUNT = 1
- axisGreaterThan(axis: SupportsInt | SupportsIndex, threshold: SupportsFloat | SupportsIndex, loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance that is true when the axis value is greater than threshold.
- Parameters:
axis – The axis to read.
threshold – The value above which this event should return true.
loop – the event loop instance to attach the event to.
- Returns:
an event instance that is true when the axis value is greater than the provided threshold.
- axisLessThan(axis: SupportsInt | SupportsIndex, threshold: SupportsFloat | SupportsIndex, loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance that is true when the axis value is less than threshold.
- Parameters:
axis – The axis to read.
threshold – The value below which this event should return true.
loop – the event loop instance to attach the event to.
- Returns:
an event instance that is true when the axis value is less than the provided threshold.
- button(button: SupportsInt | SupportsIndex, loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around this button’s digital signal.
- Parameters:
button – the button
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the button’s digital signal attached to the given loop.
- circle(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Circle button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Circle button’s digital signal attached to the given loop.
- create(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Create button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Create button’s digital signal attached to the given loop.
- cross(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Cross button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Cross button’s digital signal attached to the given loop.
- dpadDown(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Dpad Down button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Dpad Down button’s digital signal attached to the given loop.
- dpadLeft(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Dpad Left button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Dpad Left button’s digital signal attached to the given loop.
- dpadRight(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Dpad Right button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Dpad Right button’s digital signal attached to the given loop.
- dpadUp(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Dpad Up button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Dpad Up button’s digital signal attached to the given loop.
- getAxis(axis: SupportsInt | SupportsIndex) float
Get the value of the axis.
- Parameters:
axis – The axis to read
- Returns:
the axis value.
- getButton(button: SupportsInt | SupportsIndex) bool
Get the button value.
- Parameters:
button – The button to read
- Returns:
The state of the button.
- getButtonPressed(button: SupportsInt | SupportsIndex) bool
Whether the button was pressed since the last check.
- Parameters:
button – The button to read
- Returns:
Whether the button was pressed since the last check.
- getButtonReleased(button: SupportsInt | SupportsIndex) bool
Whether the button was released since the last check.
- Parameters:
button – The button to read
- Returns:
Whether the button was released since the last check.
- getCircleButton() bool
Read the value of the Circle button on the controller.
- Returns:
The state of the button.
- getCircleButtonPressed() bool
Whether the Circle button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getCircleButtonReleased() bool
Whether the Circle button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getCreateButton() bool
Read the value of the Create button on the controller.
- Returns:
The state of the button.
- getCreateButtonPressed() bool
Whether the Create button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getCreateButtonReleased() bool
Whether the Create button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getCrossButton() bool
Read the value of the Cross button on the controller.
- Returns:
The state of the button.
- getCrossButtonPressed() bool
Whether the Cross button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getCrossButtonReleased() bool
Whether the Cross button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getDpadDownButton() bool
Read the value of the Dpad Down button on the controller.
- Returns:
The state of the button.
- getDpadDownButtonPressed() bool
Whether the Dpad Down button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getDpadDownButtonReleased() bool
Whether the Dpad Down button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getDpadLeftButton() bool
Read the value of the Dpad Left button on the controller.
- Returns:
The state of the button.
- getDpadLeftButtonPressed() bool
Whether the Dpad Left button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getDpadLeftButtonReleased() bool
Whether the Dpad Left button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getDpadRightButton() bool
Read the value of the Dpad Right button on the controller.
- Returns:
The state of the button.
- getDpadRightButtonPressed() bool
Whether the Dpad Right button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getDpadRightButtonReleased() bool
Whether the Dpad Right button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getDpadUpButton() bool
Read the value of the Dpad Up button on the controller.
- Returns:
The state of the button.
- getDpadUpButtonPressed() bool
Whether the Dpad Up button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getDpadUpButtonReleased() bool
Whether the Dpad Up button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getHID() wpilib._wpilib.GenericHID
Get the underlying GenericHID object.
- Returns:
the wrapped GenericHID object
- getL1Button() bool
Read the value of the L 1 button on the controller.
- Returns:
The state of the button.
- getL1ButtonPressed() bool
Whether the L 1 button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getL1ButtonReleased() bool
Whether the L 1 button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getL2() float
Get the L 2 value of the controller.
- Returns:
the axis value.
- getL3Button() bool
Read the value of the L 3 button on the controller.
- Returns:
The state of the button.
- getL3ButtonPressed() bool
Whether the L 3 button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getL3ButtonReleased() bool
Whether the L 3 button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getLeftX() float
Get the Left X value of the controller.
- Returns:
the axis value.
- getLeftY() float
Get the Left Y value of the controller.
- Returns:
the axis value.
- getMicrophoneButton() bool
Read the value of the Microphone button on the controller.
- Returns:
The state of the button.
- getMicrophoneButtonPressed() bool
Whether the Microphone button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getMicrophoneButtonReleased() bool
Whether the Microphone button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getOptionsButton() bool
Read the value of the Options button on the controller.
- Returns:
The state of the button.
- getOptionsButtonPressed() bool
Whether the Options button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getOptionsButtonReleased() bool
Whether the Options button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getPSButton() bool
Read the value of the PS button on the controller.
- Returns:
The state of the button.
- getPSButtonPressed() bool
Whether the PS button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getPSButtonReleased() bool
Whether the PS button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getPort() int
Get the port number of the HID.
- Returns:
The port number of the HID.
- getR1Button() bool
Read the value of the R 1 button on the controller.
- Returns:
The state of the button.
- getR1ButtonPressed() bool
Whether the R 1 button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getR1ButtonReleased() bool
Whether the R 1 button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getR2() float
Get the R 2 value of the controller.
- Returns:
the axis value.
- getR3Button() bool
Read the value of the R 3 button on the controller.
- Returns:
The state of the button.
- getR3ButtonPressed() bool
Whether the R 3 button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getR3ButtonReleased() bool
Whether the R 3 button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getRightX() float
Get the Right X value of the controller.
- Returns:
the axis value.
- getRightY() float
Get the Right Y value of the controller.
- Returns:
the axis value.
- getSquareButton() bool
Read the value of the Square button on the controller.
- Returns:
The state of the button.
- getSquareButtonPressed() bool
Whether the Square button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getSquareButtonReleased() bool
Whether the Square button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getTouchpadButton() bool
Read the value of the Touchpad button on the controller.
- Returns:
The state of the button.
- getTouchpadButtonPressed() bool
Whether the Touchpad button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getTouchpadButtonReleased() bool
Whether the Touchpad button was released since the last check.
- Returns:
Whether the button was released since the last check.
- getTouchpadFinger(finger: SupportsInt | SupportsIndex) wpilib._wpilib.TouchpadFinger
Get the touchpad finger data.
- Parameters:
finger – The finger to read.
- Returns:
The touchpad finger data.
- getTouchpadFingerAvailable(finger: SupportsInt | SupportsIndex) bool
Check if a touchpad finger is available.
- Parameters:
finger – The finger to check.
- Returns:
true if the touchpad finger is available.
- getTriangleButton() bool
Read the value of the Triangle button on the controller.
- Returns:
The state of the button.
- getTriangleButtonPressed() bool
Whether the Triangle button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- getTriangleButtonReleased() bool
Whether the Triangle button was released since the last check.
- Returns:
Whether the button was released since the last check.
- initSendable(builder: wpiutil._wpiutil.SendableBuilder) None
- isConnected() bool
Get if the HID is connected.
- Returns:
true if the HID is connected
- microphone(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Microphone button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Microphone button’s digital signal attached to the given loop.
- options(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Options button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Options button’s digital signal attached to the given loop.
- setLeds(r: SupportsInt | SupportsIndex, g: SupportsInt | SupportsIndex, b: SupportsInt | SupportsIndex) None
Set leds on the controller.
- Parameters:
r – Red value from 0-255
g – Green value from 0-255
b – Blue value from 0-255
- setRumble(type: wpilib._wpilib.GenericHID.RumbleType, value: SupportsFloat | SupportsIndex) None
Set the rumble output for the HID.
- Parameters:
type – Which rumble value to set
value – The normalized value (0 to 1) to set the rumble to
- square(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Square button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Square button’s digital signal attached to the given loop.
- touchpad(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Touchpad button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Touchpad button’s digital signal attached to the given loop.
- triangle(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Triangle button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Triangle button’s digital signal attached to the given loop.