[robotpy] Mirror robotpy's commands-v2 (#8369)

Project import generated by Copybara.

GitOrigin-RevId: 715c8e8372d936f447f2937aab6b1a22dc619126
This commit is contained in:
PJ Reiniger
2025-11-14 00:55:54 -05:00
committed by GitHub
parent 6e6f8dd7cc
commit 1a99a348cb
84 changed files with 8974 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# validated: 2024-01-20 DS 7a099cb02a33 button/POVButton.java
from wpilib.interfaces import GenericHID
from .trigger import Trigger
class POVButton(Trigger):
"""
A Button that gets its state from a POV on a :class:`wpilib.interfaces.GenericHID`.
"""
def __init__(self, joystick: GenericHID, angle: int, povNumber: int = 0):
"""
Creates a POV button for triggering commands.
:param joystick: The GenericHID object that has the POV
:param angle: The desired angle in degrees (e.g. 90, 270)
:param povNumber: The POV number (see :func:`wpilib.interfaces.GenericHID.getPOV`)
"""
super().__init__(lambda: joystick.getPOV(povNumber) == angle)