Package com.crossbotics.ftchelper.robot
Class Pad
java.lang.Object
com.crossbotics.ftchelper.robot.Pad
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")
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classOne button or trigger.static final classOne stick direction: up and right are +, from -1 to 1. -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Pad.ButtonFace buttons.final Pad.ButtonFace buttons.final Pad.ButtonBACK and START.static final doubleTwo taps closer together than this (seconds) are a double-tap.final Pad.ButtonThe D-pad.final Pad.ButtonThe D-pad.final Pad.ButtonThe D-pad.final Pad.ButtonThe D-pad.final Pad.ButtonThe middle button (GUIDE, or PS / Home / Logitech).final Pad.ButtonBumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way).final Pad.ButtonPressing a stick down (a click).final Pad.StickThe sticks: up and right are +, from -1 to 1.final Pad.StickThe sticks: up and right are +, from -1 to 1.final Pad.ButtonBumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way).final Pad.ButtonBumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way).final Pad.ButtonPressing a stick down (a click).final Pad.StickThe sticks: up and right are +, from -1 to 1.final Pad.StickThe sticks: up and right are +, from -1 to 1.final Pad.ButtonBumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way).final Pad.ButtonBACK and START.final Pad.ButtonFace buttons.final Pad.ButtonFace buttons. -
Method Summary
Modifier and TypeMethodDescriptionvoidrumbleWhen(BooleanSupplier when) Feedback from the robot: one buzz on this gamepad each timewhenbecomes true, e.g.voidrumbleWhen(BooleanSupplier when, int buzzes) rumbleWhen(BooleanSupplier)withbuzzesshort buzzes (1 to 3).voidFeedback for aiming by hand: this gamepad buzzes while the aim is close, the closer the stronger and longer (last season's "on target" buzz).toString()"G1" or "G2".
-
Field Details
-
a
Face buttons. -
b
Face buttons. -
x
Face buttons. -
y
Face buttons. -
lb
Bumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way). -
rb
Bumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way). -
lt
Bumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way). -
rt
Bumpers (LB, RB) and triggers (LT, RT; a trigger counts as pressed past half way). -
back
BACK and START. -
start
BACK and START. -
guide
The middle button (GUIDE, or PS / Home / Logitech). Gamepad 1's shows the button map and the tuning menu. -
dpadUp
The D-pad. -
dpadDown
The D-pad. -
dpadLeft
The D-pad. -
dpadRight
The D-pad. -
leftStickButton
Pressing a stick down (a click). -
rightStickButton
Pressing a stick down (a click). -
leftStickX
The sticks: up and right are +, from -1 to 1. -
leftStickY
The sticks: up and right are +, from -1 to 1. -
rightStickX
The sticks: up and right are +, from -1 to 1. -
rightStickY
The sticks: up and right are +, from -1 to 1. -
DOUBLE_TAP_SEC
public static final double DOUBLE_TAP_SECTwo taps closer together than this (seconds) are a double-tap.- See Also:
-
-
Method Details
-
toString
"G1" or "G2". -
rumbleWhen
Feedback from the robot: one buzz on this gamepad each timewhenbecomes true, e.g.g2.rumbleWhen(robot.intake::isFull). Something already true at START does not buzz. -
rumbleWhen
rumbleWhen(BooleanSupplier)withbuzzesshort 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 withinTunables.Aim.rumbleDeg(default 4 degrees). One line:g1.rumbleWhenAimed();
-