Class Pad

java.lang.Object
com.crossbotics.ftchelper.robot.Pad

public final class Pad extends Object
One gamepad in Controls.java: every button and stick, by name. g1 is the driver's gamepad, g2 the operator's.

 g2.rt.hold(robot.intake::in, robot.intake::stop);   // runs while held, stops on release
 g2.y.press(Actions.scoreHigh(robot));               // an action: press again to cancel
 g2.b.toggle(robot.claw);                            // open / close
 g2.leftStickY.use(robot.lift::manual);              // up = +, every loop
 g1.lt.slow();                                        // slow: the further it is pulled, the slower (one driver)
 g1.a.free();                                         // free: nothing yet

 g2.rb.tap(robot.launcher::fire).says("fire one")     // gestures: several on one button
      .hold(robot.launcher::fireWhileHeld, robot.launcher::ceaseFire).says("keep firing")
      .doubleTap(() -> robot.launcher.fire(3)).says("fire three").rumble();
 g2.a.toggle(robot.intake).rumble();                  // feedback: 2 buzzes = on, 1 = off
 g2.lb.with(g2.y, () -> robot.lift.goTo("high"));     // a pair: hold LB, press Y
 g2.rumbleWhen(robot.launcher::isReady);              // buzz when the robot says so
 

Each button takes ONE job, or several gestures (tap, hold, double-tap, tap then hold, N taps, held for N seconds). Two jobs on one button in Controls.java stop the program at INIT with the button's name; a job you put on a button the modules suggested replaces their suggestion. The full menu: docs/guides/buttons.md. The help on the Driver Station (in INIT) shows the whole map. Docs: docs/modules/robot.md (section "Controls")

  • Field Details

    • a

      public final Pad.Button a
      Face buttons.
    • b

      public final Pad.Button b
      Face buttons.
    • x

      public final Pad.Button x
      Face buttons.
    • y

      public final Pad.Button y
      Face buttons.
    • lb

      public final Pad.Button lb
      Bumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way).
    • rb

      public final Pad.Button rb
      Bumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way).
    • lt

      public final Pad.Button lt
      Bumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way).
    • rt

      public final Pad.Button rt
      Bumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way).
    • back

      public final Pad.Button back
      BACK and START.
    • start

      public final Pad.Button start
      BACK and START.
    • guide

      public final Pad.Button guide
      The middle button (GUIDE, or PS / Home / Logitech). Gamepad 1's shows the button map and the tuning menu.
    • dpadUp

      public final Pad.Button dpadUp
      The D-pad.
    • dpadDown

      public final Pad.Button dpadDown
      The D-pad.
    • dpadLeft

      public final Pad.Button dpadLeft
      The D-pad.
    • dpadRight

      public final Pad.Button dpadRight
      The D-pad.
    • leftStickButton

      public final Pad.Button leftStickButton
      Pressing a stick down (a click).
    • rightStickButton

      public final Pad.Button rightStickButton
      Pressing a stick down (a click).
    • leftStickX

      public final Pad.Stick leftStickX
      The sticks: up and right are +, from -1 to 1.
    • leftStickY

      public final Pad.Stick leftStickY
      The sticks: up and right are +, from -1 to 1.
    • rightStickX

      public final Pad.Stick rightStickX
      The sticks: up and right are +, from -1 to 1.
    • rightStickY

      public final Pad.Stick rightStickY
      The sticks: up and right are +, from -1 to 1.
    • DOUBLE_TAP_SEC

      public static final double DOUBLE_TAP_SEC
      Two taps closer together than this (seconds) are a double-tap.
      See Also:
  • Method Details

    • toString

      public String toString()
      "G1" or "G2".
      Overrides:
      toString in class Object
    • rumbleWhen

      public void rumbleWhen(BooleanSupplier when)
      Feedback from the robot: one buzz on this gamepad each time when becomes true, e.g. g2.rumbleWhen(robot.intake::isFull). Something already true at START does not buzz.
    • rumbleWhen

      public void rumbleWhen(BooleanSupplier when, int buzzes)
      rumbleWhen(BooleanSupplier) with buzzes short buzzes (1 to 3).
    • rumbleWhenAimed

      public void rumbleWhenAimed()
      Feedback for aiming by hand: this gamepad buzzes while the aim is close, the closer the stronger and longer (last season's "on target" buzz). Works for a turret that follows the goal and for whole-robot aim (robot.aimMode()); nothing while neither is aiming. It starts within Tunables.Aim.rumbleDeg (default 4 degrees). One line: g1.rumbleWhenAimed();