Skip to content
Work in progress. This library and its docs are new and still changing, and some parts are not yet tested on a real robot. If something is wrong or unclear,tell us with a short GitHub form.

Step 5: The buttons

At the end of this step, you know every button of R1 TeleOp, and why each line of robot 1’s Controls.java is there. One driver on gamepad 1 drives, runs the intake, fires and aims. The drivers know these buttons from last season: LB is the intake and RB fires.

Try it missions: make the change, check it, then undo it with git restore TeamCode simulator (in the octobots-2026-r1 folder). Never commit a mission. Step 3 has the full rule and how to run a test.

All on gamepad 1:

Button What it does
Left stick drive and strafe
Right stick X turn
LT (held) drive slowly
Left stick click reverse drive on/off (the intake end is the front)
Right stick click auto-aim on/off (only with the HIVE in view)
RT held, then right stick click field-centric (the stick moves the robot the same way on the field, wherever it faces) on/off (not vetted yet)
LB tap: intake on/off. Double tap: push out, until the next tap
B flywheel on/off. Off, RB still spins it up, fires, and switches it off
RB tap: fire one. Hold: keep firing. Tap, then press and hold: SPRAY
D-pad up / down flywheel speed + / - 50 RPM
X push the intake over again
Y (held 1/2 s) the camera’s lighting test again
A, D-pad right / left, right stick Y free
BACK pause (held 1 s: “forward” is where the robot faces now)
GUIDE the button map (held 1 s: the tuning menu, PRACTICE profile)
In INIT: X / B BLUE / RED

Robot 1’s code:

Controls.java
@Override
protected void buttons(Robot robot, Pad g1, Pad g2) {
robot.launcher.fireOn(g1.rb); // tap: one; hold: keep firing; tap, then hold: spray
robot.launcher.speedOn(g1.dpadUp, g1.dpadDown); // D-pad up / down: flywheel speed, 50 RPM a tap
g1.lb.tapOrDoubleTap(() -> { // intake: tap on/off, double-tap out
if (robot.intake.isPushingOut()) robot.intake.in();
else robot.intake.toggle();
}, robot.intake::out).says("intake on/off; double-tap: out until tapped");
g1.b.toggle(robot.launcher).says("flywheel on/off (off: RB spins it up to fire)"); // off: RB spins up, fires, stops
g1.leftStickButton.toggle(robot.reverseDriveMode()).rumble().says("reverse drive on/off"); // 2 buzzes = on
g1.rightStickButton.toggle(robot.aimMode()).rumble().says("auto-aim on/off"); // stays off with no HIVE in view
g1.rumbleWhenAimed(); // buzz while the aim is close
g1.rt.with(g1.rightStickButton, () -> driving().toggleFieldCentric())
.says("field-centric on/off (not vetted)"); // hold RT, then click the right stick
g1.lt.slow(); // LT: drive slowly while held
g1.x.press(Actions.deployIntake(robot)).says("deploy intake").needs(robot.intakeDeploy); // push the intake over again
g1.y.heldFor(0.5, robot.camera::relight).rumble()
.says("camera: lighting test again (aim at a tag)"); // held: a bump does not blind it
g1.a.free(); // free: replace free() with a job
g1.dpadRight.free(); // free (was the feeder arm's push trim)
g1.dpadLeft.free();
g1.rightStickY.free(); // free: a stick, .use(...)
}

Learn it: How buttons work. Read “The four pieces of a button line”, “Modes” and “A part’s buttons”.

Why robot 1 does it this way:

  • One driver: oneDriver = true, like goBILDA’s code.
  • Robot 1 writes its parts’ buttons on g1, not g2. The docs say to use g2 from the start, so that a second gamepad later moves them with one change. Robot 1 has one driver, so all its lines are on g1. With two gamepads, you would change each part line to g2.
  • The launcher’s own button lines: fireOn(g1.rb) and speedOn(g1.dpadUp, g1.dpadDown). The launcher gives each its jobs (fire, keep firing, SPRAY, speed up, speed down).
  • Two modes on buttons: robot.reverseDriveMode() (left stick click) and robot.aimMode() (right stick click). Both have .rumble(): two buzzes = on, one = off. Aim mode stays off with no HIVE in view.
  • .needs(robot.intakeDeploy) on X: with no deploy servo in the configuration, X is off.
  • Free buttons: g1.a.free();, g1.dpadRight.free();, g1.dpadLeft.free(); and g1.rightStickY.free();. They have no job on purpose. The help page lists them as free, ready for a job later.

Check: r1-buttons.sim checks the D-pad speed buttons, reverse drive, the field-centric pair and SPRAY. r1-v1.sim checks LB, RB and B.

Try it (optional): put a job on A. Replace g1.a.free(); with this line:

Controls.java
g1.a.press(robot.intake::stop).says("intake stop");

Run Simulator, pick R1 TeleOp, press INIT, and find intake stop on the button map. Press ▶, then A: the intake stops. Then undo it.

Robot 1’s code: every button line above uses a press type. Find each one:

