Skip to content

Named Commands & Events

An event marker in Turtle Tracer is only a name, such as SpinUp. The exported code doesn't know what SpinUp does. NamedCommands is where you tell it. It is a registry that maps each name to a piece of code (a Runnable) that you write.

  1. You place a marker named SpinUp on a path in Turtle Tracer.
  2. You export. The generated code looks up NamedCommands.getCommand("SpinUp") and gives it to a ProgressTracker.
  3. While the robot drives, the tracker watches the follower. When the robot reaches the marker, it runs the Runnable you registered under SpinUp.

You write the registration yourself:

NamedCommands.registerCommand("SpinUp", () -> shooter.spinUp());

The registry is static and shared by the whole app, so any class can register a command, as long as it does so before the generated code looks the name up.

The generated code calls getCommand at different moments depending on the export:

ExportgetCommand runsRegister before
OpModeWhen each path starts, in the state machineThe OpMode starts following paths
Sequential Command, Embed Pose Data onWhen each path starts, inside the command groupThe command group is scheduled
Sequential Command, Embed Pose Data offIn the constructor, when TurtleTracerReader is set upnew AutoPath(...) is called

To sidestep the difference, register everything before you create the routine: in init() for an OpMode, or before new AutoPath(...) for a command group. That works for every export.

The name in registerCommand must match the marker's name in Turtle Tracer, capitals included. The name dropdown in the Event Markers panel lists names you've already used, which helps avoid typos.

Registering a name again replaces the earlier command, and several markers with the same name all run the same command.

Which page you need depends on what you export:

  • OpMode Exports: the Java or Kotlin OpMode has no robot container, so Turtle Tracer can call a registration method of yours from init().
  • RobotContainer & Command Groups: registering commands in a RobotContainer, then creating a SolversLib, NextFTC, or Ivy command group after them.
  • Debugging & Reference: listing what's registered, fixing warnings, using ProgressTracker yourself, and every NamedCommands method.