FTC-Helper-Lib Simplify Java Coding for FTC
A free Java library: each robot job in one or two lines. Made for students new to Java.
Version 0.47.0 · FTC SDK 12.0 (2026-27 BIOBUZZ) · Android Studio
Read the docs The simulator guide
R304: software from past seasons, and software made before Kickoff, is allowed.


The same code, two ways
Left: the plain FTC SDK. Right: FTC-Helper-Lib.
Field-centric mecanum driving with a slow trigger.
DcMotor fl = hardwareMap.get(DcMotor.class, "front_left");
DcMotor fr = hardwareMap.get(DcMotor.class, "front_right");
DcMotor bl = hardwareMap.get(DcMotor.class, "back_left");
DcMotor br = hardwareMap.get(DcMotor.class, "back_right");
fl.setDirection(DcMotor.Direction.REVERSE);
bl.setDirection(DcMotor.Direction.REVERSE);
for (DcMotor m : new DcMotor[] {fl, fr, bl, br})
m.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
IMU imu = hardwareMap.get(IMU.class, "imu");
imu.initialize(new IMU.Parameters(new RevHubOrientationOnRobot(
RevHubOrientationOnRobot.LogoFacingDirection.UP,
RevHubOrientationOnRobot.UsbFacingDirection.FORWARD)));
imu.resetYaw();
waitForStart();
while (opModeIsActive()) {
if (gamepad1.back) imu.resetYaw();
double y = -gamepad1.left_stick_y, x = gamepad1.left_stick_x;
double turn = gamepad1.right_stick_x;
double h = imu.getRobotYawPitchRollAngles().getYaw(AngleUnit.RADIANS);
double fx = x * Math.cos(-h) - y * Math.sin(-h);
double fy = x * Math.sin(-h) + y * Math.cos(-h);
double speed = gamepad1.left_trigger > 0.5 ? 0.3 : 1.0;
double d = Math.max(Math.abs(fy) + Math.abs(fx) + Math.abs(turn), 1);
fl.setPower((fy + fx + turn) / d * speed);
bl.setPower((fy - fx + turn) / d * speed);
fr.setPower((fy - fx - turn) / d * speed);
br.setPower((fy + fx - turn) / d * speed);
}The rotation math, motor directions and power scaling, all by hand.
// Robot.java
drive(Drive.mecanum("front_left", "front_right", "back_left", "back_right")
.imu("imu", LogoFacingDirection.UP, UsbFacingDirection.FORWARD));
// Controls.java: the whole TeleOp
@TeleOp(name = "TeleOp")
public class Controls extends ControlMap<Robot> {
@Override protected boolean startFieldCentric() { return true; }
@Override protected void buttons(Robot robot, Pad g1, Pad g2) { }
}Free, with no extra code:
- Motor directions and brake, set for you
- Wheel powers scaled for you
- Pause with a tap of BACK
- A clear INIT message for a wrong name
Drive, turn, then park, for either alliance.
// wheels[] and imu set up as in TeleOp (14 more lines)
static final double TICKS_PER_INCH = 537.7 / (96 / 25.4 * Math.PI);
static final boolean RED = false; // change by hand before each match
public void runOpMode() {
waitForStart();
driveInches(24, 0.6);
turnTo(RED ? -45 : 45, 0.5);
driveInches(20, 0.8); // a strafe would need its own method
}
void driveInches(double inches, double power) {
for (DcMotor m : wheels) {
m.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
m.setTargetPosition((int) (inches * TICKS_PER_INCH));
m.setMode(DcMotor.RunMode.RUN_TO_POSITION);
m.setPower(power);
}
while (opModeIsActive() && wheels[0].isBusy() && wheels[1].isBusy()
&& wheels[2].isBusy() && wheels[3].isBusy()) idle();
for (DcMotor m : wheels) m.setPower(0);
}
void turnTo(double target, double power) {
for (DcMotor m : wheels) m.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
while (opModeIsActive()) {
double yaw = imu.getRobotYawPitchRollAngles().getYaw(AngleUnit.DEGREES);
double err = AngleUnit.normalizeDegrees(target - yaw);
if (Math.abs(err) < 1) break;
double p = Math.max(-power, Math.min(power, err * 0.02));
wheels[0].setPower(-p); wheels[2].setPower(-p); // left side
wheels[1].setPower(p); wheels[3].setPower(p); // right side
}
for (DcMotor m : wheels) m.setPower(0);
}Encoder math, wait loops and a turn controller by hand. You edit red or blue before each match.
@Autonomous(name = "Score and Park")
public class ScoreAndPark extends Auto<Robot> {
@Override protected void steps(Steps s, Robot robot) {
s.start("Back wall, facing the field", 0)
.move("To the goal", 24, 0, 0.6)
.turn("Face it", 45, 0.5) // mirrored for RED (off for BIOBUZZ)
.parkWithSeconds(4)
.move("Park", 20, 90, 0.8); // 90 = to the right (mecanum)
}
}Free, with no extra code:
- INIT menu: alliance and start delay
- Red/blue mirroring
- The 30-second timer, with time to park
- A report of every step
A flywheel that fires three, each at speed.
DcMotorEx flywheel = hardwareMap.get(DcMotorEx.class, "flywheel");
DcMotor feeder = hardwareMap.get(DcMotor.class, "feeder");
flywheel.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
flywheel.setPIDFCoefficients(DcMotor.RunMode.RUN_USING_ENCODER,
new PIDFCoefficients(10, 3, 0, 12));
final double RPM = 3000, TICKS_PER_REV = 28;
ElapsedTime steady = new ElapsedTime(), feedTimer = new ElapsedTime();
int shotsLeft = 0;
boolean feeding = false, lastRb = false;
waitForStart();
while (opModeIsActive()) {
if (gamepad2.right_bumper && !lastRb && shotsLeft == 0) shotsLeft = 3;
lastRb = gamepad2.right_bumper;
flywheel.setVelocity(shotsLeft > 0 ? RPM * TICKS_PER_REV / 60 : 0);
double rpm = flywheel.getVelocity() * 60 / TICKS_PER_REV;
if (Math.abs(rpm - RPM) > 75) steady.reset();
if (!feeding && shotsLeft > 0 && steady.seconds() > 0.15) {
feeding = true;
feedTimer.reset();
feeder.setPower(1.0);
}
if (feeding && feedTimer.seconds() > 0.25) {
feeding = false;
feeder.setPower(0);
shotsLeft--;
steady.reset();
}
}Unit conversion, the at-speed timer and the feed timing written by hand as a small state machine.
// Robot.java
launcher = add(Launcher.flywheel("flywheel", "gobilda-5203-6000")
.feeder(Indexer.motor("feeder")));
// Tunables.java
public static class Flywheel {
public static double speedRpm = 3000, readyBandRpm = 75;
public static double kP = 10, kI = 3, kD = 0, kF = 12;
}
public static class Feeder { public static double feedSec = 0.25; }
// Controls.java
g2.rb.press(() -> robot.launcher.fire(3));Free, with no extra code:
- RPM in, RPM out
- Feeds only at speed
- Gives up after 3 s, and says why
- Speed up or down on the D-pad
A lift with three heights, and an intake toggle.
DcMotorEx lift = hardwareMap.get(DcMotorEx.class, "lift");
TouchSensor bottom = hardwareMap.get(TouchSensor.class, "lift_bottom");
DcMotor intake = hardwareMap.get(DcMotor.class, "intake");
lift.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE);
lift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
lift.setTargetPosition(0);
lift.setMode(DcMotor.RunMode.RUN_TO_POSITION);
int target = 0;
boolean intakeOn = false, lastA = false;
waitForStart();
while (opModeIsActive()) {
if (gamepad2.x) target = 0;
if (gamepad2.b) target = 900;
if (gamepad2.y) target = 2400;
target = Math.max(0, Math.min(2600, target));
if (bottom.isPressed() && target == 0) {
lift.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
lift.setTargetPosition(0);
lift.setMode(DcMotor.RunMode.RUN_TO_POSITION);
}
lift.setTargetPosition(target);
lift.setPower(1.0);
if (gamepad2.a && !lastA) intakeOn = !intakeOn;
lastA = gamepad2.a;
intake.setPower(intakeOn ? 1.0 : 0.0);
}Limits, switch reset and button toggle written by hand. Full power to every height, no slow stop at the ends.
// Robot.java
lift = add(Lift.slide("lift").bottomSwitch("lift_bottom"));
intake = add(Intake.motor("intake"));
// Tunables.java
public static class Lift {
public static double min = 0, max = 2600, down = 0, low = 900, high = 2400;
}
// Controls.java
g2.x.press(() -> robot.lift.goTo("down"));
g2.b.press(() -> robot.lift.goTo("low"));
g2.y.press(() -> robot.lift.goTo("high"));
g2.a.toggle(robot.intake);Free, with no extra code:
- Each press acts once
- Limits always win
- Holds the height with PID
- Hand control on the stick
Tap, hold and double-tap on one button, and buzzes.
// launcher: your shooter code (Shooter tab)
// intake, lift: motors, set up as before
ElapsedTime rbDown = new ElapsedTime();
ElapsedTime lastTap = new ElapsedTime();
boolean lastRb = false, lastA = false, lastY = false;
boolean lastReady = false, intakeOn = false;
boolean holding = false, tapPending = false;
waitForStart();
while (opModeIsActive()) {
// RB: tap = one, hold = keep firing, double = three
boolean rb = gamepad2.right_bumper;
if (rb && !lastRb) rbDown.reset();
if (rb && !holding && rbDown.seconds() > 0.3) {
holding = true;
tapPending = false;
launcher.startFiring();
}
if (!rb && lastRb) {
if (holding) {
holding = false;
launcher.stopFiring();
} else if (tapPending && lastTap.seconds() < 0.35) {
tapPending = false;
launcher.fire(3);
} else {
tapPending = true;
lastTap.reset();
}
}
if (tapPending && !rb && lastTap.seconds() >= 0.35) {
tapPending = false;
launcher.fire(1);
}
lastRb = rb;
// A: intake on/off, 2 buzzes = on, 1 = off
if (gamepad2.a && !lastA) {
intakeOn = !intakeOn;
intake.setPower(intakeOn ? 1.0 : 0.0);
gamepad2.rumbleBlips(intakeOn ? 2 : 1);
}
lastA = gamepad2.a;
// climb: hold LB, press Y
if (gamepad2.y && !lastY && gamepad2.left_bumper) {
lift.setTargetPosition(2400);
}
lastY = gamepad2.y;
// buzz once when the shooter becomes ready
boolean ready = launcher.isReady();
if (ready && !lastReady) gamepad2.rumble(200);
lastReady = ready;
}Edge flags, two timers and a toggle written by hand, and the shooter code is still extra.
// Controls.java
// RB: tap = one, hold = keep firing, double = three
g2.rb.tap(robot.launcher::fire).says("fire one")
.hold(robot.launcher::fireWhileHeld, robot.launcher::ceaseFire)
.says("keep firing")
.doubleTap(() -> robot.launcher.fire(3)).says("fire three")
.rumble();
// A: intake on/off, 2 buzzes = on, 1 = off
g2.a.toggle(robot.intake).rumble();
// climb: hold LB, press Y
g2.lb.with(g2.y, () -> robot.lift.goTo("high")).says("climb");
// buzz once when the shooter becomes ready
g2.rumbleWhen(robot.launcher::isReady);Free, with no extra code:
- Tap, hold or double-tap, told apart
- Every gesture on the button map (GUIDE)
- A hold always stops, even when paused
- A button held at START does nothing
A Pedro path to the goal, then park.
// Constants.java: the drive and the Pinpoint set up again, for Pedro
static MecanumConfig drive = new MecanumConfig(c -> {
c.frontLeftName.set("front_left"); c.backLeftName.set("back_left");
c.frontRightName.set("front_right"); c.backRightName.set("back_right");
c.frontLeftDirection.set(DcMotorSimple.Direction.REVERSE);
c.backLeftDirection.set(DcMotorSimple.Direction.REVERSE);
});
static PinpointConfig pinpoint = new PinpointConfig(c -> {
c.name.set("pinpoint"); c.xPodOffset.set(2.187); c.yPodOffset.set(-4.572);
});
// The autonomous
static final boolean RED = false; // change by hand before each match
public void runOpMode() {
Follower f = new Follower(new PinpointLocalizer(hardwareMap, Constants.pinpoint),
new Mecanum(hardwareMap, Constants.drive), new Foresight(Constants.foresight));
double m = RED ? -1 : 1; // mirror every x and heading by hand
f.setPose(new Pose(72 + m * -56, 11, Math.toRadians(90)));
Path toGoal = path(
line(new Pose(72 + m * -56, 11), new Pose(72 + m * -48, 22)).constant(Math.toRadians(90)),
curve(new Pose(72 + m * -48, 22), new Pose(72 + m * -44, 36), new Pose(72 + m * -30, 42))
.linear(Math.toRadians(90), Math.toRadians(90 + m * 45)));
f.holdEnd.set(true);
waitForStart();
f.follow(toGoal);
ElapsedTime t = new ElapsedTime();
while (opModeIsActive() && f.following() && t.seconds() < 10) {
f.update();
intake.update(); // and every other mechanism, by hand
}
while (opModeIsActive() && t.seconds() < 10.5) f.update(); // hold to score
// ...then the park path, the same way
}Pedro is good at paths. But you set up the drive and odometry twice, and you write the mirroring and the update loop by hand. Nothing reports what went wrong.
// Robot.java: two lines, after drive(...)
odometry(Odometry.pinpoint("pinpoint").offsetsMm(-84, -168));
follower(Pedro.follower(PedroConstants.foresight));
// The autonomous: field inches, seen from your wall
s.start("Our wall, left corner tile", -56, -61, 0)
.follow("To the goal", PedroPath.line(-56, -61, -48, -50).keepHeading(0)
.then(PedroPath.curve(-48, -50, -44, -36, -30, -30)).turnTo(0, 45)
.holdEnd())
.waitSeconds("Score", 0.5)
.parkWithSeconds(4)
.driveTo("Park", -56, -36, 0, 0.7);Free, with no extra code:
- One odometry for everything
- Red/blue mirroring
- Mechanisms keep working while Pedro drives
- A stuck path stops and says why
Draw it on the field instead: the path builder writes this code.
Try your robot without a robot: the simulator

