001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package org.wpilib.command2.button;
006
007import org.wpilib.command2.CommandScheduler;
008import org.wpilib.driverstation.Gamepad;
009import org.wpilib.event.EventLoop;
010
011/**
012 * A version of {@link Gamepad} with {@link Trigger} factories for command-based.
013 *
014 * @see Gamepad
015 */
016@SuppressWarnings("MethodName")
017public class CommandGamepad extends CommandGenericHID {
018  private final Gamepad m_hid;
019
020  /**
021   * Construct an instance of a controller.
022   *
023   * @param port The port index on the Driver Station that the controller is plugged into.
024   */
025  public CommandGamepad(int port) {
026    super(port);
027    m_hid = new Gamepad(port);
028  }
029
030  /**
031   * Get the underlying GenericHID object.
032   *
033   * @return the wrapped GenericHID object
034   */
035  @Override
036  public Gamepad getHID() {
037    return m_hid;
038  }
039
040  /**
041   * Constructs a Trigger instance around the South Face button's digital signal.
042   *
043   * @return a Trigger instance representing the South Face button's digital signal attached to the
044   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
045   * @see #southFace(EventLoop)
046   */
047  public Trigger southFace() {
048    return southFace(CommandScheduler.getInstance().getDefaultButtonLoop());
049  }
050
051  /**
052   * Constructs a Trigger instance around the South Face button's digital signal.
053   *
054   * @param loop the event loop instance to attach the event to.
055   * @return a Trigger instance representing the South Face button's digital signal attached to the
056   *     given loop.
057   */
058  public Trigger southFace(EventLoop loop) {
059    return button(Gamepad.Button.kSouthFace.value, loop);
060  }
061
062  /**
063   * Constructs a Trigger instance around the East Face button's digital signal.
064   *
065   * @return a Trigger instance representing the East Face button's digital signal attached to the
066   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
067   * @see #eastFace(EventLoop)
068   */
069  public Trigger eastFace() {
070    return eastFace(CommandScheduler.getInstance().getDefaultButtonLoop());
071  }
072
073  /**
074   * Constructs a Trigger instance around the East Face button's digital signal.
075   *
076   * @param loop the event loop instance to attach the event to.
077   * @return a Trigger instance representing the East Face button's digital signal attached to the
078   *     given loop.
079   */
080  public Trigger eastFace(EventLoop loop) {
081    return button(Gamepad.Button.kEastFace.value, loop);
082  }
083
084  /**
085   * Constructs a Trigger instance around the West Face button's digital signal.
086   *
087   * @return a Trigger instance representing the West Face button's digital signal attached to the
088   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
089   * @see #westFace(EventLoop)
090   */
091  public Trigger westFace() {
092    return westFace(CommandScheduler.getInstance().getDefaultButtonLoop());
093  }
094
095  /**
096   * Constructs a Trigger instance around the West Face button's digital signal.
097   *
098   * @param loop the event loop instance to attach the event to.
099   * @return a Trigger instance representing the West Face button's digital signal attached to the
100   *     given loop.
101   */
102  public Trigger westFace(EventLoop loop) {
103    return button(Gamepad.Button.kWestFace.value, loop);
104  }
105
106  /**
107   * Constructs a Trigger instance around the North Face button's digital signal.
108   *
109   * @return a Trigger instance representing the North Face button's digital signal attached to the
110   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
111   * @see #northFace(EventLoop)
112   */
113  public Trigger northFace() {
114    return northFace(CommandScheduler.getInstance().getDefaultButtonLoop());
115  }
116
117  /**
118   * Constructs a Trigger instance around the North Face button's digital signal.
119   *
120   * @param loop the event loop instance to attach the event to.
121   * @return a Trigger instance representing the North Face button's digital signal attached to the
122   *     given loop.
123   */
124  public Trigger northFace(EventLoop loop) {
125    return button(Gamepad.Button.kNorthFace.value, loop);
126  }
127
128  /**
129   * Constructs a Trigger instance around the Back button's digital signal.
130   *
131   * @return a Trigger instance representing the Back button's digital signal attached to the {@link
132   *     CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
133   * @see #back(EventLoop)
134   */
135  public Trigger back() {
136    return back(CommandScheduler.getInstance().getDefaultButtonLoop());
137  }
138
139  /**
140   * Constructs a Trigger instance around the Back button's digital signal.
141   *
142   * @param loop the event loop instance to attach the event to.
143   * @return a Trigger instance representing the Back button's digital signal attached to the given
144   *     loop.
145   */
146  public Trigger back(EventLoop loop) {
147    return button(Gamepad.Button.kBack.value, loop);
148  }
149
150  /**
151   * Constructs a Trigger instance around the Guide button's digital signal.
152   *
153   * @return a Trigger instance representing the Guide button's digital signal attached to the
154   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
155   * @see #guide(EventLoop)
156   */
157  public Trigger guide() {
158    return guide(CommandScheduler.getInstance().getDefaultButtonLoop());
159  }
160
161  /**
162   * Constructs a Trigger instance around the Guide button's digital signal.
163   *
164   * @param loop the event loop instance to attach the event to.
165   * @return a Trigger instance representing the Guide button's digital signal attached to the given
166   *     loop.
167   */
168  public Trigger guide(EventLoop loop) {
169    return button(Gamepad.Button.kGuide.value, loop);
170  }
171
172  /**
173   * Constructs a Trigger instance around the Start button's digital signal.
174   *
175   * @return a Trigger instance representing the Start button's digital signal attached to the
176   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
177   * @see #start(EventLoop)
178   */
179  public Trigger start() {
180    return start(CommandScheduler.getInstance().getDefaultButtonLoop());
181  }
182
183  /**
184   * Constructs a Trigger instance around the Start button's digital signal.
185   *
186   * @param loop the event loop instance to attach the event to.
187   * @return a Trigger instance representing the Start button's digital signal attached to the given
188   *     loop.
189   */
190  public Trigger start(EventLoop loop) {
191    return button(Gamepad.Button.kStart.value, loop);
192  }
193
194  /**
195   * Constructs a Trigger instance around the left stick button's digital signal.
196   *
197   * @return a Trigger instance representing the left stick button's digital signal attached to the
198   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
199   * @see #leftStick(EventLoop)
200   */
201  public Trigger leftStick() {
202    return leftStick(CommandScheduler.getInstance().getDefaultButtonLoop());
203  }
204
205  /**
206   * Constructs a Trigger instance around the left stick button's digital signal.
207   *
208   * @param loop the event loop instance to attach the event to.
209   * @return a Trigger instance representing the left stick button's digital signal attached to the
210   *     given loop.
211   */
212  public Trigger leftStick(EventLoop loop) {
213    return button(Gamepad.Button.kLeftStick.value, loop);
214  }
215
216  /**
217   * Constructs a Trigger instance around the right stick button's digital signal.
218   *
219   * @return a Trigger instance representing the right stick button's digital signal attached to the
220   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
221   * @see #rightStick(EventLoop)
222   */
223  public Trigger rightStick() {
224    return rightStick(CommandScheduler.getInstance().getDefaultButtonLoop());
225  }
226
227  /**
228   * Constructs a Trigger instance around the right stick button's digital signal.
229   *
230   * @param loop the event loop instance to attach the event to.
231   * @return a Trigger instance representing the right stick button's digital signal attached to the
232   *     given loop.
233   */
234  public Trigger rightStick(EventLoop loop) {
235    return button(Gamepad.Button.kRightStick.value, loop);
236  }
237
238  /**
239   * Constructs a Trigger instance around the right bumper button's digital signal.
240   *
241   * @return a Trigger instance representing the right bumper button's digital signal attached to
242   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
243   * @see #leftBumper(EventLoop)
244   */
245  public Trigger leftBumper() {
246    return leftBumper(CommandScheduler.getInstance().getDefaultButtonLoop());
247  }
248
249  /**
250   * Constructs a Trigger instance around the right bumper button's digital signal.
251   *
252   * @param loop the event loop instance to attach the event to.
253   * @return a Trigger instance representing the right bumper button's digital signal attached to
254   *     the given loop.
255   */
256  public Trigger leftBumper(EventLoop loop) {
257    return button(Gamepad.Button.kLeftBumper.value, loop);
258  }
259
260  /**
261   * Constructs a Trigger instance around the right bumper button's digital signal.
262   *
263   * @return a Trigger instance representing the right bumper button's digital signal attached to
264   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
265   * @see #rightBumper(EventLoop)
266   */
267  public Trigger rightBumper() {
268    return rightBumper(CommandScheduler.getInstance().getDefaultButtonLoop());
269  }
270
271  /**
272   * Constructs a Trigger instance around the right bumper button's digital signal.
273   *
274   * @param loop the event loop instance to attach the event to.
275   * @return a Trigger instance representing the right bumper button's digital signal attached to
276   *     the given loop.
277   */
278  public Trigger rightBumper(EventLoop loop) {
279    return button(Gamepad.Button.kRightBumper.value, loop);
280  }
281
282  /**
283   * Constructs a Trigger instance around the D-pad up button's digital signal.
284   *
285   * @return a Trigger instance representing the D-pad up button's digital signal attached to the
286   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
287   * @see #dpadUp(EventLoop)
288   */
289  public Trigger dpadUp() {
290    return dpadUp(CommandScheduler.getInstance().getDefaultButtonLoop());
291  }
292
293  /**
294   * Constructs a Trigger instance around the D-pad up button's digital signal.
295   *
296   * @param loop the event loop instance to attach the event to.
297   * @return a Trigger instance representing the D-pad up button's digital signal attached to the
298   *     given loop.
299   */
300  public Trigger dpadUp(EventLoop loop) {
301    return button(Gamepad.Button.kDpadUp.value, loop);
302  }
303
304  /**
305   * Constructs a Trigger instance around the D-pad down button's digital signal.
306   *
307   * @return a Trigger instance representing the D-pad down button's digital signal attached to the
308   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
309   * @see #dpadDown(EventLoop)
310   */
311  public Trigger dpadDown() {
312    return dpadDown(CommandScheduler.getInstance().getDefaultButtonLoop());
313  }
314
315  /**
316   * Constructs a Trigger instance around the D-pad down button's digital signal.
317   *
318   * @param loop the event loop instance to attach the event to.
319   * @return a Trigger instance representing the D-pad down button's digital signal attached to the
320   *     given loop.
321   */
322  public Trigger dpadDown(EventLoop loop) {
323    return button(Gamepad.Button.kDpadDown.value, loop);
324  }
325
326  /**
327   * Constructs a Trigger instance around the D-pad left button's digital signal.
328   *
329   * @return a Trigger instance representing the D-pad left button's digital signal attached to the
330   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
331   * @see #dpadLeft(EventLoop)
332   */
333  public Trigger dpadLeft() {
334    return dpadLeft(CommandScheduler.getInstance().getDefaultButtonLoop());
335  }
336
337  /**
338   * Constructs a Trigger instance around the D-pad left button's digital signal.
339   *
340   * @param loop the event loop instance to attach the event to.
341   * @return a Trigger instance representing the D-pad left button's digital signal attached to the
342   *     given loop.
343   */
344  public Trigger dpadLeft(EventLoop loop) {
345    return button(Gamepad.Button.kDpadLeft.value, loop);
346  }
347
348  /**
349   * Constructs a Trigger instance around the D-pad right button's digital signal.
350   *
351   * @return a Trigger instance representing the D-pad right button's digital signal attached to the
352   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
353   * @see #dpadRight(EventLoop)
354   */
355  public Trigger dpadRight() {
356    return dpadRight(CommandScheduler.getInstance().getDefaultButtonLoop());
357  }
358
359  /**
360   * Constructs a Trigger instance around the D-pad right button's digital signal.
361   *
362   * @param loop the event loop instance to attach the event to.
363   * @return a Trigger instance representing the D-pad right button's digital signal attached to the
364   *     given loop.
365   */
366  public Trigger dpadRight(EventLoop loop) {
367    return button(Gamepad.Button.kDpadRight.value, loop);
368  }
369
370  /**
371   * Constructs a Trigger instance around the Miscellaneous 1 button's digital signal.
372   *
373   * @return a Trigger instance representing the Miscellaneous 1 button's digital signal attached to
374   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
375   * @see #misc1(EventLoop)
376   */
377  public Trigger misc1() {
378    return misc1(CommandScheduler.getInstance().getDefaultButtonLoop());
379  }
380
381  /**
382   * Constructs a Trigger instance around the Miscellaneous 1 button's digital signal.
383   *
384   * @param loop the event loop instance to attach the event to.
385   * @return a Trigger instance representing the Miscellaneous 1 button's digital signal attached to
386   *     the given loop.
387   */
388  public Trigger misc1(EventLoop loop) {
389    return button(Gamepad.Button.kMisc1.value, loop);
390  }
391
392  /**
393   * Constructs a Trigger instance around the Right Paddle 1 button's digital signal.
394   *
395   * @return a Trigger instance representing the Right Paddle 1 button's digital signal attached to
396   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
397   * @see #rightPaddle1(EventLoop)
398   */
399  public Trigger rightPaddle1() {
400    return rightPaddle1(CommandScheduler.getInstance().getDefaultButtonLoop());
401  }
402
403  /**
404   * Constructs a Trigger instance around the Right Paddle 1 button's digital signal.
405   *
406   * @param loop the event loop instance to attach the event to.
407   * @return a Trigger instance representing the Right Paddle 1 button's digital signal attached to
408   *     the given loop.
409   */
410  public Trigger rightPaddle1(EventLoop loop) {
411    return button(Gamepad.Button.kRightPaddle1.value, loop);
412  }
413
414  /**
415   * Constructs a Trigger instance around the Left Paddle 1 button's digital signal.
416   *
417   * @return a Trigger instance representing the Left Paddle 1 button's digital signal attached to
418   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
419   * @see #leftPaddle1(EventLoop)
420   */
421  public Trigger leftPaddle1() {
422    return leftPaddle1(CommandScheduler.getInstance().getDefaultButtonLoop());
423  }
424
425  /**
426   * Constructs a Trigger instance around the Left Paddle 1 button's digital signal.
427   *
428   * @param loop the event loop instance to attach the event to.
429   * @return a Trigger instance representing the Left Paddle 1 button's digital signal attached to
430   *     the given loop.
431   */
432  public Trigger leftPaddle1(EventLoop loop) {
433    return button(Gamepad.Button.kLeftPaddle1.value, loop);
434  }
435
436  /**
437   * Constructs a Trigger instance around the Right Paddle 2 button's digital signal.
438   *
439   * @return a Trigger instance representing the Right Paddle 2 button's digital signal attached to
440   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
441   * @see #rightPaddle2(EventLoop)
442   */
443  public Trigger rightPaddle2() {
444    return rightPaddle2(CommandScheduler.getInstance().getDefaultButtonLoop());
445  }
446
447  /**
448   * Constructs a Trigger instance around the Right Paddle 2 button's digital signal.
449   *
450   * @param loop the event loop instance to attach the event to.
451   * @return a Trigger instance representing the Right Paddle 2 button's digital signal attached to
452   *     the given loop.
453   */
454  public Trigger rightPaddle2(EventLoop loop) {
455    return button(Gamepad.Button.kRightPaddle2.value, loop);
456  }
457
458  /**
459   * Constructs a Trigger instance around the Left Paddle 2 button's digital signal.
460   *
461   * @return a Trigger instance representing the Left Paddle 2 button's digital signal attached to
462   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
463   * @see #leftPaddle2(EventLoop)
464   */
465  public Trigger leftPaddle2() {
466    return leftPaddle2(CommandScheduler.getInstance().getDefaultButtonLoop());
467  }
468
469  /**
470   * Constructs a Trigger instance around the Left Paddle 2 button's digital signal.
471   *
472   * @param loop the event loop instance to attach the event to.
473   * @return a Trigger instance representing the Left Paddle 2 button's digital signal attached to
474   *     the given loop.
475   */
476  public Trigger leftPaddle2(EventLoop loop) {
477    return button(Gamepad.Button.kLeftPaddle2.value, loop);
478  }
479
480  /**
481   * Constructs a Trigger instance around the Touchpad button's digital signal.
482   *
483   * @return a Trigger instance representing the Touchpad button's digital signal attached to the
484   *     {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
485   * @see #touchpad(EventLoop)
486   */
487  public Trigger touchpad() {
488    return touchpad(CommandScheduler.getInstance().getDefaultButtonLoop());
489  }
490
491  /**
492   * Constructs a Trigger instance around the Touchpad button's digital signal.
493   *
494   * @param loop the event loop instance to attach the event to.
495   * @return a Trigger instance representing the Touchpad button's digital signal attached to the
496   *     given loop.
497   */
498  public Trigger touchpad(EventLoop loop) {
499    return button(Gamepad.Button.kTouchpad.value, loop);
500  }
501
502  /**
503   * Constructs a Trigger instance around the Miscellaneous 2 button's digital signal.
504   *
505   * @return a Trigger instance representing the Miscellaneous 2 button's digital signal attached to
506   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
507   * @see #misc2(EventLoop)
508   */
509  public Trigger misc2() {
510    return misc2(CommandScheduler.getInstance().getDefaultButtonLoop());
511  }
512
513  /**
514   * Constructs a Trigger instance around the Miscellaneous 2 button's digital signal.
515   *
516   * @param loop the event loop instance to attach the event to.
517   * @return a Trigger instance representing the Miscellaneous 2 button's digital signal attached to
518   *     the given loop.
519   */
520  public Trigger misc2(EventLoop loop) {
521    return button(Gamepad.Button.kMisc2.value, loop);
522  }
523
524  /**
525   * Constructs a Trigger instance around the Miscellaneous 3 button's digital signal.
526   *
527   * @return a Trigger instance representing the Miscellaneous 3 button's digital signal attached to
528   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
529   * @see #misc3(EventLoop)
530   */
531  public Trigger misc3() {
532    return misc3(CommandScheduler.getInstance().getDefaultButtonLoop());
533  }
534
535  /**
536   * Constructs a Trigger instance around the Miscellaneous 3 button's digital signal.
537   *
538   * @param loop the event loop instance to attach the event to.
539   * @return a Trigger instance representing the Miscellaneous 3 button's digital signal attached to
540   *     the given loop.
541   */
542  public Trigger misc3(EventLoop loop) {
543    return button(Gamepad.Button.kMisc3.value, loop);
544  }
545
546  /**
547   * Constructs a Trigger instance around the Miscellaneous 4 button's digital signal.
548   *
549   * @return a Trigger instance representing the Miscellaneous 4 button's digital signal attached to
550   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
551   * @see #misc4(EventLoop)
552   */
553  public Trigger misc4() {
554    return misc4(CommandScheduler.getInstance().getDefaultButtonLoop());
555  }
556
557  /**
558   * Constructs a Trigger instance around the Miscellaneous 4 button's digital signal.
559   *
560   * @param loop the event loop instance to attach the event to.
561   * @return a Trigger instance representing the Miscellaneous 4 button's digital signal attached to
562   *     the given loop.
563   */
564  public Trigger misc4(EventLoop loop) {
565    return button(Gamepad.Button.kMisc4.value, loop);
566  }
567
568  /**
569   * Constructs a Trigger instance around the Miscellaneous 5 button's digital signal.
570   *
571   * @return a Trigger instance representing the Miscellaneous 5 button's digital signal attached to
572   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
573   * @see #misc5(EventLoop)
574   */
575  public Trigger misc5() {
576    return misc5(CommandScheduler.getInstance().getDefaultButtonLoop());
577  }
578
579  /**
580   * Constructs a Trigger instance around the Miscellaneous 5 button's digital signal.
581   *
582   * @param loop the event loop instance to attach the event to.
583   * @return a Trigger instance representing the Miscellaneous 5 button's digital signal attached to
584   *     the given loop.
585   */
586  public Trigger misc5(EventLoop loop) {
587    return button(Gamepad.Button.kMisc5.value, loop);
588  }
589
590  /**
591   * Constructs a Trigger instance around the Miscellaneous 6 button's digital signal.
592   *
593   * @return a Trigger instance representing the Miscellaneous 6 button's digital signal attached to
594   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
595   * @see #misc6(EventLoop)
596   */
597  public Trigger misc6() {
598    return misc6(CommandScheduler.getInstance().getDefaultButtonLoop());
599  }
600
601  /**
602   * Constructs a Trigger instance around the Miscellaneous 6 button's digital signal.
603   *
604   * @param loop the event loop instance to attach the event to.
605   * @return a Trigger instance representing the Miscellaneous 6 button's digital signal attached to
606   *     the given loop.
607   */
608  public Trigger misc6(EventLoop loop) {
609    return button(Gamepad.Button.kMisc6.value, loop);
610  }
611
612  /**
613   * Constructs a Trigger instance around the axis value of the left trigger. The returned trigger
614   * will be true when the axis value is greater than {@code threshold}.
615   *
616   * @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
617   *     should be in the range [0, 1] where 0 is the unpressed state of the axis.
618   * @param loop the event loop instance to attach the Trigger to.
619   * @return a Trigger instance that is true when the left trigger's axis exceeds the provided
620   *     threshold, attached to the given event loop
621   */
622  public Trigger leftTrigger(double threshold, EventLoop loop) {
623    return axisGreaterThan(Gamepad.Axis.kLeftTrigger.value, threshold, loop);
624  }
625
626  /**
627   * Constructs a Trigger instance around the axis value of the left trigger. The returned trigger
628   * will be true when the axis value is greater than {@code threshold}.
629   *
630   * @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
631   *     should be in the range [0, 1] where 0 is the unpressed state of the axis.
632   * @return a Trigger instance that is true when the left trigger's axis exceeds the provided
633   *     threshold, attached to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler
634   *     button loop}.
635   */
636  public Trigger leftTrigger(double threshold) {
637    return leftTrigger(threshold, CommandScheduler.getInstance().getDefaultButtonLoop());
638  }
639
640  /**
641   * Constructs a Trigger instance around the axis value of the left trigger. The returned trigger
642   * will be true when the axis value is greater than 0.5.
643   *
644   * @return a Trigger instance that is true when the left trigger's axis exceeds 0.5, attached to
645   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
646   */
647  public Trigger leftTrigger() {
648    return leftTrigger(0.5);
649  }
650
651  /**
652   * Constructs a Trigger instance around the axis value of the right trigger. The returned trigger
653   * will be true when the axis value is greater than {@code threshold}.
654   *
655   * @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
656   *     should be in the range [0, 1] where 0 is the unpressed state of the axis.
657   * @param loop the event loop instance to attach the Trigger to.
658   * @return a Trigger instance that is true when the right trigger's axis exceeds the provided
659   *     threshold, attached to the given event loop
660   */
661  public Trigger rightTrigger(double threshold, EventLoop loop) {
662    return axisGreaterThan(Gamepad.Axis.kRightTrigger.value, threshold, loop);
663  }
664
665  /**
666   * Constructs a Trigger instance around the axis value of the right trigger. The returned trigger
667   * will be true when the axis value is greater than {@code threshold}.
668   *
669   * @param threshold the minimum axis value for the returned {@link Trigger} to be true. This value
670   *     should be in the range [0, 1] where 0 is the unpressed state of the axis.
671   * @return a Trigger instance that is true when the right trigger's axis exceeds the provided
672   *     threshold, attached to the {@link CommandScheduler#getDefaultButtonLoop() default scheduler
673   *     button loop}.
674   */
675  public Trigger rightTrigger(double threshold) {
676    return rightTrigger(threshold, CommandScheduler.getInstance().getDefaultButtonLoop());
677  }
678
679  /**
680   * Constructs a Trigger instance around the axis value of the right trigger. The returned trigger
681   * will be true when the axis value is greater than 0.5.
682   *
683   * @return a Trigger instance that is true when the right trigger's axis exceeds 0.5, attached to
684   *     the {@link CommandScheduler#getDefaultButtonLoop() default scheduler button loop}.
685   */
686  public Trigger rightTrigger() {
687    return rightTrigger(0.5);
688  }
689
690  /**
691   * Get the X axis value of left side of the controller. Right is positive.
692   *
693   * @return The axis value.
694   */
695  public double getLeftX() {
696    return m_hid.getLeftX();
697  }
698
699  /**
700   * Get the Y axis value of left side of the controller. Back is positive.
701   *
702   * @return The axis value.
703   */
704  public double getLeftY() {
705    return m_hid.getLeftY();
706  }
707
708  /**
709   * Get the X axis value of right side of the controller. Right is positive.
710   *
711   * @return The axis value.
712   */
713  public double getRightX() {
714    return m_hid.getRightX();
715  }
716
717  /**
718   * Get the Y axis value of right side of the controller. Back is positive.
719   *
720   * @return The axis value.
721   */
722  public double getRightY() {
723    return m_hid.getRightY();
724  }
725
726  /**
727   * Get the left trigger axis value of the controller. Note that this axis is bound to the range of
728   * [0, 1] as opposed to the usual [-1, 1].
729   *
730   * @return The axis value.
731   */
732  public double getLeftTriggerAxis() {
733    return m_hid.getLeftTriggerAxis();
734  }
735
736  /**
737   * Get the right trigger axis value of the controller. Note that this axis is bound to the range
738   * of [0, 1] as opposed to the usual [-1, 1].
739   *
740   * @return The axis value.
741   */
742  public double getRightTriggerAxis() {
743    return m_hid.getRightTriggerAxis();
744  }
745}