Skip to content

Exporting Code

Turn your visualized paths into runnable robot code or shareable animations.

Every export starts from the Export menu in the top-right corner of the navigation bar.

The Export menu, listing the export formats.

  1. Open the Export menu: Click Export, then choose a format: Java Code, Kotlin Code, Points Array, Sequential Command, .turt File, Export as Image, Export Animated, or Strategy Sheet. You can also use a shortcut, such as Ctrl + Shift + J (or Cmd + Shift + J on macOS) for Java code. See Controls & Shortcuts for the rest.
  2. Adjust Options: Each format opens a dialog with its own options. The ones you change often, such as Language, Target Library, and Class Name, stay in view. The dialog also shows whether the project mirrors for the alliance, which you set in the Field tab. Click Options to reach the set-once ones: Package Name, Command Registrar (OpMode exports), Code Units (imperial or metric), and Generate Full Class or Embed Pose Data in Code. The code preview updates as you change them.
  3. Copy or Save:
    • Click Copy Code to paste the generated code into Android Studio.
    • Click Save to File to download it as a .java file (.kt if you export Kotlin), or a .txt file for a points array. The .turt File dialog has a Download as .turt button instead.

Generates a complete, standalone OpMode for your autonomous routine, in Java or Kotlin. This does not support all the functionality of the program due to current limitations.

The Export Java Code dialog, with the package name, the Generate Full Class option, code units, and a code preview.

  • Full Class: Creates a ready-to-run file including the OpMode structure, state machine, and path definitions.
  • Snippets: Uncheck "Generate Full Class" to get just the path construction code for copy-pasting into your own classes.
  • Hardcoded Paths: The geometry is baked into the generated file. You do not need to put the .turt file on the robot.
  • Event Markers: Each marker becomes a ProgressTracker registration that runs the command you registered with NamedCommands under the marker's name.
  • Command Registrar (optional): Name a method of yours, such as org.firstinspires.ftc.teamcode.RobotCommands.register, and the generated init() calls it with hardwareMap so your named commands exist before the first path starts. It's written only when the path has event markers. You set it under Options.

This is the OpMode generated for a three-path routine with a wait, a SpinUp event marker on the first path, and an Intake marker on the last. The paths are built in a Paths class, and a state machine follows them in order:

