Valkyrie 2026
Loading...
Searching...
No Matches
valor::Gamepad Class Reference

Enhanced wrapper around frc::XboxController. More...

#include <valkyrie/Gamepad.h>

Inheritance diagram for valor::Gamepad:

Classes

class  AnalogValue
 Represents a processed analog controller input. More...

Public Member Functions

 Gamepad (int id)
 Construct a new Valor Gamepad object.
bool DPadUp () const
 Is the gamepad's D-pad up button pressed?
bool DPadDown () const
 Is the gamepad's D-pad down button pressed?
bool DPadLeft () const
 Is the gamepad's D-pad left button pressed?
bool DPadRight () const
 Is the gamepad's D-pad right button pressed?
void SetRumble (bool turnOn, double intensity=.25)
 Sets the rumble for the gamepad.
constexpr AnalogValueLeftStickX ()
 Gets the processed left stick X-axis input.
constexpr const AnalogValueLeftStickX () const
 Gets the processed left stick X-axis input.
constexpr AnalogValueLeftStickY ()
 Gets the processed left stick Y-axis input.
constexpr const AnalogValueLeftStickY () const
 Gets the processed left stick Y-axis input.
constexpr AnalogValueRightStickX ()
 Gets the processed right stick X-axis input.
constexpr const AnalogValueRightStickX () const
 Gets the processed right stick X-axis input.
constexpr AnalogValueRightStickY ()
 Gets the processed right stick Y-axis input.
constexpr const AnalogValueRightStickY () const
 Gets the processed right stick Y-axis input.
constexpr AnalogValueLeftTrigger ()
 Gets the processed left trigger input.
constexpr const AnalogValueLeftTrigger () const
 Gets the processed left trigger input.
constexpr AnalogValueRightTrigger ()
 Gets the processed right trigger input.
constexpr const AnalogValueRightTrigger () const
 Gets the processed right trigger input.

Detailed Description

Enhanced wrapper around frc::XboxController.

Provides utility functions and higher-level abstractions for Xbox gamepad input handling in robot code. This class extends the default WPILib XboxController API with:

  • Processed analog stick and trigger inputs
  • Configurable deadbands
  • Polynomial response curves
  • Moving-average filtering
  • Simplified D-pad helpers
  • Convenience rumble control

Constructor & Destructor Documentation

◆ Gamepad()

valor::Gamepad::Gamepad ( int id)
explicit

Construct a new Valor Gamepad object.

Parameters
idUSB ID that shows up on the driver station. Between 0 and 3

Member Function Documentation

◆ DPadDown()

bool valor::Gamepad::DPadDown ( ) const
inline

Is the gamepad's D-pad down button pressed?

Returns
true Gamepad's down d-pad button is pressed
true Gamepad's down d-pad button is not pressed

◆ DPadLeft()

bool valor::Gamepad::DPadLeft ( ) const
inline

Is the gamepad's D-pad left button pressed?

Returns
true Gamepad's left d-pad button is pressed
true Gamepad's left d-pad button is not pressed

◆ DPadRight()

bool valor::Gamepad::DPadRight ( ) const
inline

Is the gamepad's D-pad right button pressed?

Returns
true Gamepad's right d-pad button is pressed
true Gamepad's right d-pad button is not pressed

◆ DPadUp()

bool valor::Gamepad::DPadUp ( ) const
inline

Is the gamepad's D-pad up button pressed?

Returns
true Gamepad's up d-pad button is pressed
true Gamepad's up d-pad button is not pressed

◆ LeftStickX() [1/2]

AnalogValue & valor::Gamepad::LeftStickX ( )
inlineconstexpr

Gets the processed left stick X-axis input.

Returns
Reference to the left stick X AnalogValue.

◆ LeftStickX() [2/2]

const AnalogValue & valor::Gamepad::LeftStickX ( ) const
inlineconstexpr

Gets the processed left stick X-axis input.

Returns
Const reference to the left stick X AnalogValue.

◆ LeftStickY() [1/2]

AnalogValue & valor::Gamepad::LeftStickY ( )
inlineconstexpr

Gets the processed left stick Y-axis input.

Returns
Reference to the left stick Y AnalogValue.

◆ LeftStickY() [2/2]

const AnalogValue & valor::Gamepad::LeftStickY ( ) const
inlineconstexpr

Gets the processed left stick Y-axis input.

Returns
Const reference to the left stick Y AnalogValue.

◆ LeftTrigger() [1/2]

AnalogValue & valor::Gamepad::LeftTrigger ( )
inlineconstexpr

Gets the processed left trigger input.

Returns
Reference to the left trigger AnalogValue.

◆ LeftTrigger() [2/2]

const AnalogValue & valor::Gamepad::LeftTrigger ( ) const
inlineconstexpr

Gets the processed left trigger input.

Returns
Const reference to the left trigger AnalogValue.

◆ RightStickX() [1/2]

AnalogValue & valor::Gamepad::RightStickX ( )
inlineconstexpr

Gets the processed right stick X-axis input.

Returns
Reference to the right stick X AnalogValue.

◆ RightStickX() [2/2]

const AnalogValue & valor::Gamepad::RightStickX ( ) const
inlineconstexpr

Gets the processed right stick X-axis input.

Returns
Const reference to the right stick X AnalogValue.

◆ RightStickY() [1/2]

AnalogValue & valor::Gamepad::RightStickY ( )
inlineconstexpr

Gets the processed right stick Y-axis input.

Returns
Reference to the right stick Y AnalogValue.

◆ RightStickY() [2/2]

const AnalogValue & valor::Gamepad::RightStickY ( ) const
inlineconstexpr

Gets the processed right stick Y-axis input.

Returns
Const reference to the right stick Y AnalogValue.

◆ RightTrigger() [1/2]

AnalogValue & valor::Gamepad::RightTrigger ( )
inlineconstexpr

Gets the processed right trigger input.

Returns
Reference to the right trigger AnalogValue.

◆ RightTrigger() [2/2]

const AnalogValue & valor::Gamepad::RightTrigger ( ) const
inlineconstexpr

Gets the processed right trigger input.

Returns
Const reference to the right trigger AnalogValue.

◆ SetRumble()

void valor::Gamepad::SetRumble ( bool turnOn,
double intensity = .25 )

Sets the rumble for the gamepad.

Parameters
turnOnWhether to turn rumble on or off.
intensityThe intensity of the rumble, between 0.0 and 1.0. Defaults to 0.25.

The documentation for this class was generated from the following file: