From d9c00984657ddf1cb79335173c2cb7387280846a Mon Sep 17 00:00:00 2001 From: Jade Turner Date: Sun, 23 Jun 2024 20:17:04 +0800 Subject: [PATCH] Add setRumble and isConnected to CommandGenericHID Follows https://github.com/wpilibsuite/allwpilib/pull/6768 --- commands2/button/commandgenerichid.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/commands2/button/commandgenerichid.py b/commands2/button/commandgenerichid.py index 79b4128..74e8a91 100644 --- a/commands2/button/commandgenerichid.py +++ b/commands2/button/commandgenerichid.py @@ -186,3 +186,21 @@ def getRawAxis(self, axis: int) -> float: :returns: The value of the axis. """ return self._hid.getRawAxis(axis) + + def setRumble(self, type: GenericHID.RumbleType, value: float): + """ + Set the rumble output for the HID. + The DS currently supports 2 rumble values, left rumble and right rumble. + + :param type: Which rumble value to set. + :param value: The normalized value (0 to 1) to set the rumble to. + """ + self._hid.setRumble(type, value) + + def isConnected(self): + """ + Get if the HID is connected. + + :returns: True if the HID is connected. + """ + return self._hid.isConnected()