package org.firstinspires.ftc.teamcode;
import static com.pedropathing.api.Paths.curve;
import static com.pedropathing.api.Paths.line;
import static com.pedropathing.api.Paths.path;
import com.bylazar.configurables.annotations.Configurable;
import com.bylazar.telemetry.PanelsTelemetry;
import com.bylazar.telemetry.TelemetryManager;
import com.pedropathing.api.PoseFactory;
import com.pedropathing.follower.Follower;
import com.pedropathing.math.Pose;
import com.pedropathing.paths.Path;
import com.pedropathing.paths.interpolator.Interpolator;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.turtletracerlib.pathing.NamedCommands;
import com.turtletracerlib.pathing.ProgressTracker;
import org.firstinspires.ftc.teamcode.pedro.Constants;
@Autonomous(name = "Turtle Tracer Autonomous", group = "Autonomous")
@Configurable // Panels
public class TurtleTracerAutonomous extends OpMode {
private TelemetryManager panelsTelemetry; // Panels Telemetry instance
public Follower follower; // Pathing follower instance
private final PoseFactory p = PoseFactory.degrees();
private ProgressTracker tracker; // Progress tracker instance for event markers
private int pathState; // Current autonomous path state (state machine)
private ElapsedTime pathTimer; // Timer for path state machine
private Paths paths; // Paths defined in the Paths class
@Override
public void init() {
panelsTelemetry = PanelsTelemetry.INSTANCE.getTelemetry();
// ...
panelsTelemetry.debug("Status", "Initialized");
panelsTelemetry.update(telemetry);
follower = Constants.create(hardwareMap);
follower.setPose(p.of(9.000, 25.000, 0.000));
pathTimer = new ElapsedTime();
paths = new Paths(follower); // Build paths
tracker = new ProgressTracker(follower, telemetry);
}
@Override
public void loop() {
follower.update(); // Update follower
tracker.update(); // Update tracker
pathState = autonomousPathUpdate(); // Update autonomous state machine
// Log values to Panels and Driver Station
panelsTelemetry.debug("Path State", pathState);
panelsTelemetry.debug("X", follower.pose().x());
panelsTelemetry.debug("Y", follower.pose().y());
panelsTelemetry.debug("Heading", follower.pose().heading());
panelsTelemetry.update(telemetry);
}
public static class Paths {
private static final PoseFactory p = PoseFactory.degrees();
public Path DriveToShoot;
public Path CollectRow1;
public Path ReturnToShoot;
public Paths(Follower follower) {
DriveToShoot = curve(
p.of(9.000, 25.000, 0.0),
p.of(28.000, 22.000, 0.0),
p.of(48.000, 48.000, 0.0)
).linear(Math.toRadians(0), Math.toRadians(45));
CollectRow1 = curve(
p.of(48.000, 48.000, 0.0),
p.of(30.000, 58.000, 0.0),
p.of(34.000, 78.000, 0.0)
).tangent();
ReturnToShoot = line(
p.of(34.000, 78.000, 0.0),
p.of(48.000, 48.000, 0.0)
).linear(Math.toRadians(90), Math.toRadians(45));
}
}
public int autonomousPathUpdate() {
switch (pathState) {
case 0:
follower.follow(paths.DriveToShoot);
tracker.clearPathEvents();
tracker.onParametric(0, 0.400, NamedCommands.getCommand("SpinUp"));
tracker.setCurrentPath(paths.DriveToShoot);
setPathState(1);
break;
case 1:
if (!follower.isBusy()) {
setPathState(2);
}
break;
case 2:
setPathState(3);
break;
case 3:
if (pathTimer.milliseconds() > 1500) {
setPathState(4);
}
break;
case 4:
follower.follow(paths.CollectRow1);
tracker.clearPathEvents();
tracker.setCurrentPath(paths.CollectRow1);
setPathState(5);
break;
case 5:
if (!follower.isBusy()) {
setPathState(6);
}
break;
case 6:
follower.follow(paths.ReturnToShoot);
tracker.clearPathEvents();
tracker.onParametric(0, 0.500, NamedCommands.getCommand("Intake"));
tracker.setCurrentPath(paths.ReturnToShoot);
setPathState(7);
break;
case 7:
if (!follower.isBusy()) {
setPathState(8);
}
break;
case 8:
requestOpModeStop();
pathState = -1;
break;
}
return pathState;
}
public void setPathState(int pState) {
pathState = pState;
pathTimer.reset();
}
}

Register the SpinUp and Intake commands before the routine runs. Without a Command Registrar, that means editing the generated init(), which the next export overwrites. With one, the export writes the call for you:

follower = Constants.create(hardwareMap);
follower.setPose(p.of(9.000, 25.000, 0.000));
org.firstinspires.ftc.teamcode.RobotCommands.register(hardwareMap); // Team's named commands
pathTimer = new ElapsedTime();
paths = new Paths(follower); // Build paths

See Named Commands & Events for the registration class and a step-by-step setup.

Generates a command group for use with command-based frameworks.

The Sequential Command dialog with the target library set to SolversLib, the class name AutoPath, Embed Pose Data in Code turned on, and the code preview.

  • Supported Libraries: Pick one with the library tabs in the export dialog, or with Target Library in Settings.
    • SolversLib: Standard integration.
    • NextFTC: Experimental support.
    • Ivy: Experimental support for Pedro Pathing's Ivy. Ivy builds commands with static factories, so the generated class hands back a Command from command() instead of extending one. Call Scheduler.reset() in init(), start the routine with new AutoPath(follower, hardwareMap).command().schedule(), and call follower.update() and Scheduler.execute() every loop.
  • Pose data: Embed Pose Data in Code is on by default, so the poses are written into the class and you don't need the .turt file on the robot. Turn it off and the class uses TurtleTracerReader to load path data from the .turt file at runtime. You must put your .turt file on the robot for that to work. See TurtleTracerReader.
  • Features: Automatically handles FollowPath, Wait, Turn, and event triggers. Event markers use TurtleTracerLib events, and each path registers only its own markers, so they trigger on the right path in a chain.
  • Named commands: Register your commands in your own code (a RobotContainer works well) before you create the class. The Command Registrar isn't offered here. See Sequential Command Exports.

The same routine exported for each library. Without Embed Pose Data, the class reads its poses from AutoPath.turt and registers each path's event markers just before that path runs:

package org.firstinspires.ftc.teamcode.Commands.AutoCommands;
import static com.pedropathing.api.Paths.curve;
import static com.pedropathing.api.Paths.line;
import static com.pedropathing.api.Paths.path;
import com.pedropathing.api.PoseFactory;
import com.pedropathing.follower.Follower;
import com.pedropathing.math.Pose;
import com.pedropathing.paths.Path;
import com.pedropathing.paths.interpolator.Interpolator;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.seattlesolvers.solverslib.command.InstantCommand;
import com.seattlesolvers.solverslib.command.ParallelRaceGroup;
import com.seattlesolvers.solverslib.command.RunCommand;
import com.seattlesolvers.solverslib.command.SequentialCommandGroup;
import com.seattlesolvers.solverslib.command.WaitCommand;
import com.seattlesolvers.solverslib.command.WaitUntilCommand;
import com.seattlesolvers.solverslib.pedroCommand.FollowPathCommand;
import com.turtletracerlib.TurtleTracerReader;
import com.turtletracerlib.auto.TurtleAuto;
import com.turtletracerlib.pathing.NamedCommands;
import com.turtletracerlib.pathing.ProgressTracker;
import java.io.IOException;
import org.firstinspires.ftc.robotcore.external.Telemetry;
@TurtleAuto(name = "AutoPath")
public class AutoPath extends SequentialCommandGroup {
private final Follower follower;
private final PoseFactory p = PoseFactory.degrees();
private TurtleTracerReader pp;
private ProgressTracker tracker;
// Poses
private Pose startPoint;
private Pose DriveToShoot;
private Pose DriveToShoot_line0_control1;
private Pose CollectRow1;
private Pose CollectRow1_line1_control1;
private Pose ReturnToShoot;
// Path chains
private Path startPointTODriveToShoot;
private Path DriveToShootTOCollectRow1;
private Path CollectRow1TOReturnToShoot;
public AutoPath(final Follower follower, HardwareMap hw, Telemetry telemetry)
throws IOException {
this.follower = follower;
pp = new TurtleTracerReader("AutoPath.turt", hw.appContext);
pp.onEvent("SpinUp", NamedCommands.getCommand("SpinUp")).onEvent(
"Intake",
NamedCommands.getCommand("Intake")
);
tracker = new ProgressTracker(follower, telemetry);
// Load poses
startPoint = pp.get("startPoint");
DriveToShoot = pp.get("DriveToShoot");
DriveToShoot_line0_control1 = pp.get("DriveToShoot_line0_control1");
CollectRow1 = pp.get("CollectRow1");
CollectRow1_line1_control1 = pp.get("CollectRow1_line1_control1");
ReturnToShoot = pp.get("ReturnToShoot");
follower.setPose(startPoint);
buildPaths();
addCommands(
new InstantCommand(() -> {
tracker.clearPathEvents();
pp.registerLineEvents(tracker, 0, 0);
tracker.setCurrentPath(startPointTODriveToShoot);
}),
new ParallelRaceGroup(
new FollowPathCommand(follower, startPointTODriveToShoot),
new RunCommand(() -> tracker.update())
),
new WaitCommand(1500),
new FollowPathCommand(follower, DriveToShootTOCollectRow1),
new InstantCommand(() -> {
tracker.clearPathEvents();
pp.registerLineEvents(tracker, 2, 0);
tracker.setCurrentPath(CollectRow1TOReturnToShoot);
}),
new ParallelRaceGroup(
new FollowPathCommand(follower, CollectRow1TOReturnToShoot),
new RunCommand(() -> tracker.update())
)
);
}
public void buildPaths() {
startPointTODriveToShoot = curve(
startPoint,
p.of(28.000, 22.000, 0.0),
DriveToShoot
).linear(Math.toRadians(0), Math.toRadians(45));
DriveToShootTOCollectRow1 = curve(
DriveToShoot,
p.of(30.000, 58.000, 0.0),
CollectRow1
).tangent();
CollectRow1TOReturnToShoot = line(CollectRow1, ReturnToShoot).linear(
Math.toRadians(90),
Math.toRadians(45)
);
}
}

The .turt file has to be on the robot for the TurtleTracerReader lines to work. See TurtleTracerReader.

To use the command-based exports you need to add the JitPack repository and the TurtleTracerLib dependency to your teamcode Gradle configuration (for example, build.gradle):

repositories {
maven {
url 'https://jitpack.io'
}
}

