Package ca.team4308.absolutelib.control
Class POVToJoystick
java.lang.Object
edu.wpi.first.wpilibj2.command.button.Trigger
ca.team4308.absolutelib.control.POVToJoystick
- All Implemented Interfaces:
BooleanSupplier
A
Trigger whose state is based on a POV (D-pad) angle from a GenericHID.
The trigger is active when GenericHID.getPOV(int) for the configured POV index
returns the specified angle.
-
Constructor Summary
ConstructorsConstructorDescriptionPOVToJoystick(GenericHID joystick, int angle) Creates a POV trigger for POV index 0.POVToJoystick(GenericHID joystick, int angle, int povNumber) Creates a joystick POV "button" for triggering commands. -
Method Summary
Methods inherited from class edu.wpi.first.wpilibj2.command.button.Trigger
and, debounce, debounce, getAsBoolean, negate, onChange, onFalse, onTrue, or, toggleOnFalse, toggleOnTrue, whileFalse, whileTrue
-
Constructor Details
-
POVToJoystick
Creates a joystick POV "button" for triggering commands.- Parameters:
joystick- The GenericHID object that has the POV (e.g. Joystick)angle- The POV angle being matched (e.g. 0, 90, 180, 270)povNumber- The POV index (usually 0). Previous comment referenced buttonNumber; kept for compatibility. Implementation note: - The lambda checks joystick.getPOV(povNumber) == angle. - Null validation runs after super(); safe in normal usage but could be moved earlier.
-
POVToJoystick
Creates a POV trigger for POV index 0.- Parameters:
joystick- The GenericHID object that has the POVangle- Desired POV angle
-