7#include <frc/GenericHID.h>
8#include <frc2/command/button/Trigger.h>
185 [[nodiscard]]
bool GetRawButton(std::vector<Button> buttonCombo);
245 [[nodiscard]] frc2::Trigger
TriggerRaw(std::vector<Button> buttonCombo);
253 [[nodiscard]] frc2::Trigger
TriggerRawAnyOf(std::vector<Button> buttonCombo);
261 [[nodiscard]] frc2::Trigger
TriggerRawAllOf(std::vector<Button> buttonCombo);
269 [[nodiscard]] frc2::Trigger
TriggerRawNoneOf(std::vector<Button> buttonCombo);
277 [[nodiscard]] frc2::Trigger
TriggerRawOneOf(std::vector<Button> buttonCombo);
293 [[nodiscard]] frc2::Trigger
TriggerDebounced(std::vector<Button> buttonCombo);
352 [[nodiscard]] frc2::Trigger
TriggerAnyOf(std::vector<Button> buttonCombo,
353 std::function<
bool(
Button)> buttonGetterFunc);
362 [[nodiscard]] frc2::Trigger
TriggerAllOf(std::vector<Button> buttonCombo,
363 std::function<
bool(
Button)> buttonGetterFunc);
372 [[nodiscard]] frc2::Trigger
TriggerNoneOf(std::vector<Button> buttonCombo,
373 std::function<
bool(
Button)> buttonGetterFunc);
382 [[nodiscard]] frc2::Trigger
TriggerOneOf(std::vector<Button> buttonCombo,
383 std::function<
bool(
Button)> buttonGetterFunc);
390 std::array<std::chrono::time_point<std::chrono::steady_clock>,
static_cast<int>(
Button::COUNT)>
Definition xbox_controller.h:18
void SetVibration(VibrationModel newVibrationModel)
Sets a new vibration pattern and updates vibration output based on that new model.
Definition xbox_controller.cpp:135
frc2::Trigger TriggerRaw(Button button)
Generates a trigger that is true when button is true.
Definition xbox_controller.cpp:229
Button
Definition xbox_controller.h:25
@ kRightTrigger
virtual button
@ kLeftTrigger
virtual button
frc2::Trigger TriggerRawNoneOf(std::vector< Button > buttonCombo)
Trigger when none of the selected buttons' raw value is true.
Definition xbox_controller.cpp:245
bool GetDebouncedButtonReleased(Button buttonIdx)
Detect if a button just transitioned from active to inactive after applying debounce.
Definition xbox_controller.cpp:51
frc2::Trigger TriggerOneOf(std::vector< Button > buttonCombo, std::function< bool(Button)> buttonGetterFunc)
Trigger when exactly one of the selected buttons is true according to the supplied buttonGetterFunc.
Definition xbox_controller.cpp:310
std::array< bool, static_cast< int >(Button::COUNT)> m_buttonDebounceStatus
Definition xbox_controller.h:388
void SwapSettings(XboxController &other)
Swap all configurations (debounce, etc) between this and other controller. Useful in conjunction with...
Definition xbox_controller.cpp:20
VibrationModel m_vibrationModel
Active vibration model.
Definition xbox_controller.h:393
void UpdateVibration()
Update vibration output based on current vibration model.
Definition xbox_controller.cpp:140
frc2::Trigger TriggerNoneOf(std::vector< Button > buttonCombo, std::function< bool(Button)> buttonGetterFunc)
Trigger when none of the selected buttons is true according to the supplied buttonGetterFunc.
Definition xbox_controller.cpp:299
frc2::Trigger TriggerRawAllOf(std::vector< Button > buttonCombo)
Trigger when all of the selected buttons' raw values are true.
Definition xbox_controller.cpp:241
frc2::Trigger TriggerAnyOf(std::vector< Button > buttonCombo, std::function< bool(Button)> buttonGetterFunc)
Trigger when any of the selected buttons is true according to the supplied buttonGetterFunc.
Definition xbox_controller.cpp:277
std::array< std::chrono::time_point< std::chrono::steady_clock >, static_cast< int >(Button::COUNT)> m_buttonDebounceTransitionTime
Time when new value was first seen.
Definition xbox_controller.h:391
frc2::Trigger TriggerDebouncedNoneOf(std::vector< Button > buttonCombo)
Trigger when none of the selected buttons' debounced value is true.
Definition xbox_controller.cpp:269
std::array< bool, static_cast< int >(Button::COUNT)> m_rawButtonStatus
Definition xbox_controller.h:389
JoystickHand
Replaces legacy joystick hand API for WPILib.
Definition xbox_controller.h:23
bool GetRawButtonPressed(Button buttonIdx)
Detect if a button just transitioned from inactive to active.
Definition xbox_controller.cpp:91
UpdateStatus UpdateButton(Button buttonIdx)
Determines the new status of a button. This is used by the other status retrieval functions.
Definition xbox_controller.cpp:146
frc2::Trigger TriggerRawAnyOf(std::vector< Button > buttonCombo)
Trigger when any of the selected buttons' raw value is true.
Definition xbox_controller.cpp:237
std::array< DebounceSettings, static_cast< int >(Button::COUNT)> m_buttonDebounceSettings
Definition xbox_controller.h:387
static constexpr double analogTriggerThresh
Percent trigger pressed to consider as a button press.
Definition xbox_controller.h:385
frc2::Trigger TriggerAllOf(std::vector< Button > buttonCombo, std::function< bool(Button)> buttonGetterFunc)
Trigger when all of the selected buttons is true according to the supplied buttonGetterFunc.
Definition xbox_controller.cpp:288
frc2::Trigger TriggerDebouncedAnyOf(std::vector< Button > buttonCombo)
Trigger when any of the selected buttons' debounced value is true.
Definition xbox_controller.cpp:261
double GetY(JoystickHand hand) const
Get Y joystick percent from specified joystick.
Definition xbox_controller.cpp:35
frc2::Trigger TriggerDebouncedOneOf(std::vector< Button > buttonCombo)
Trigger when exactly one of the selected buttons' debounced value is true.
Definition xbox_controller.cpp:273
VibrationModel GetVibration() const
Get the active vibration model.
Definition xbox_controller.cpp:131
bool GetRawButtonReleased(Button buttonIdx)
Detect if a button just transitioned from active to inactive.
Definition xbox_controller.cpp:95
frc2::Trigger TriggerDebounced(Button button)
Generates a trigger that is true when debounced button is true.
Definition xbox_controller.cpp:253
DPadButtons GetPOVButtons()
Convert POV angle to usable DPad button values.
Definition xbox_controller.cpp:344
bool GetRawButton(Button buttonIdx)
Get the status of button.
Definition xbox_controller.cpp:87
double GetTriggerAxis(JoystickHand hand) const
Get percent from specified controller trigger button.
Definition xbox_controller.cpp:39
bool GetDebouncedButton(Button buttonIdx)
Get the status of button after applying debounce.
Definition xbox_controller.cpp:43
void SetButtonDebounce(Button targetButton, DebounceSettings newSettings)
Configure debounce for a specified button.
Definition xbox_controller.cpp:16
frc2::Trigger TriggerRawOneOf(std::vector< Button > buttonCombo)
Trigger when exactly one of the selected buttons' raw value is true.
Definition xbox_controller.cpp:249
double GetX(JoystickHand hand) const
Get X joystick percent from specified joystick.
Definition xbox_controller.cpp:31
frc2::Trigger TriggerDebouncedAllOf(std::vector< Button > buttonCombo)
Trigger when all of the selected buttons' debounced values are true.
Definition xbox_controller.cpp:265
bool GetDebouncedButtonPressed(Button buttonIdx)
Detect if a button just transitioned from inactive to active after applying debounce.
Definition xbox_controller.cpp:47
Axis
Definition xbox_controller.h:57
Definition swap_controllers_command.h:12
std::function< VibrationStatus()> VibrationModel
Definition vibration.h:21
Definition debounce_settings.h:11
State of an individual button.
Definition xbox_controller.h:48
bool debounceActive
Button status after debounce applied.
Definition xbox_controller.h:54
bool pressed
Transitioned from inactive to active.
Definition xbox_controller.h:49
bool debouncePress
Transitioned from inactive to active after debounce applied.
Definition xbox_controller.h:51
bool debounceRelease
Transitioned from active to inactive after debounce applied.
Definition xbox_controller.h:52
bool rawActive
Raw button status.
Definition xbox_controller.h:53
bool released
Transitioned from active to inactive.
Definition xbox_controller.h:50