Step 3: The five files
At the end of this step, you know what each of robot 1’s five files holds. You also know where to change
a number, a button or an autonomous. You read robot 1’s real code, in the team’s project octobots-2026-r1. Each block
links to the docs page that teaches it.
All five files are in TeamCode/src/main/java/org/firstinspires/ftc/teamcode/.
Try it, then undo it
Section titled “Try it, then undo it”Each block on steps 3 to 7 can end with a Try it mission. A mission is a small change to robot 1’s code or to one of its tests. A mission teaches you what a line does. It is not a change for the robot.
- Make the change in the team’s project.
- Check it in the simulator, or run the test that the mission names.
- Put the code back. Undo every change in
TeamCodeandsimulator:
Where: Android Studio’s Terminal tab, in the octobots-2026-r1 folder.
git restore TeamCode simulatorOr, in Android Studio: Git > Rollback.
Never commit a mission. Why: a mission changes robot 1’s tuned numbers, buttons or routes. If you commit it, it goes onto the real robot. A real change follows the team’s change loop.
The checks on these pages are robot 1’s own tests, in its simulator/scenarios/ folder. Run one:
Where: Android Studio’s Terminal tab, in the ftc-helper-lib folder inside octobots-2026-r1.
./gradlew :sim:scenario -Pfile=../simulator/scenarios/r1-v1.simPut the test’s file name in place of r1-v1.sim. Or click the Simulator tests button: it runs all of
them. Each test must say PASSED.
Which start robot 1 used
Section titled “Which start robot 1 used”Learn it: Pick your start, and A starter bot: You changed your starter bot. Read how a team picks its first files.
Why robot 1 does it this way:
- Robot 1 sits on goBILDA’s Strafer chassis (3209-0001-0007), the chassis of goBILDA’s starter bot.
- Its code keeps two of goBILDA’s starter choices: one driver does everything on gamepad 1, and the
flywheel uses goBILDA’s tested speed numbers (
kP = 40,kF = 12.5). - Then the team changed the rest: a folding intake with a deploy servo, a squeeze feeder (two feed wheels, one on
each side of the POLLEN), a ramp, a webcam, its own device names (
front_left, notleft_front_drive), its own buttons and three autonomous programs.
You do not pick a start. Robot 1’s code is your start.
Robot.java
Section titled “Robot.java”Robot 1’s code: what is on the robot. The top of the file, and the drive:
public class Robot extends RobotDefinition { public Positioner intakeDeploy; public Intake intake; public Launcher launcher; public Camera camera;
/** Push the intake over right after START? An autonomous that starts against a wall sets it false. */ public boolean deployAtStart = true;
@Override protected void define() { // The drive: the Strafer's four 312 RPM motors and 104 mm GripForce mecanum wheels. Order: FL, FR, BL, BR. // The library reverses the left side (front_left, back_left): Tune and check > Motor Direction Check checks it. // "front_left" ... "imu" = names in the robot configuration (Driver Station), exactly. drive(Drive.mecanum("front_left", "front_right", "back_left", "back_right") .motor("gobilda-5203-312").wheel("gobilda-gripforce-mecanum-104").wheelMm(108.9) // Drive Tuner, measured at power 0.5 .wheelsAtMm(400, 336) // track (left-right), wheelbase (front-back), wheel centres: est., measure ours // TODO check how our Control Hub is mounted: the way its logo and USB port face. .imu("imu", LogoFacingDirection.UP, UsbFacingDirection.BACKWARD));The rest of define() adds the parts, one add(...) line each: the deploy servo, the intake, the launcher
and the camera. Then fixed(...) (the tower and the ramp) and atStart(...).
Step 4 explains each part.
Learn it: Robot.java: what is on the robot. Read “The drive, attribute by attribute” and “How your Control Hub is mounted”.
Why robot 1 does it this way:
- Robot 1’s front is the launcher end (the ramp). The intake is at the back. Driving forward means launcher first.
- The drive: four 312 RPM motors and 104 mm GripForce mecanum wheels. Mecanum wheels let the robot strafe (drive sideways without a turn).
.wheelMm(108.9): the Drive Tuner measured the wheel on the real robot. Robot 1 keeps.wheel(...)too: the catalog id says which wheel it is, and the measured size wins.- No
.reversed(...): the library reverses the left side, and that fits the Strafer. The Motor Direction Check proves it on the robot: each wheel must roll toward the launcher. .imu(...): the Control Hub’s logo faces up, and its USB ports face backward (toward the intake). TheTODOstays until someone checks the mounting on the robot..wheelsAtMm(...)is for the simulator only. It is an estimate (est.) until the team measures robot 1.deployAtStart: the three autos set it tofalse. Step 4 says why.
Check: r1-start.sim starts R1 TeleOp and fails on any error at INIT (a wrong device name stops it
there). r1-drive.sim strafes the robot and checks that it moves sideways, not forward or back.
Try it (optional): delete .wheelMm(108.9). Pick Simulator in the run list and click Run. It
writes simulator/robot.properties from Robot.java. Stop it, open that file, and find
drive.wheelDiameterIn. It is about 4.09 now (the catalog’s 104 mm), not 4.287 (108.9 mm). With the
catalog size, every autonomous move on the real robot is about 5% too long, because the real wheel is
bigger. Then undo it (git restore TeamCode simulator).
Tunables.java
Section titled “Tunables.java”Robot 1’s code: the numbers, one section per part. The drive’s section:
public static class Drive { // a fixed name: always Drive public static double maxPower = DEFAULT; // top wheel power at events, 0 to 1 (1.0) public static double practiceMaxPower = 0.6; // top wheel power in PRACTICE (the library's default is maxPower since v0.41.0) public static double slowSpeed = DEFAULT; // top power with the slow trigger held (0.3) public static double strafeCorrection = 1.115; // strafing: more push sideways (Drive Tuner, power 0.5) // Strafing LEFT, if it slips more that way: Drive Tuner "Strafe left" test, then remove the // (not written = 1.115 both ways) // public static double strafeCorrectionLeft = 1.115; public static double turnKp = DEFAULT; // auto turns: push per degree off (0.012) public static double turnKd = DEFAULT; // auto turns: brake near the end (0.003) public static double moveMinPower = DEFAULT; // auto: least power that moves it (0.30) public static double slowDownIn = DEFAULT; // auto: slow down over at least the last N in of each move (0 = off; try 6) public static double turnMinPower = DEFAULT; // auto turns: least power while still off (0; Move Tuner) public static double turnToleranceDeg = DEFAULT; // auto turns: done this close, in degrees (1.0; Move Tuner) public static double moveTurnScale = DEFAULT; // moveWithTurn: how hard it turns while it moves (0.60; Move Tuner) public static double moveMaxTurnPower = DEFAULT; // moveWithTurn: most turn power (0.35; Move Tuner) public static boolean calibrated = true; // the Drive Tuner is done (auto needs it) }The other sections: Intake, IntakeDeploy, Launcher, Feeder, Webcam1 and Aim.
Step 4 shows each one with its part.
Learn it: Tunables.java: the numbers. Read “How the
file works” (what DEFAULT means) and “Tune a number, then copy it back”.
Why robot 1 does it this way:
strafeCorrection = 1.115andcalibrated = true: the Drive Tuner found them on the real robot. Do not change them.maxPower = DEFAULT(1.0): robot 1 is past its first drives, so it does not use the docs’ 0.5.practiceMaxPower = 0.6: in the PRACTICE profile, the library drives atmaxPower. Robot 1 keeps PRACTICE at 0.6, so new drivers practice slower.- The four Move Tuner lines (
turnMinPowertomoveMaxTurnPower) stayDEFAULTuntil the Move Tuner runs on the real robot. strafeCorrectionLeftwaits behind//. Robot 1 came up short when it strafed left in its Right Wall autonomous. The Drive Tuner’s usual strafe test goes right. Its own “Strafe left” test decides this number.- Our team rule: the code is the record. A number you change in the tuning menu goes back into
Tunables.javathe same day. Why: a new hub loses a number that is saved only on the Control Hub, and your teammates cannot see it.
Check: r1-slowdown.sim sets Drive.slowDownIn to 6 and runs the Right Corner autonomous. Every step
must finish, and the robot must park and touch nothing.
Try it (optional): set slowSpeed to 0.1. Run Simulator, pick R1 TeleOp, press INIT and ▶,
and set gamepad 1 to Keyboard. Drive with W, then hold Z (LT) and drive again: the robot crawls. Then
undo it.
Controls.java
Section titled “Controls.java”Robot 1’s code: the buttons, and the TeleOp. The top of the class:
@TeleOp(name = "R1 TeleOp")public class Controls extends ControlMap<Robot> { public static boolean oneDriver = true;Below it are two methods: libraryButtons(...) (the library’s own buttons) and buttons(...) (robot 1’s
buttons). Step 5 explains every line.
Learn it: Controls.java: the buttons, and the TeleOp. Read “Two kinds of buttons” and “Add your own button”.
Why robot 1 does it this way:
oneDriver = true: like goBILDA’s code, one driver does everything on gamepad 1.- The TeleOp’s name is “R1 TeleOp”. Robot 1’s tests start it by that name (
init "R1 TeleOp"), and each autonomous names it inpreselectTeleOp. Do not rename it. - In the simulator, gamepad 1 = Keyboard: W drives forward (launcher first), A and D strafe, the arrows turn, Z is LT.
Check: r1-drive.sim checks the two drive buttons: the left stick click (reverse drive) and RT with
the right stick click (field-centric). r1-buttons.sim checks them with the buttons of the parts.
Try it (optional): move reverse drive to A (robot 1 leaves A free). In buttons(...), change
g1.leftStickButton to g1.a in the reverse drive line, and delete the g1.a.free(); line. Run
r1-drive.sim: it fails at the REVERSED line. Why: a test checks a job on a button, so it catches a
moved button. Then undo it.
Actions.java
Section titled “Actions.java”Robot 1’s code: steps that use several parts together. Robot 1 has one action:
public class Actions {
/** * Pushes the folded intake over, then starts the intake and moves the servo back out of the way. * The intake stays down by gravity (nothing holds it). */ public static Action deployIntake(Robot r) { return Action.named("Deploy intake") .then(() -> r.intakeDeploy.goTo("deployed")) // A servo cannot say where it is: isDone() guesses from Tunables.IntakeDeploy.travelSec. .waitUntil("the deploy servo", r.intakeDeploy::isDone, 2.0) // The intake is down now: start it (it keeps running when this action ends). .then(r.intake::in, () -> r.intakeDeploy.goTo("stowed")); }}Learn it: Actions.java: several parts together. Read “The steps”, “Start it from a button” and “An action when the OpMode starts”.
Why robot 1 does it this way:
deployIntakeuses two parts: the deploy servo pushes the intake over, then the intake starts.- Three places start it:
atStart(...)inRobot.java(right after START), the X button inControls.java(push the intake over again), and each autonomous (while it drives off the wall). - No fire action here. Robot 1’s autos fire with the launcher’s ready-made actions
(
fireAction(2),fireAllAction()), so they need no line inActions.java.
Check: r1-v1.sim checks that the intake drops at START and stays down. It also checks that the servo
goes back to stowed, and that the intake runs.
Try it (optional): in deployIntake, change the last line to
.then(() -> r.intakeDeploy.goTo("stowed")); (delete r.intake::in, ). Run r1-intake-lb.sim: it fails
at its first check, because the intake never starts. Then undo it.
autos/
Section titled “autos/”Robot 1’s code: three autonomous programs, one file each. The top of the Right Wall autonomous:
@Autonomous(name = "R1 Right Wall: Launch, Park Right", preselectTeleOp = "R1 TeleOp")public class RightWallLaunchAndPark extends Auto<Robot> { @Override protected void steps(Steps s, Robot robot) { robot.deployAtStart = false; // the back is on the wall: the intake is pushed over while it drives away s.start("Back on R wall, 3rd tile, centred, facing HIVE", 62, -11.8, 90) .action(robot.launcher.fireAction(2), 6)| File | On the Driver Station |
|---|---|
autos/RightCornerLaunchAndPark.java |
R1 Right Corner: Launch, Park Right |
autos/RightWallLaunchAndPark.java |
R1 Right Wall: Launch, Park Right |
autos/LeftWallWaitLaunchAndPark.java |
R1 Left Wall: Wait, Launch, Park Left |
Step 6 explains each route.
Learn it: autos/: your autonomous programs. Read “The smallest auto”, “The numbers are in the step” and “Tune the drive first”.
Why robot 1 does it this way:
s.start(...): the text is the place note that INIT shows, so a second person can check the robot’s spot at the field. The three numbers are x and y on the field (inches) and the heading (degrees).- The numbers are in the steps, the way the auto builder writes them. The builder can then open the file.
- “Tune the drive first” is done: the wheel size,
strafeCorrectionandcalibrated = truecame from the Drive Tuner. - Each file ends with
mirrorForRed()returningfalse. Between the alliances, BIOBUZZ’s field turns half a turn. It does not mirror. So the same route, driven from each alliance’s own wall, works for both.
Check: r1-place-notes.sim checks that each autonomous shows its place note at INIT.
r1-auto-right.sim runs the Right Wall autonomous as RED and checks its start spot, its shots and its park.
Try it (optional): in the Right Wall file, change the start’s 62 to 60. Run r1-auto-right.sim: it
fails at expect robot x = 62 0.3. That is how a test tells you that a start spot changed. Then undo it.
Done when: you know what each of robot 1’s five files holds, and where to change a number, a button or an autonomous.
Next: Step 4: The parts.