And add the dependency (use the newest release instead of the version shown):

implementation 'com.github.Mallen220:TurtleTracerLib:v3.0.3'

Exported code is written for Pedro Pathing 3.x. See the TurtleTracerLib installation guide for the Pedro dependencies.

The OpMode and Sequential Command exports can be written in Kotlin as well as Java. The other formats (Points Array, .turt File, image, animation, and strategy sheet) don't depend on the language.

  • Choosing the language: Java Code and Kotlin Code in the Export menu open the OpMode export in that language. Every OpMode and Sequential Command dialog also has a Language switch above the code preview. The choice is a setting, so it carries over to the other dialogs, the Code tab, and auto export. You can also change it in Settings.
  • Command libraries: SolversLib, NextFTC, and Ivy can all write Kotlin. The Target Library, Embed Pose Data, Package Name, and Code Units options work the same as for Java. For Ivy, start the routine with AutoPath(follower, hardwareMap).command().schedule(), without new.
  • Saving: Save to File writes a .kt file named after the class.
  • Plugin actions: A step that comes from a plugin that can't write Kotlin yet is left as a // TODO comment, and the dialog warns you. See Plugins.

Every example on this page has a Kotlin tab next to Java. The tab you pick is remembered across the docs.

In most FTC games the red and blue halves of the field are copies of each other, so a path drawn for one alliance can run on the other if every point and heading is moved to the matching spot. The Alliance Selection & Path Mirroring section of the Field tab sets this up for each project. Its heading, and the Event Markers heading, have an info icon: both features need TurtleTracerLib on the robot, and the icon links to their docs. It works with TurtleTracerLib's auto selector: the code reads the driver's choice from an AutoContext and passes every pose and heading through it, so nothing changes when no mirroring is needed.

  • Drawn For: the alliance the project's paths are written for, Red or Blue. A new project has none (NONE), and clicking the selected alliance again clears it. With no alliance, exported code runs as drawn and doesn't use TurtleTracerLib for it.

  • Mirror to Blue (or Mirror to Red): the code says so explicitly either way, so it does what the project says whatever your selector's config is.

    • On: the code tells its context to mirror when the driver picks the other alliance (autoContext.drawnFor(Alliance.RED).mirroring(MirrorPolicy.FOLLOW_ALLIANCE)), then records the alliance it ran for and whether it mirrored (AutoSelection.record(ctx)). The driver's mirror override on the gamepad still applies.
    • Off: the code runs as drawn whichever alliance the driver picks, and records that with AutoSelection.record(Alliance.RED, false).

    Either way your TeleOp can read the alliance with AutoSelection.alliance() and whether the auto mirrored with AutoSelection.isMirrored(). The class's @TurtleAuto names the same policy (FOLLOW_ALLIANCE or NEVER), so the selector's menu shows what the code will do.

  • Preview on Blue (or Red): shows the path and the robot on the field as they will run for the other alliance, by the season's Field Mirror. A banner across the top of the field says you're previewing, with a Stop button. You can edit the path while you preview, just as on its own side: dragging a point on the mirrored path moves the matching point of the project's path, and the field shows positions on the side you're looking at. Obstacles stay where they are, so their handles are hidden during the preview. Turning the preview on or off doesn't change the project.

These are saved in the project's .turt file, so each path can be drawn for a different alliance, and changing one project doesn't change the others. The export dialog shows the project's choice above the code, and the Code tab and auto export use it too.

Everything the export writes is mirrored: poses, Bézier control points, heading angles, facing-point targets, Rotate steps and pose event markers. Steps added by plugins are mirrored only if the plugin supports it (see Plugins).

TurtleTracerLib is optional. Exported code only imports it for what the project uses: event markers, reading poses from the .turt file (when Embed Pose Data is off), or an alliance. A project with none of these exports code that builds without TurtleTracerLib installed. Command classes that do use it (SolversLib and NextFTC) also get @TurtleAuto(...), so your auto selector can find them with scan.

The OpMode shows an alliance menu on the Driver Station during init. The driver picks red or blue with D-pad left and right, and when Start is pressed the OpMode builds its paths for that alliance. Picking the alliance the project is drawn for runs the paths as drawn; picking the other mirrors them.

How the field mirrors depends on the season, not the path, so it's a setting shared by every project: Field Mirror in Settings, under Code Export. The preview uses it too. Choose Turn field 180° (the default), Flip left/right (X) or Flip top/bottom (Y).