Your real OpModes, on a laptop, in a browser.
- The BIOBUZZ field in 3D, with physics
- The game's rules and a live score
- Your robot's real size, checked against the limits
- Drive it with a keyboard or gamepad
Plan an autonomous on the field
In the simulator
- Place steps or draw a Pedro path
- Run it with your real code
- Copy the Java
On the web
- Simple steps for any robot
- Pedro paths for mecanum
- Copy the Java, print a setup card
Features
Robot parts
Add each part of your robot in one line, with safety built in.
- Motors and servos One line each, and a clear message when a name is wrong.
- Buttons Tap, hold, double-tap and pairs, all on one gamepad button.
- Mecanum and tank drive Robot- or field-centric driving, with slow mode built in.
- Lifts and arms Named heights, and limits it never goes past, on one or two motors.
- Intakes In, out and on/off on any button; jams cleared by themselves.
- Game pieces counted Sensors count the pieces held, and the intake stops at four.
- A light for the drivers Shows your alliance before the match, then flashes for each shot.
- Interlocks Two parts can never hit each other, whoever moves them.
Shooting
From the flywheel to the aim, with tools to tune every shot.
- Flywheel, hood and feeder Speed in RPM. Coordinates multiple components of your firing system.
- Turrets On a motor, a servo or a CR servo, with safe limits or a slip ring.
- AprilTag aiming A webcam or Limelight finds the goal; odometry takes over when it cannot.
- Whole-robot aim With no turret, the drive turns the whole robot to face the goal.
- Shot Tuner Mark hits and misses, and it keeps the speed that scores best.
Autonomous
Write the plan once as a list of steps; the library runs the match.
- Autonomous steps Moves, turns and actions in order, with the 30-second timer and a report.
- Red and blue One plan for both alliances, flipped for you on mirrored fields.
- Odometry A Pinpoint, an OTOS or dead wheels tell the robot where it is.
- Pedro paths Smooth lines and curves across the field, with no stops between them.
- Plan it on a map Place the steps on the field, and the builder writes the Java for you.
- Ready, aim, fire Spin up before the drive, and an aim that looks around for the goal.
Build, tune, test
Start small, add parts as you build them, and test without the robot.
- Five files The whole robot: its parts, numbers, buttons and autonomous modes.
- Add parts one at a time The library skips a part that is not built yet, so the rest still runs.
- Your own code Add code at INIT, START, every loop and STOP, or write the whole OpMode yourself with the library's robot.
- Live tuning Change numbers from the gamepad while the robot runs.
- Every number explained One page for every setting: what it does and how to find it.
- Tune and check Includes a tuning OpMode to fine-tune values specific to your unique robot.
- Tests on a laptop Pretend motors and servos check your code with no robot.
- Cookbook More than 100 short answers to “how do I...?”, with code to copy.
- Update library button One click to the newest version, with what changed.
