12 constexpr static int X = 1;
13 constexpr static int Y = 0;
14 constexpr static int twist = 2;
15 constexpr static int throttle = 3;
19 bool squareOutputs =
false)
20 : frc2::CommandGenericHID(channel), deadZone(deadZone),
21 squareOutputs(squareOutputs){};
24 double raw = -GetRawAxis(Axes::X);
25 if (std::abs(raw) < deadZone) {
28 return squareOutputs ? std::copysign(raw * raw, raw) : raw;
31 frc2::Trigger XLessThan(
double threshold)
const {
32 return AxisLessThan(Axes::X, threshold);
34 frc2::Trigger XMoreThan(
double threshold)
const {
35 return AxisGreaterThan(Axes::X, threshold);
39 double raw = GetRawAxis(Axes::Y);
40 if (std::abs(raw) < deadZone) {
43 return squareOutputs ? std::copysign(raw * raw, raw) : raw;
46 frc2::Trigger YLessThan(
double threshold)
const {
47 return AxisLessThan(Axes::Y, threshold);
50 frc2::Trigger YMoreThan(
double threshold)
const {
51 return AxisGreaterThan(Axes::Y, threshold);
54 double GetTwist()
const {
55 double raw = GetRawAxis(Axes::twist);
56 if (std::abs(raw) < deadZone) {
59 return squareOutputs ? std::copysign(raw * raw, raw) : raw;
62 frc2::Trigger TwistLessThan(
double threshold)
const {
63 return AxisLessThan(Axes::twist, threshold);
65 frc2::Trigger TwistMoreThan(
double threshold)
const {
66 return AxisGreaterThan(Axes::twist, threshold);
69 double GetThrottle()
const {
70 double raw = (-GetRawAxis(Axes::throttle) + 1.0) / 2.0;
74 frc2::Trigger ThrottleLessThan(
double threshold)
const {
75 return AxisLessThan(Axes::throttle, threshold);
77 frc2::Trigger ThrottleMoreThan(
double threshold)
const {
78 return AxisGreaterThan(Axes::throttle, threshold);
81 bool GetTrigger()
const {
return GetRawButton(1); }
82 bool GetTriggerPressed() {
return GetRawButtonPressed(1); }
83 bool GetTriggerReleased() {
return GetRawButtonReleased(1); }
84 frc2::Trigger Trigger()
const {
return Button(1); }