From Sim to Real and Back: A Physics Simulator for FIRST Tech Challenge

The bundled BIOBUZZ TeleOp drives an FTC team's robot, imported from its CAD with the examples' device names: it spins up its launcher and shoots its 4 POLLEN into the red HIVE's open CELL, which already holds 3 NECTAR. The HIVE tips under the added weight and empties the CELL onto the field. Recorded in real time.

Abstract

For low-cost robots such as those of FIRST Tech Challenge (FTC), we argue that much of the gap between simulation and the real robot lies in the control stack between robot code and motors, not in the rigid-body dynamics. Motor velocity and position loops run in the REV hub's firmware, and every hardware call takes time, so code tuned in a simulator that leaves these out can meet a different loop rate and motor response on the robot. None of the FTC simulators we found documents a model of either. We present an open-source simulator that runs teams' own robot code, compiled unmodified, against models of the hub's firmware control loops, the time each hardware call takes and battery sag, over ODE4j rigid-body physics at a 1 ms step. At the default call costs, for example, one mecanum TeleOp loop (four encoder reads, an IMU read, four motor writes) is charged 10.5 ms, or 7.5 ms with bulk reads. Robots are described in JSON or imported from CAD, webcam frames are rendered for FIRST's own AprilTag processor, and each season's game is a replaceable pack. The call costs are still estimates, to be measured in a planned comparison with a physical robot.

1 ms

physics step in ODE4j, paced to the wall clock

1,131

public and protected members of the simulator's 111 SDK 12.0 classes, checked against the SDK's jars

41

of FIRST's sample files, bundled with the simulator, compile unmodified

≈ 2 mm

largest per-axis AprilTag position error at about 0.7 m, on rendered, noise-free frames (test limit 5 mm)

245

tests, run on Windows, Linux and macOS

The SDK, sample and AprilTag numbers come from the simulator's own tests; the 1 ms step is fixed in the code. Of the 1,131 members, 1,116 are declared in the SDK's jars; the other 15 are Object overrides, members only the simulator's own types reach, and two HardwareMap constructors that robot code never calls. None of these numbers has been compared with a physical robot yet; that comparison is planned.

How it works

One physics world, three inputs

The simulator is one Java process plus a browser page. The team's own project, a robot file for each robot and the season pack of the game being played describe what is simulated. They meet in one rigid-body world stepped every millisecond, which the robots, sensors, webcams and Driver Station all read from or write to. The page's code editor saves the team's files, and deploy builds the same project for the real robot, a path so far tested only with stand-ins for Gradle and ADB.

System architecture, from the code editor and the team's project to the browser and the real robot
System architecture, from the team's project to the browser, and back to the real robot.

A field and game calibrated against FIRST's documents

The BIOBUZZ field holds its structures, four FLOWERS that robots take POLLEN out of, 56 game pieces and two bistable HIVES. A HIVE stays on either stop until enough weight lands in its upward CELL, and the model gets this from its mass distribution alone. One parameter, the height of the center of mass above the pivot (34.5 mm), is fitted so that the HIVE meets every “Necessary” row of the tipping table in FIRST's Event Field Setup Guide.

HIVE side view: the moments that hold it on its stop and tip it
HIVE side view, rear CELL up: its weight holds it on its stop, and balls at the closed end pull it the other way.

Motors, hub firmware and the time each hardware call takes

Motors follow their datasheet torque–speed curves, the REV hub's run modes and velocity PIDF are modeled on its firmware, and every hardware call costs bus time: by default 1 ms per hub command and 2.5 ms per I2C read. At these costs a mecanum TeleOp loop is charged 10.5 ms (about 95 loops per second in a LinearOpMode) without bulk reads and 7.5 ms (about 133) with them, so the loop period depends on the hardware calls the code makes, as on the robot. The costs are estimates until they are measured on a robot.

One control loop drawn to scale, with and without bulk reads
One control loop at the simulator's default costs, drawn to scale, with and without bulk reads.

Robots from CAD

A robot file can point at the team's STEP or URDF model. A STEP file is converted once: in the browser by OpenCascade compiled to WebAssembly, or, for an assembly too big for that, by a script that runs the full OpenCascade library on the computer. The mass distribution, oriented collision boxes and drive wheels come from the meshes. Each arm, slide or hood needs one entry in the robot file, naming its parts, its device and its limits, and the robot's own motors and servos then drive those joints.

From a STEP or URDF file to a simulated robot
From a STEP or URDF file to a simulated robot.

FIRST's own vision code on rendered frames

Each webcam's view is rendered in software and passed to FIRST's unmodified AprilTagProcessor and AprilTag Java library, with the lens taken from the SDK's calibration table. Underneath, the C detector is OpenFTC's source compiled for PCs, with a fix for a thread-pool race. On these noise-free frames, tags about 0.7 m away are solved to within 2 mm of ground truth on each axis. Lens distortion, motion blur and sensor noise are not modeled yet, so a robot's camera will do worse.

Path of one webcam frame through the vision pipeline
Path of one webcam frame through the vision pipeline.

Matches with up to four robots

Each robot's TeamCode is loaded by its own class loader, so static fields and two projects with classes of the same name stay apart. Robots meet only in the physics world, where they collide, push each other and show up in each other's distance sensors and webcams. INIT all and START all keep their autonomous timers in step.

What four robots in one match share, and what they keep apart
What four robots in one match share, and what they keep apart.

One engine, a season pack per game

Everything that belongs to one game is a season pack: a season.json with the field's shapes, game pieces, start spots and human-player buttons, plus a little Java for what data cannot express. The physics, the webcam renderer and the 3D view all build from the same shapes, so a new season needs no rendering code.

BIOBUZZ (2026–27)DECODE (2025–26)
StructuresHIVE structure; 4 FLOWERS that POLLEN can be taken out of; 2 HIVES on pivots2 GOALS with RAMPS; 2 GATES; the OBELISK
Game pieces40 POLLEN, 8 red and 8 blue NECTAR36 ARTIFACTS: 24 purple, 12 green
Each robotHolds 4; pre-load 4 POLLENHolds 3; pre-load 2 purple, 1 green
AprilTags30–45, on the HIVES20 and 24 on the GOALS; 21–23 on the OBELISK
Java in the pack6 files, 830 lines2 files, 194 lines

Quick start

Install JDK 17 or newer, get the simulator, and start it from its folder with your FtcRobotController project:

Get the simulator

git clone https://github.com/Springphy-AI/ftc-sim.git
cd ftc-sim

Windows

.\run-sim.bat --project "C:\path\to\FtcRobotController"

macOS and Linux

sh run-sim.sh --project ~/FtcRobotController

The Driver Station opens at http://localhost:8080: pick an OpMode, press INIT, then START. Without --project it runs the bundled examples and FIRST's samples. --robots 4 puts four robots on the field, and --season decode switches to the DECODE field. The README lists every option.

BibTeX

@techreport{li2026ftcsim,
  title       = {From Sim to Real and Back: A Physics Simulator for {FIRST} Tech Challenge},
  author      = {Li, Lening and Li, Na},
  institution = {Springphy AI},
  type        = {Technical report},
  year        = {2026},
  url         = {https://github.com/Springphy-AI/ftc-sim}
}