WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
POVButton.hpp
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
10
11namespace wpi::cmd {
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 */
30 int povNumber = 0)
31 : Trigger([joystick, angle, povNumber] {
32 return joystick->GetPOV(povNumber) == angle;
33 }) {}
34};
35} // namespace wpi::cmd
POVDirection
A controller POV direction.
Definition DriverStation.hpp:62
Handle input from standard HID devices connected to the Driver Station.
Definition GenericHID.hpp:26
DriverStation::POVDirection GetPOV(int pov=0) const
Get the angle of a POV on the HID.
POVButton(wpi::GenericHID *joystick, wpi::DriverStation::POVDirection angle, int povNumber=0)
Creates a POVButton that commands can be bound to.
Definition POVButton.hpp:29
Trigger(std::function< bool()> condition)
Creates a new trigger based on the given condition.
Definition Trigger.hpp:40
Definition CommandNiDsStadiaController.hpp:15