12 #include <wpi/deprecated.h>
14 #include "frc/GenericHID.h"
28 static constexpr
int kDefaultXChannel = 0;
29 static constexpr
int kDefaultYChannel = 1;
30 static constexpr
int kDefaultZChannel = 2;
31 static constexpr
int kDefaultTwistChannel = 2;
32 static constexpr
int kDefaultThrottleChannel = 3;
34 enum AxisType { kXAxis, kYAxis, kZAxis, kTwistAxis, kThrottleAxis };
35 enum ButtonType { kTriggerButton, kTopButton };
134 double GetX(JoystickHand hand = kRightHand)
const override;
144 double GetY(JoystickHand hand = kRightHand)
const override;
238 enum Axis { kX, kY, kZ, kTwist, kThrottle, kNumAxes };
239 enum Button { kTrigger = 1, kTop = 2 };
241 std::array<int, Axis::kNumAxes> m_axes;
double GetTwist() const
Get the twist value of the current joystick.
int GetTwistChannel() const
Get the channel currently associated with the twist axis.
void SetZChannel(int channel)
Set the channel associated with the Z axis.
double GetThrottle() const
Get the throttle value of the current joystick.
double GetY(JoystickHand hand=kRightHand) const override
Get the Y value of the joystick.
bool GetTrigger() const
Read the state of the trigger on the joystick.
void SetTwistChannel(int channel)
Set the channel associated with the twist axis.
double GetX(JoystickHand hand=kRightHand) const override
Get the X value of the joystick.
double GetDirectionDegrees() const
Get the direction of the vector formed by the joystick and its origin in degrees.
bool GetTopPressed()
Whether the top button was pressed since the last check.
int GetYChannel() const
Get the channel currently associated with the Y axis.
bool GetTop() const
Read the state of the top button on the joystick.
bool GetTopReleased()
Whether the top button was released since the last check.
double GetZ() const
Get the Z value of the current joystick.
double GetMagnitude() const
Get the magnitude of the direction vector formed by the joystick's current position relative to its o...
int GetZChannel() const
Get the channel currently associated with the Z axis.
Handle input from standard Joysticks connected to the Driver Station.
Definition: Joystick.h:26
double GetDirectionRadians() const
Get the direction of the vector formed by the joystick and its origin in radians.
bool GetTriggerPressed()
Whether the trigger was pressed since the last check.
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
void SetXChannel(int channel)
Set the channel associated with the X axis.
int GetThrottleChannel() const
Get the channel currently associated with the throttle axis.
void SetYChannel(int channel)
Set the channel associated with the Y axis.
bool GetTriggerReleased()
Whether the trigger was released since the last check.
int GetXChannel() const
Get the channel currently associated with the X axis.
GenericHID Interface.
Definition: GenericHID.h:23
Joystick(int port)
Construct an instance of a joystick.
void SetThrottleChannel(int channel)
Set the channel associated with the throttle axis.