package org.firstinspires.ftc.teamcode;
import static com.pedropathing.api.Paths.curve;
import static com.pedropathing.api.Paths.line;
import static com.pedropathing.api.Paths.path;
import com.bylazar.configurables.annotations.Configurable;
import com.bylazar.telemetry.PanelsTelemetry;
import com.bylazar.telemetry.TelemetryManager;
import com.pedropathing.api.PoseFactory;
import com.pedropathing.follower.Follower;
import com.pedropathing.math.Pose;
import com.pedropathing.paths.Path;
import com.pedropathing.paths.interpolator.Interpolator;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.util.ElapsedTime;
import com.turtletracerlib.auto.Alliance;
import com.turtletracerlib.auto.AutoConfig;
import com.turtletracerlib.auto.AutoContext;
import com.turtletracerlib.auto.AutoRegistry;
import com.turtletracerlib.auto.AutoSelector;
import com.turtletracerlib.auto.MirrorAxes;
import com.turtletracerlib.auto.MirrorPolicy;
import com.turtletracerlib.pathing.NamedCommands;
import com.turtletracerlib.pathing.ProgressTracker;
import org.firstinspires.ftc.teamcode.pedro.Constants;
@Autonomous(name = "Turtle Tracer Autonomous", group = "Autonomous")
@Configurable // Panels
public class TurtleTracerAutonomous extends OpMode {
private TelemetryManager panelsTelemetry; // Panels Telemetry instance
public Follower follower; // Pathing follower instance
private final PoseFactory p = PoseFactory.degrees();
private ProgressTracker tracker; // Progress tracker instance for event markers
private int pathState; // Current autonomous path state (state machine)
private ElapsedTime pathTimer; // Timer for path state machine
private Paths paths; // Paths defined in the Paths class
private AutoSelector<AutoContext> selector; // Alliance menu shown during init
private AutoContext ctx; // The alliance picked, to mirror the paths for
@Override
public void init() {
panelsTelemetry = PanelsTelemetry.INSTANCE.getTelemetry();
// ...
panelsTelemetry.debug("Status", "Initialized");
panelsTelemetry.update(telemetry);
follower = Constants.create(hardwareMap);
pathTimer = new ElapsedTime();
// Alliance menu: D-pad left/right picks the alliance before Start.
selector = new AutoSelector<>(
new AutoRegistry<AutoContext>().add("Turtle Tracer Autonomous", c -> c),
AutoConfig.builder()
.baseAlliance(Alliance.RED) // The side these paths are drawn for
.mirrorPolicy(MirrorPolicy.FOLLOW_ALLIANCE) // Mirrored when the driver picks the other one
.mirrorAxes(MirrorAxes.BOTH)
.build()
);
tracker = new ProgressTracker(follower, telemetry);
}
@Override
public void init_loop() {
selector.update(gamepad1, telemetry); // Draw the alliance menu
}
@Override
public void start() {
ctx = selector.buildSelected(); // The alliance picked, and whether to mirror
follower.setPose(ctx.pose(p.of(9.000, 25.000, 0.000)));
paths = new Paths(follower, ctx); // Build paths for that alliance
}
@Override
public void loop() {
follower.update(); // Update follower
tracker.update(); // Update tracker
pathState = autonomousPathUpdate(); // Update autonomous state machine
// Log values to Panels and Driver Station
panelsTelemetry.debug("Path State", pathState);
panelsTelemetry.debug("X", follower.pose().x());
panelsTelemetry.debug("Y", follower.pose().y());
panelsTelemetry.debug("Heading", follower.pose().heading());
panelsTelemetry.update(telemetry);
}
public static class Paths {
private static final PoseFactory p = PoseFactory.degrees();
public Path DriveToShoot;
public Path CollectRow1;
public Path ReturnToShoot;
public Paths(Follower follower, AutoContext ctx) {
DriveToShoot = curve(
ctx.pose(p.of(9.000, 25.000, 0.0)),
ctx.pose(p.of(28.000, 22.000, 0.0)),
ctx.pose(p.of(48.000, 48.000, 0.0))
).linear(ctx.heading(Math.toRadians(0)), ctx.heading(Math.toRadians(45)));
CollectRow1 = curve(
ctx.pose(p.of(48.000, 48.000, 0.0)),
ctx.pose(p.of(30.000, 58.000, 0.0)),
ctx.pose(p.of(34.000, 78.000, 0.0))
).tangent();
ReturnToShoot = line(
ctx.pose(p.of(34.000, 78.000, 0.0)),
ctx.pose(p.of(48.000, 48.000, 0.0))
).linear(
ctx.heading(Math.toRadians(90)),
ctx.heading(Math.toRadians(45))
);
}
}
public int autonomousPathUpdate() {
switch (pathState) {
case 0:
follower.follow(paths.DriveToShoot);
tracker.clearPathEvents();
tracker.onParametric(0, 0.400, NamedCommands.getCommand("SpinUp"));
tracker.setCurrentPath(paths.DriveToShoot);
setPathState(1);
break;
case 1:
if (!follower.isBusy()) {
setPathState(2);
}
break;
case 2:
setPathState(3);
break;
case 3:
if (pathTimer.milliseconds() > 1500) {
setPathState(4);
}
break;
case 4:
follower.follow(paths.CollectRow1);
tracker.clearPathEvents();
tracker.setCurrentPath(paths.CollectRow1);
setPathState(5);
break;
case 5:
if (!follower.isBusy()) {
setPathState(6);
}
break;
case 6:
follower.follow(paths.ReturnToShoot);
tracker.clearPathEvents();
tracker.onParametric(0, 0.500, NamedCommands.getCommand("Intake"));
tracker.setCurrentPath(paths.ReturnToShoot);
setPathState(7);
break;
case 7:
if (!follower.isBusy()) {
setPathState(8);
}
break;
case 8:
requestOpModeStop();
pathState = -1;
break;
}
return pathState;
}
public void setPathState(int pState) {
pathState = pState;
pathTimer.reset();
}
}

