14 constexpr static int leftX = 1;
15 constexpr static int leftY = 0;
16 constexpr static int leftTrigger = 2;
18 constexpr static int rightX = 5;
19 constexpr static int rightY = 4;
20 constexpr static int rightTrigger = 3;
24 constexpr static int leftStick = 9;
25 constexpr static int rightStick = 10;
27 constexpr static int rightBumper = 6;
28 constexpr static int leftBumper = 5;
30 constexpr static int X = 3;
31 constexpr static int Y = 4;
32 constexpr static int A = 1;
33 constexpr static int B = 2;
35 constexpr static int backButton = 7;
36 constexpr static int startButton = 8;
40 bool squareOutputs =
false)
41 : frc2::CommandGenericHID(channel), deadZone(deadZone),
42 squareOutputs(squareOutputs) {}
44 double GetLeftX()
const {
45 double raw = -GetRawAxis(Axes::leftX);
46 if (std::abs(raw) < deadZone) {
50 raw = wpi::sgn(raw) * (std::abs(raw) - deadZone) /
53 return squareOutputs ? std::copysign(raw * raw, raw) : raw;
55 frc2::Trigger LeftXLessThan(
double threshold)
const {
56 return AxisLessThan(Axes::leftX, threshold);
58 frc2::Trigger LeftXGreaterThan(
double threshold)
const {
59 return AxisGreaterThan(Axes::leftX, threshold);
62 double GetLeftY()
const {
63 double raw = GetRawAxis(Axes::leftY);
64 if (std::abs(raw) < deadZone) {
68 raw = wpi::sgn(raw) * (std::abs(raw) - deadZone) /
71 return squareOutputs ? std::copysign(raw * raw, raw) : raw;
74 frc2::Trigger LeftYLessThan(
double threshold)
const {
75 return AxisLessThan(Axes::leftY, threshold);
77 frc2::Trigger LeftYgreaterThan(
double threshold)
const {
78 return AxisGreaterThan(Axes::leftY, threshold);
81 bool GetLeftStickButton()
const {
return GetRawButton(Buttons::leftStick); }
82 bool GetLeftStickButtonPressed() {
83 return GetRawButtonPressed(Buttons::leftStick);
85 bool GetLeftStickButtonReleased() {
86 return GetRawButtonPressed(Buttons::leftStick);
88 frc2::Trigger LeftStickButton()
const {
return Button(Buttons::leftStick); }
90 double GetRightX()
const {
91 double raw = -GetRawAxis(Axes::rightX);
92 if (std::abs(raw) < deadZone) {
96 raw = wpi::sgn(raw) * (std::abs(raw) - deadZone) /
99 return squareOutputs ? std::copysign(raw * raw, raw) : raw;
102 frc2::Trigger RightXLessThan(
double threshold)
const {
103 return AxisLessThan(Axes::rightX, threshold);
105 frc2::Trigger RightXgreaterThan(
double threshold)
const {
106 return AxisGreaterThan(Axes::rightX, threshold);
109 double GetRightY()
const {
110 double raw = GetRawAxis(Axes::rightY);
111 if (std::abs(raw) < deadZone) {
115 raw = wpi::sgn(raw) * (std::abs(raw) - deadZone) /
118 return squareOutputs ? std::copysign(raw * raw, raw) : raw;
121 frc2::Trigger RightYLessThan(
double threshold)
const {
122 return AxisLessThan(Axes::rightY, threshold);
124 frc2::Trigger RightYGearterThan(
double threshold)
const {
125 return AxisGreaterThan(Axes::rightY, threshold);
128 bool GetRightStickButton()
const {
return GetRawButton(Buttons::rightStick); }
129 bool GetRightStickButtonPressed() {
130 return GetRawButtonPressed(Buttons::rightStick);
132 bool GetRightStickButtonReleased() {
133 return GetRawButtonPressed(Buttons::rightStick);
135 frc2::Trigger RightStickButton()
const {
return Button(Buttons::rightStick); }
137 double GetLeftTrigger()
const {
138 double raw = GetRawAxis(Axes::leftTrigger);
139 if (std::abs(raw) < deadZone) {
143 raw = wpi::sgn(raw) * (std::abs(raw) - deadZone) /
146 return squareOutputs ? std::copysign(raw * raw, raw) : raw;
148 frc2::Trigger LeftTriggerLessThan(
double threshold)
const {
149 return AxisLessThan(Axes::leftTrigger, threshold);
151 frc2::Trigger LeftTriggergreaterThan(
double threshold)
const {
152 return AxisGreaterThan(Axes::leftTrigger, threshold);
155 double GetRightTrigger()
const {
156 double raw = GetRawAxis(Axes::rightTrigger);
157 if (std::abs(raw) < deadZone) {
161 raw = wpi::sgn(raw) * (std::abs(raw) - deadZone) /
164 return squareOutputs ? std::copysign(raw * raw, raw) : raw;
166 frc2::Trigger RightTriggerLessThan(
double threshold)
const {
167 return AxisLessThan(Axes::rightTrigger, threshold);
169 frc2::Trigger RightTriggerGreaterThan(
double threshold)
const {
170 return AxisGreaterThan(Axes::rightTrigger, threshold);
173 bool GetLeftBumper()
const {
return GetRawButton(Buttons::leftBumper); }
174 bool GetLeftBumperPressed() {
175 return GetRawButtonPressed(Buttons::leftBumper);
177 bool GetLeftBumperReleased() {
178 return GetRawButtonPressed(Buttons::leftBumper);
180 frc2::Trigger LeftBumper()
const {
return Button(Buttons::leftBumper); }
182 bool GetRightBumper()
const {
return GetRawButton(Buttons::rightBumper); }
183 bool GetRightBumperPressed() {
184 return GetRawButtonPressed(Buttons::rightBumper);
186 bool GetRightBumperReleased() {
187 return GetRawButtonPressed(Buttons::rightBumper);
189 frc2::Trigger RightBumper()
const {
return Button(Buttons::rightBumper); }
191 bool GetX()
const {
return GetRawButton(Buttons::X); }
192 bool GetXPressed() {
return GetRawButtonPressed(Buttons::X); }
193 bool GetXReleased() {
return GetRawButtonReleased(Buttons::X); }
194 frc2::Trigger X()
const {
return Button(Buttons::X); }
196 bool GetY()
const {
return GetRawButton(Buttons::Y); }
197 bool GetYPressed() {
return GetRawButtonPressed(Buttons::Y); }
198 bool GetYReleased() {
return GetRawButtonReleased(Buttons::Y); }
199 frc2::Trigger Y()
const {
return Button(Buttons::Y); }
201 bool GetA()
const {
return GetRawButton(Buttons::A); }
202 bool GetAPressed() {
return GetRawButtonPressed(Buttons::A); }
203 bool GetAReleased() {
return GetRawButtonReleased(Buttons::A); }
204 frc2::Trigger A()
const {
return Button(Buttons::A); }
206 bool GetB()
const {
return GetRawButton(Buttons::B); }
207 bool GetBPressed() {
return GetRawButtonPressed(Buttons::B); }
208 bool GetBReleased() {
return GetRawButtonReleased(Buttons::B); }
209 frc2::Trigger B()
const {
return Button(Buttons::B); }
211 bool GetBackButton()
const {
return GetRawButton(Buttons::backButton); }
212 bool GetBackButtonPressed() {
213 return GetRawButtonPressed(Buttons::backButton);
215 bool GetBackButtonReleased() {
216 return GetRawButtonReleased(Buttons::backButton);
218 frc2::Trigger BackButton()
const {
return Button(Buttons::backButton); }
220 bool GetStartButton()
const {
return GetRawButton(Buttons::startButton); }
221 bool GetStartButtonPressed() {
222 return GetRawButtonPressed(Buttons::startButton);
224 bool GetStartButtonReleased() {
225 return GetRawButtonReleased(Buttons::startButton);
227 frc2::Trigger StartButton()
const {
return Button(Buttons::startButton); }