WPILibC++ 2023.4.3-108-ge5452e3
POVButton.h
Go to the documentation of this file.
1// Copyright (c) FIRST and other WPILib contributors.
2// Open Source Software; you can modify and/or share it under the terms of
3// the WPILib BSD license file in the root directory of this project.
4
5#pragma once
6
7#include <frc/GenericHID.h>
8
9#include "Trigger.h"
10
11namespace frc2 {
12/**
13 * A class used to bind command scheduling to joystick POV presses. Can be
14 * composed with other buttons with the operators in Trigger.
15 *
16 * This class is provided by the NewCommands VendorDep
17 *
18 * @see Trigger
19 */
20class POVButton : public Trigger {
21 public:
22 /**
23 * Creates a POVButton that commands can be bound to.
24 *
25 * @param joystick The joystick on which the button is located.
26 * @param angle The angle of the POV corresponding to a button press.
27 * @param povNumber The number of the POV on the joystick.
28 */
29 POVButton(frc::GenericHID* joystick, int angle, int povNumber = 0)
30 : Trigger([joystick, angle, povNumber] {
31 return joystick->GetPOV(povNumber) == angle;
32 }) {}
33};
34} // namespace frc2
A class used to bind command scheduling to joystick POV presses.
Definition: POVButton.h:20
POVButton(frc::GenericHID *joystick, int angle, int povNumber=0)
Creates a POVButton that commands can be bound to.
Definition: POVButton.h:29
This class provides an easy way to link commands to conditions.
Definition: Trigger.h:35
Handle input from standard HID devices connected to the Driver Station.
Definition: GenericHID.h:24
int GetPOV(int pov=0) const
Get the angle in degrees of a POV on the HID.
Definition: ProfiledPIDCommand.h:18