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 7: The simulator and tests

At the end of this step, you can drive robot 1 in the simulator, read its robot file, watch its autos, and run its 19 tests. You also know the checks the team does on the real robot before practice and before each match.

Missions: try each change in the team’s code, check it in the simulator, then put it back (Try it, then undo it). Never commit a mission.

Checks: robot 1’s tests are in simulator/scenarios/. Run one:

Where: the Terminal, in the ftc-helper-lib folder inside octobots-2026-r1.

Terminal window
./gradlew :sim:scenario -Pfile=../simulator/scenarios/r1-v1.sim

Put the test’s file name in place of r1-v1.sim. To run all of them, use the Simulator tests button.

Robot 1’s code:

Robot.java
.spinAtStart() // at speed from START and between shots, ready to fire (B switches it off)
Robot.java
atStart(() -> deployAtStart ? Actions.deployIntake(this)
: Action.named("Intake stays folded (the autonomous deploys it)"));

Learn it: Start it and drive. Read how to start the simulator, run an OpMode, drive with the keyboard, and move the robot.

Why robot 1 does it this way:

  • Where it runs: in robot 1’s project, ftc-helper-lib is a folder next to TeamCode. It is a git submodule (a repository inside the project). The Simulator button and the Terminal commands work from there.
  • The front is the launcher. W (stick up) drives launcher first. S backs up, intake first.
  • At START in R1 TeleOp, the deploy servo pushes the intake over, the intake runs, and the flywheel spins up (spinAtStart). Q (LB) stops the intake, E (RB) fires, L (B) switches the flywheel off.
  • Move the robot onto open floor first. The TeleOp starts with the robot’s back near a wall. The intake is at the back, and it must drop clear of the wall. Robot 1’s TeleOp tests do this with set pose 56 40 -180.

Check: r1-v1.sim checks the size rules, the intake drop, a strafe, a pick-up, LB, B and RB. r1-start.sim checks that R1 TeleOp starts and runs with no error.

Try it (optional): in R1 TeleOp, drag the robot onto open floor, then press ▶. Put a POLLEN behind the robot (or drive to one). Back up onto it with S: the intake is at the back. Then press E to fire it out of the front. This mission changes no code.

Robot 1’s code: robot 1’s own lines in simulator/robot.properties (the simulator keeps them at each start):

simulator/robot.properties
battery = 12.8
field = biobuzz-2026
# The field's 3D model for the 3D view (made from FIRST's field CAD; kept in this private repo).
field.model = fields/biobuzz-2026.glb
simulator/robot.properties
start.x = -56
start.y = -61.1
start.heading = 0

The shapes come from Robot.java. One example:

Robot.java
.shotAngle(75)); // 75° up from the floor, out of the front (the planned ramp; the built one is 53°)

Learn it: Your robot file (which lines the simulator writes, and which it keeps) and Make it match your robot (how to measure the shapes).

Why robot 1 does it this way:

  • Lines with # from Robot.java: the simulator writes them again at each start. A shape that has note("est.") in Robot.java ends with . est. here.

  • Robot 1’s own lines have no # from Robot.java note. They are battery, field, field.model (the field’s 3D model, kept in robot 1’s repository), the TeleOp start, and camera.Webcam1. The TeleOp start is start.x, start.y and start.heading, and its comment says “Change it to our real start.” The webcam line has the webcam’s place and tilt (pitch=35, with TODO measure the mount).

  • No MEASURE stand-ins: the deploy servo’s positions are measured (Tunables.IntakeDeploy). The feed wheels have no positions: they spin.

  • Missing parts: the deploy servo and the two feed wheel servos are optional() in Robot.java. Robot 1’s tests take a part out with set device intake_deploy missing.

  • Size and wheels (all est.): chassisMm(432, 440, 80), heightMm(305), wheelsAtMm(400, 336).

  • The parts and their shapes:

    Part Its shapes in Robot.java
    The deploy servo deploy_kicker: an arm, stowed at 90 degrees, deployed at 150
    The intake intake_arm (folds up at 85 degrees, falls back onto its stop at 220; dropsWhen the deploy servo is deployed), roller (90 and 60 mm tubing), left_spinner and right_spinner (72 mm Boot-Wheels) on the arm
    The launcher launcher_slide (the flywheel’s sliding mount) and the 96 mm flywheel on it
    The feeder left_feed_wheels and right_feed_wheels (48 mm Gecko wheels, one stack on each servo)
    Fixed parts tower and ramp
  • Measure from the edges. The front edge is the launcher end. With robot 1’s chassis (432 mm long, 440 mm wide): forward = 216 - (the part from the front edge), left = 220 - (the part from the left edge). Example: the code’s launcher_slide is at atMm(40, 40, 120). So it sits 176 mm behind the front edge and 180 mm in from the left edge (est.). Measure those two on the robot.

  • On the intake arm, “forward” is along the arm, and “up” is at right angles to it. The arm points back, so its “up” is the robot’s down. Measure with the arm level toward the back.

  • Keep the intake arm’s size: sizeMm(95, 240, 15) is smaller than the real arm on purpose. A longer box pushes pieces away before the roller takes them. A wider box holds the spinners out of the FLOWER.

  • The shot angle is the planned angle. The ramp built so far is 53 degrees up. Film a real shot from the side, next to a tape measure. Put its angle in .shotAngle(...).

  • Edit robot: copy only the numbers into robot 1’s lines, so the comments and notes stay. Delete .note("est.") from a line when you measured it.