The class takes an AutoContext as its last constructor argument and calls drawnFor(...) on it with the project's alliance, so it decides for itself whether to mirror. Get the context from an AutoSelector and pass it in when the routine is built. Adding the routine with the same alliance keeps the selector's menu right:

autos.add("Routine", ctx -> new AutoPath(follower, hardwareMap, telemetry, ctx), Alliance.RED);

That's the SolversLib constructor. NextFTC and Ivy classes take (follower, hardwareMap, ctx). How the field mirrors comes from your selector's AutoConfig, so the Field Mirror setting isn't used here. Without a selector, pass AutoContext.unmirrored() and the routine runs as drawn.

When the class reads a .turt file, the reader mirrors the poses and the curves' control points come from the file too. With Embed Pose Data, each pose in the code is wrapped in ctx.pose(...) instead.

package org.firstinspires.ftc.teamcode.Commands.AutoCommands;
import static com.pedropathing.api.Paths.curve;
import static com.pedropathing.api.Paths.line;
import static com.pedropathing.api.Paths.path;
import com.pedropathing.api.PoseFactory;
import com.pedropathing.follower.Follower;
import com.pedropathing.math.Pose;
import com.pedropathing.paths.Path;
import com.pedropathing.paths.interpolator.Interpolator;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.seattlesolvers.solverslib.command.InstantCommand;
import com.seattlesolvers.solverslib.command.ParallelRaceGroup;
import com.seattlesolvers.solverslib.command.RunCommand;
import com.seattlesolvers.solverslib.command.SequentialCommandGroup;
import com.seattlesolvers.solverslib.command.WaitCommand;
import com.seattlesolvers.solverslib.command.WaitUntilCommand;
import com.seattlesolvers.solverslib.pedroCommand.FollowPathCommand;
import com.turtletracerlib.TurtleTracerReader;
import com.turtletracerlib.auto.Alliance;
import com.turtletracerlib.auto.AutoContext;
import com.turtletracerlib.auto.AutoSelection;
import com.turtletracerlib.auto.MirrorPolicy;
import com.turtletracerlib.auto.TurtleAuto;
import com.turtletracerlib.pathing.NamedCommands;
import com.turtletracerlib.pathing.ProgressTracker;
import java.io.IOException;
import org.firstinspires.ftc.robotcore.external.Telemetry;
@TurtleAuto(
name = "AutoPath",
drawnFor = Alliance.RED,
mirror = MirrorPolicy.FOLLOW_ALLIANCE,
overrideMirror = true
)
public class AutoPath extends SequentialCommandGroup {
private final Follower follower;
private final AutoContext ctx; // The driver's alliance, for paths drawn for RED
private final PoseFactory p = PoseFactory.degrees();
private TurtleTracerReader pp;
private ProgressTracker tracker;
// Poses
private Pose startPoint;
private Pose DriveToShoot;
private Pose DriveToShoot_line0_control1;
private Pose CollectRow1;
private Pose CollectRow1_line1_control1;
private Pose ReturnToShoot;
// Path chains
private Path startPointTODriveToShoot;
private Path DriveToShootTOCollectRow1;
private Path CollectRow1TOReturnToShoot;
public AutoPath(
final Follower follower,
HardwareMap hw,
Telemetry telemetry,
AutoContext autoContext
) throws IOException {
this.follower = follower;
// Drawn for the red alliance, and mirrored when the driver picks the other one.
this.ctx = autoContext
.drawnFor(Alliance.RED)
.mirroring(MirrorPolicy.FOLLOW_ALLIANCE);
AutoSelection.record(ctx); // The alliance it runs for, and whether it's mirrored, for TeleOp
pp = new TurtleTracerReader("AutoPath.turt", hw.appContext).mirrored(
ctx.mirror()
);
pp.onEvent("SpinUp", NamedCommands.getCommand("SpinUp")).onEvent(
"Intake",
NamedCommands.getCommand("Intake")
);
tracker = new ProgressTracker(follower, telemetry);
// Load poses
startPoint = pp.get("startPoint");
DriveToShoot = pp.get("DriveToShoot");
DriveToShoot_line0_control1 = pp.get("DriveToShoot_line0_control1");
CollectRow1 = pp.get("CollectRow1");
CollectRow1_line1_control1 = pp.get("CollectRow1_line1_control1");
ReturnToShoot = pp.get("ReturnToShoot");
follower.setPose(startPoint);
buildPaths();
addCommands(
new InstantCommand(() -> {
tracker.clearPathEvents();
pp.registerLineEvents(tracker, 0, 0);
tracker.setCurrentPath(startPointTODriveToShoot);
}),
new ParallelRaceGroup(
new FollowPathCommand(follower, startPointTODriveToShoot),
new RunCommand(() -> tracker.update())
),
new WaitCommand(1500),
new FollowPathCommand(follower, DriveToShootTOCollectRow1),
new InstantCommand(() -> {
tracker.clearPathEvents();
pp.registerLineEvents(tracker, 2, 0);
tracker.setCurrentPath(CollectRow1TOReturnToShoot);
}),
new ParallelRaceGroup(
new FollowPathCommand(follower, CollectRow1TOReturnToShoot),
new RunCommand(() -> tracker.update())
)
);
}
public void buildPaths() {
startPointTODriveToShoot = curve(
startPoint,
DriveToShoot_line0_control1,
DriveToShoot
).linear(ctx.heading(Math.toRadians(0)), ctx.heading(Math.toRadians(45)));
DriveToShootTOCollectRow1 = curve(
DriveToShoot,
CollectRow1_line1_control1,
CollectRow1
).tangent();
CollectRow1TOReturnToShoot = line(CollectRow1, ReturnToShoot).linear(
ctx.heading(Math.toRadians(90)),
ctx.heading(Math.toRadians(45))
);
}
}
  • Points List: A raw array of coordinates (e.g., [(10, 10), (20, 20)]) for custom processing or debugging.
  • Project File (.turt): Download the source file to share with teammates or back up your work. The project data preview shows exactly what saving will write, including unsaved changes. Older .pp files can still be opened.

Create high-quality visualizers to share your strategy.

  • Formats:
    • GIF: Best for compatibility (Discord, Slack).
    • APNG: Higher quality with transparency support, and smaller file sizes.
  • Quality Controls: Adjust FPS, Scale, and Quality to balance file size and visual fidelity.
  • Search (Ctrl+F): Quickly find specific lines or markers in the generated code.
  • Package Name: Set your team's package (e.g., org.firstinspires.ftc.teamcode) to fix imports automatically.
  • Command Registrar (OpMode exports only): The class and method that registers your named commands, for example org.firstinspires.ftc.teamcode.RobotCommands.register. A line under the field shows what will be added to init(). See Named Commands & Events.
  • Code Units: Generate the code in imperial (inches) or metric (cm). For sequential commands, metric code generation requires Embed Pose Data in Code, and the dialog warns you if it's off.
  • Save to File: Directly save .java or .txt files to your computer.