OpenLoop
Calibrate a short timed autonomous move and measure its travel error
Overview
OpenLoop is Abhiraj Karki's source-copy helper for timed moves. It estimates how long to drive from measured calibration distances. A request such as forward(6) means an estimated six-inch move; it does not measure that the travelled six inches.
Project status
OpenLoop is an early project distributed as source, with no numbered release or published Maven artifact. This guide uses commit b67b403 and the project's FTC SDK 12 setup.
This project is distinct from the general concept of open-loop control. Its movement methods block while the robot drives for the calculated duration. It does not supply an correction, field pose, motion profile, or nonblocking follower.
Setup
Files and hardware
Copy OpenLoopBackend.java into the existing TeamCode package. The project also supplies MotorDirectionDebugger.java, /tank calibration , and example autonomous files. Use the appropriate calibration files with either Android Studio or OnBot ; the helper needs no additional third-party Maven dependency.
The unmodified backend maps four in both drive modes. Tank mode means two motors on each side. A two-motor tank needs a mapping change before it can use this source.
Default hardware names are FL, FR, BL, and BR. Replace them with the configured names and verify every motor's direction. The default left-side reversal is a starting configuration, not proof that your will move correctly.
Calibration
Run the direction check in a controlled practice setup. Then use the matching calibration OpMode to measure forward travel at two different durations. For mecanum strafing, measure a separate pair of distances. Left and right turn timings also need their own measurements.
The backend fits a straight line through the two distance/time points. Keep the units consistent: movement distances are inches, turns are degrees, and positive turns are to the right. Calibration values must be finite and meaningfully different; the backend does not provide a complete validation layer for bad or equal measurements.
Record the drive, , and turn powers alongside the battery condition, floor, payload, and measured distances. Changing those conditions changes the relationship between time and travel. Recalibrate after changing gearing or wheels.
Example
After configuring the backend and replacing its calibration with measured values, save this as OpenLoopShortAuto.java. The example and the unmodified backend compile against FTC SDK 12. A compile does not validate the requested travel on a robot.
package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
@Autonomous(name = "OpenLoop Short Test")
public class OpenLoopShortAuto extends LinearOpMode {
@Override public void runOpMode() {
// Configure names, directions and measured calibration in OpenLoopBackend first.
OpenLoopBackend bot = new OpenLoopBackend(this, OpenLoopBackend.DriveType.MECANUM);
waitForStart();
if (isStopRequested()) return;
try {
bot.forward(6); // Estimates six inches from your timing calibration.
} finally {
bot.stop();
}
}
}Testing
Repeat the request three times in an open test area and measure the actual distance each time. Record the error from six inches. Compare the runs to see how much travel varies. One successful endpoint is not enough to validate a match route.
Limits
Stop behaviour
Movement methods use LinearOpMode.sleep() and then stop the motors. They do not poll opModeIsActive() throughout the move. If extending the example to several moves, check opModeIsActive() before each subsequent call and retain final stop cleanup. A stop during one sleep must not be followed by a new movement command.
Tank-mode strafe calls return without moving. Battery compensation rescales and clips requested power, but it cannot correct wheel slip, collisions, changed friction, or a different payload. For tasks that need measured position, continue to encoder movement, odometry, or a tuned path follower.