Check:

  • r1-v1.sim checks the size rules: expect size start ok (folded, inside the 18 in cube), expect size most ok and, with the intake down, expect size match ok.
  • r1-no-deploy-servo.sim and r1-no-feeder.sim each take a part out of the configuration. INIT goes on with a note, and the rest of the robot works.

Try it (optional): see why the ramp matters. Change .shotAngle(75) to .shotAngle(53) (the built ramp). Restart the simulator, run R1 Right Wall: Launch, Park Right as RED, and open the Match panel: read each shot’s verdict. Undo the change.

Robot 1’s code:

autos/RightCornerLaunchAndPark.java
.action(robot.launcher.fireAction(2, 3750), 6) // 3750: an estimate (the side walls fire at 3450); tune on the robot

Learn it: Watch an autonomous. Read how to run an auto, read its report, and use the layers and the Match panel.

Why robot 1 does it this way: run R1 Right Corner: Launch, Park Right, B for RED.

  • The report at the end has these lines, among others: Fire 2 at 3750 RPM: done (2 fired), Bump back: done, Fire all at 3750 RPM: done (4 fired) and To the LOADING ZONE: done.
  • The score: RED already has 10 points on the field at the start. The auto adds LEAVE 3 and PARK 5, plus the shots that go in.
  • The shots: at 3750 RPM the simulator’s shots miss. The simulator’s launcher is an estimate. So r1-auto.sim checks only that all four are fired. 3750 is an estimate for the real robot too: tune it from that spot on the field.

Check: r1-auto.sim ends with print pieces: each shot’s verdict and the score.

Try it (optional): turn on the Shot arc layer. In RightCornerLaunchAndPark.java, change both 3750s to 2525. The team’s notes found a good speed for the simulator from this spot. At 2500 to 2550 RPM, with the planned 75 degree ramp, it scores all four. Run it and read the Shots list. Undo the change: the simulator is a model, and the real robot decides the speed.

Robot 1’s code: the 20 files in simulator/scenarios/.

Test It checks
r1-auto.sim R1 Right Corner: Launch, Park Right (RED): the start spot, two fired at 3750 RPM, the bump, the other two, the intake pushed over on the way, the park at the right corner of the LOADING ZONE, touching nothing, no step skipped
r1-auto-blue.sim the same auto as BLUE: the start spot, the four shots and the park, from the blue wall
r1-auto-right.sim R1 Right Wall: Launch, Park Right (RED): the same, from the right wall, at speedRpm
r1-auto-left.sim R1 Left Wall: Wait, Launch, Park Left (RED): four POLLEN tip the HIVE first; nothing fired before 15 s; four fired at speedRpm; the park at the left corner; at least 16 points
r1-place-notes.sim each auto shows its Place robot note at INIT, in the COMPETITION profile
r1-slowdown.sim auto 1 with slowDownIn = 6: it still finishes every step, parks and touches nothing
r1-start.sim R1 TeleOp starts and runs with no error
r1-v1.sim R1 TeleOp: the size rules; the intake waits folded until START, drops and stays down; a strafe with no turn; a pick-up (backing up: the intake is at the back); LB stops the intake; RB fires; B switches the flywheel off, RB still fires, and B spins it up again
r1-drive.sim a strafe in a straight line, reverse drive (left stick click), field-centric (hold RT, then click the right stick)
r1-buttons.sim the meet 1 buttons: the D-pad speed buttons on the button map; reverse drive; field-centric only with RT held; SPRAY (tap RB, then hold it)
r1-button-map.sim the button map at INIT shows the words from each .says(...) in Controls.java
r1-intake-lb.sim LB: a tap switches the intake off and on, a double tap pushes out until the next tap
r1-camera-aim.sim the webcam sees our HIVE’s tags, and the right stick click turns the robot to the HIVE
r1-camera-lighting.sim the webcam’s lighting test runs at INIT, and its line is on the Driver Station
r1-feed-wheels.sim both feed wheels: one RB fires one POLLEN, a second RB fires a second
r1-no-feeder.sim no feeder_left and no feeder_right: INIT goes on, the flywheel spins, the intake runs, RB feeds nothing
r1-no-deploy-servo.sim no intake_deploy: INIT goes on, the intake is down from the start, it picks up and fires
r1-tune-menu.sim the Tune and check menu lists the tools for robot 1’s parts, and no others
r1-motor-direction.sim Tune and check > Motor Direction Check: hold X, and only the front left wheel runs

