WPILibC++ 2027.0.0-alpha-2
Loading...
Searching...
No Matches
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/DriverStation.h>
8#include <frc/GenericHID.h>
9
10#include "Trigger.h"
11
12namespace frc2 {
13/**
14 * A class used to bind command scheduling to joystick POV presses. Can be
15 * composed with other buttons with the operators in Trigger.
16 *
17 * This class is provided by the NewCommands VendorDep
18 *
19 * @see Trigger
20 */
21class POVButton : public Trigger {
22 public:
23 /**
24 * Creates a POVButton that commands can be bound to.
25 *
26 * @param joystick The joystick on which the button is located.
27 * @param angle The angle of the POV corresponding to a button press.
28 * @param povNumber The number of the POV on the joystick.
29 */
31 int povNumber = 0)
32 : Trigger([joystick, angle, povNumber] {
33 return joystick->GetPOV(povNumber) == angle;
34 }) {}
35};
36} // namespace frc2
A class used to bind command scheduling to joystick POV presses.
Definition POVButton.h:21
POVButton(frc::GenericHID *joystick, frc::DriverStation::POVDirection angle, int povNumber=0)
Creates a POVButton that commands can be bound to.
Definition POVButton.h:30
This class provides an easy way to link commands to conditions.
Definition Trigger.h:32
POVDirection
A controller POV direction.
Definition DriverStation.h:55
Handle input from standard HID devices connected to the Driver Station.
Definition GenericHID.h:26
DriverStation::POVDirection GetPOV(int pov=0) const
Get the angle of a POV on the HID.
Definition FunctionalCommand.h:13