261 [[deprecated(
"Use GetDirection() instead.")]]
271 [[deprecated(
"Use GetDirection() instead.")]]
282 enum Axis { kX, kY, kZ, kTwist, kThrottle, kNumAxes };
283 enum Button { kTrigger = 1, kTop = 2 };
285 std::array<int, Axis::kNumAxes> m_axes;
This class provides an easy way to link actions to inputs.
Definition: BooleanEvent.h:31
A declarative way to bind a set of actions to a loop and execute them when the loop is polled.
Definition: EventLoop.h:15
Handle input from standard HID devices connected to the Driver Station.
Definition: GenericHID.h:24
Handle input from standard Joysticks connected to the Driver Station.
Definition: Joystick.h:23
int GetYChannel() const
Get the channel currently associated with the Y axis.
double GetDirectionDegrees() const
Get the direction of the vector formed by the joystick and its origin in degrees.
void SetTwistChannel(int channel)
Set the channel associated with the twist axis.
bool GetTrigger() const
Read the state of the trigger on the joystick.
double GetTwist() const
Get the twist value of the current joystick.
int GetTwistChannel() const
Get the channel currently associated with the twist axis.
ButtonType
Represents a digital button on a joystick.
Definition: Joystick.h:55
@ kTopButton
kTop.
Definition: Joystick.h:59
@ kTriggerButton
kTrigger.
Definition: Joystick.h:57
bool GetTriggerReleased()
Whether the trigger was released since the last check.
static constexpr int kDefaultThrottleChannel
Default throttle axis channel.
Definition: Joystick.h:34
bool GetTopPressed()
Whether the top button was pressed since the last check.
void SetThrottleChannel(int channel)
Set the channel associated with the throttle axis.
bool GetTriggerPressed()
Whether the trigger was pressed since the last check.
BooleanEvent Top(EventLoop *loop) const
Constructs an event instance around the top button's digital signal.
~Joystick() override=default
int GetZChannel() const
Get the channel currently associated with the Z axis.
static constexpr int kDefaultXChannel
Default X axis channel.
Definition: Joystick.h:26
double GetX() const
Get the X value of the current joystick.
Joystick(int port)
Construct an instance of a joystick.
int GetXChannel() const
Get the channel currently associated with the X axis.
double GetThrottle() const
Get the throttle value of the current joystick.
double GetZ() const
Get the Z value of the current joystick.
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.
static constexpr int kDefaultTwistChannel
Default twist axis channel.
Definition: Joystick.h:32
static constexpr int kDefaultYChannel
Default Y axis channel.
Definition: Joystick.h:28
Joystick & operator=(Joystick &&)=default
void SetYChannel(int channel)
Set the channel associated with the Y axis.
double GetDirectionRadians() const
Get the direction of the vector formed by the joystick and its origin in radians.
double GetY() const
Get the Y value of the current joystick.
Joystick(Joystick &&)=default
int GetThrottleChannel() const
Get the channel currently associated with the throttle axis.
BooleanEvent Trigger(EventLoop *loop) const
Constructs an event instance around the trigger button's digital signal.
void SetZChannel(int channel)
Set the channel associated with the Z axis.
AxisType
Represents an analog axis on a joystick.
Definition: Joystick.h:39
@ kThrottleAxis
Throttle axis.
Definition: Joystick.h:49
@ kTwistAxis
Twist axis.
Definition: Joystick.h:47
@ kXAxis
X axis.
Definition: Joystick.h:41
@ kYAxis
Y axis.
Definition: Joystick.h:43
@ kZAxis
Z axis.
Definition: Joystick.h:45
static constexpr int kDefaultZChannel
Default Z axis channel.
Definition: Joystick.h:30
double GetMagnitude() const
Get the magnitude of the direction vector formed by the joystick's current position relative to its o...
units::radian_t GetDirection() const
Get the direction of the vector formed by the joystick and its origin.
void SetXChannel(int channel)
Set the channel associated with the X axis.
Definition: AprilTagPoseEstimator.h:15