Learn it: Record a test (how a test file is made) and Run all your tests (how and when to run them).

Why robot 1 does it this way:

  • Most of robot 1’s tests start with robot ../robot.properties: the robot file, from the test’s folder.

  • The TeleOp tests move the robot first, with set pose 56 40 -180. The intake is at the back, and it must drop clear of the wall. Do the same when you record: drag the robot onto open floor before ▶.

  • The auto tests have set scatter realistic: shots scatter like real ones. So they check that pieces are fired (launched >= 4), and they keep their points checks loose.

  • After a planned change, update the tests. Example: you move the intake from LB to A. LB is pressed in r1-v1.sim, r1-no-deploy-servo.sim and r1-intake-lb.sim: change those lines. But keep g1.b in the auto tests. There, B chooses RED in the auto’s INIT menu. That button comes from the library, and Controls.java does not set it. So search the folder for the old button, and decide for each line.

  • Run all 20: pick Simulator tests in Android Studio’s run list, or use the Terminal:

    Where: the Terminal, in the ftc-helper-lib folder inside octobots-2026-r1.

    Terminal window
    ./gradlew :sim:scenario

    The last line says how many passed, with the name of each file. All 20 must pass.

  • When: before each robot session, after every change, after a library update, and before you push to main. Commit the tests with the code: git add simulator.

  • Robot 1 has no JUnit tests (Java tests that run on the laptop). Its tests/FlywheelSpeedTest.java is a one-off OpMode for the real robot.

Check: run all 19 tests. Every one passes.

Try it (optional):

  • Plant a mistake in a test. In r1-auto.sim, change expect stored = 4 to expect stored = 5. Run it, and read the FAIL line: what did the simulator see? Undo the change.
  • Break the code on purpose. In Robot.java, change .holds(4) to .holds(3) on the intake’s line. Run all the tests: which ones fail, and on which line? Undo the change, and run them again.
  • Record a test of R1 Right Wall: Launch, Park Right: INIT, B for RED, ▶, and let it run to its end. Keep the goal checks, save it as my-right-wall, and press Run it now: PASSED. Then delete simulator/scenarios/my-right-wall.sim: git restore does not remove a new file.

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: Checks before practice and matches. Read the fixed order: laptop tests, Hardware Check, mechanism checks, floor check, autonomous check, and the list before every match.

Why robot 1 does it this way:

  • Safety, every session. Everyone near the robot wears safety glasses. The flywheel spins up at START in R1 TeleOp (spinAtStart). The front (the launcher and its ramp) is the line of fire: nobody stands in front of the robot. The deploy servo and the intake move at START: keep your hands away from the intake hinge. The two feed wheels spin on each shot: keep your hands away from them. Never feed a piece with your fingers.
  • The first sessions: the checklist has robot 1’s order: on the block, then the first drive, then the Drive Tuner and the autos.
  • Mechanism checks for robot 1:
    • Intake: after START it runs. Tap LB: off, tap: on. Double-tap LB: out (both feed wheels turn backward too). X: the deploy runs again.
    • Servo parts: the deploy servo never hums, at any position. Both feed wheels pull a POLLEN in on RB.
    • Flywheel and launcher: it holds 3450 RPM. RB fires one POLLEN, hold RB keeps firing.
  • Floor check: robot 1’s gamepads buzz at 1:00, 1:40 and 1:59 of TeleOp (60, 20 and 1 s left), not only at 20 s.
  • Before every match, on robot 1:
    • The intake folded, inside the 18 in cube. With no deploy servo, the intake starts down. The simulator says the robot is then 19.3 in long: too long (The intake and its deploy servo).
    • Four POLLEN preloaded.
    • The robot placed as the Place robot note says (Step 6: The autos).
    • No !! COMPETITION: ... is OFF (optional part) warning for intake_deploy, feeder_left or feeder_right: they are optional(), so a wrong name does not stop INIT.

Check: on the laptop, all 19 tests pass. On the robot: the Hardware Check passes for every device, each mechanism passes, and the drive team has the printed lists.

Try it (optional): none. These checks run on the real robot.

Done when: you can drive robot 1 in the simulator, read its robot file, watch its autos, and run its 20 tests. You know the checks the team does on the real robot before practice and before each match.


Next: Step 8: Tune the real robot.