Press type Robot 1’s line
tap or double tap LB: the intake
toggle B (the flywheel), the left and right stick clicks (the modes)
press X, D-pad right and left
two buttons together RT, then the right stick click: field-centric
held for a time Y, 0.5 s
the launcher’s own gestures robot.launcher.fireOn(g1.rb): tap, hold, and tap then hold (SPRAY)

Learn it: Press types. Read “Every press type”, “Tap and double tap: two ways” and “Two buttons together”.

Why robot 1 does it this way:

  • LB uses tapOrDoubleTap, the older way. Why: the tap (intake on/off) runs at once, with no 0.35 s wait. The second tap of a double tap then pushes out.
  • Y is held 1/2 s (heldFor(0.5, ...)), so a bump does not start the lighting test. The camera sees nothing until the test is done.
  • RT is a shift key: it has no job of its own. A right stick click alone switches aim mode. RT with the click switches field-centric.

Check: r1-intake-lb.sim checks LB: a tap switches the intake off and on, a double tap pushes out, and one more tap runs it in again.

Try it (optional): in simulator/scenarios/r1-intake-lb.sim, delete the wait 0.5 line right before # tap: on again. Run r1-intake-lb.sim: the check after it fails. Why: the two taps came within 0.35 s, so they were a double tap, and the intake pushed out. Then undo it.

Robot 1’s code:

Controls.java
// Seconds LEFT when both gamepads buzz: 1:00, 1:40 and 1:59 into the 2:00 TeleOp.
@Override
protected double[] buzzAtSecondsLeft() {
return new double[] {60, 20, 1};
}

Learn it: What the drivers see and feel. Read “Feedback on a button” and “The button map and the TeleOp’s INIT screen”.

Why robot 1 does it this way:

  • Every button line has a .says(...). The button map shows the words at INIT, and when the driver taps GUIDE.
  • Buzzes: the two stick clicks have .rumble(), and so does Y. g1.rumbleWhenAimed(); buzzes gamepad 1 while the aim is close. The docs’ example uses g2: robot 1 has one driver, so it uses g1.
  • The match clock: both gamepads buzz at 1:00, 1:40 and 1:59 of TeleOp. Robot 1 gives the seconds left (60, 20, 1).
  • No lights and no show(...) lines.

Check: r1-button-map.sim checks that the button map at INIT shows robot 1’s words, for example intake on/off; double-tap: out until tapped.

Try it (optional): add a show(...) line at the end of buttons(...):

Controls.java
show("Intake on", robot.intake::isRunning);

Run Simulator, pick R1 TeleOp, press INIT and ▶, and watch the line change when you tap LB. Then undo it.

Robot 1’s code:

Controls.java
// Always there: the library's buttons, on gamepad 1. Two are off on robot 1 (null = no button).
@Override
protected void libraryButtons(LibraryButtons lib, Pad g1, Pad g2) {
lib.swapSticks(false); // left stick: drive and slide; right stick X: turn
lib.slowToggle(null); // off: the left stick click is reverse drive (LT drives slowly, below)
lib.fieldCentric(null); // off: field-centric is RT + right stick click (below)
lib.pause(g1.back); // BACK: pause at the press; a tap goes on
lib.resetForward(g1.back); // BACK held 1 s: "forward" is where the robot faces now
lib.debug(g1.start, g1.back); // hold START, then press BACK: the debug lines
lib.setPose(g1.start); // START held 1 s: set pose here (robots with odometry)
lib.buttonMap(g1.guide); // GUIDE: the button map on the Driver Hub
lib.tuningMenu(g1.guide); // GUIDE held 1 s: the tuning menu (PRACTICE profile)
lib.allianceInInit(g1.x, g1.b); // in INIT: X = BLUE, B = RED
}

Learn it: Move the library’s buttons. Read “Move or free a button” and “Every library button”.

Why robot 1 does it this way:

  • Robot 1 writes out every library button, so you can read them all in one place.
  • Two are off (null), because robot 1 uses their buttons for its own jobs:
    • Slow: LT, held, with its own line in buttons(...): g1.lt.slow();. The left stick click is reverse drive.
    • Field-centric is a pair of robot 1’s own: hold RT, then click the right stick. Why: one click by accident would turn the sticks around.
  • The others stay where the docs put them: BACK pauses, GUIDE shows the map (held 1 s: the tuning menu), and in INIT X = BLUE, B = RED.
  • lib.setPose(g1.start) is for robots with odometry. Robot 1 has none.

Check: r1-buttons.sim checks both moves: a right stick click alone does not switch field-centric, and RT with the click does.

Try it (optional): change lib.swapSticks(false); to lib.swapSticks(true);. Now the right stick Y drives, so the left stick Y is the free one. In buttons(...), change g1.rightStickY.free(); to g1.leftStickY.free();. Run Simulator and drive: the right stick drives, and the left stick X turns. Then undo it.

Done when: you know every button of R1 TeleOp, and why each of robot 1’s button lines is there.


Next: Step 6: The autos.