Skip to content
Tempo on GitHub (opens in a new tab)

1.4 Write the first auto

Examples: WPILib 2026Teaching field: REEFSCAPE 2025

Before you start

Install Tempo, configure the robot and connect the drivetrain first.

The poses are on the REEFSCAPE 2025 field, so, if you want to write an auto like this, the robot needs the REEFSCAPE 2025 pack. Download its game.toml and save it as src/main/deploy/tempo/game.toml in Java or C++, or as deploy/tempo/game.toml next to robot.py in Python.

We use the REEFSCAPE 2025 pack because autos are much easier to write for REEFSCAPE than they are for REBUILT.

1. Create the route

A Composer is one route, and you can reuse it in different autos. named is the name it gets on the chooser, startAt sets where it starts, and each .to(...) adds a waypoint, which the robot drives to in order (Terms lists the words these pages use).

The poses are in meters and written for the blue alliance, with the robot facing the reef at 180 degrees. originAlliance(BLUE) marks the route as blue, and when the robot is on red Tempo mirrors it.

resetOdometry(true) sets the pose estimator to the start pose when the auto begins. The route has no .speed(...), so it runs at the default Speed.FULL.

Java
import com.tempo.Alliance;
import com.tempo.Composer;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;

static final Pose2d START_CENTER = new Pose2d(7.58, 4.03, Rotation2d.fromDegrees(180));
static final Pose2d REEF_G = new Pose2d(5.77, 4.03, Rotation2d.fromDegrees(180));

Composer approach = Composer.named("Center approach").startAt(START_CENTER)
    .originAlliance(Alliance.BLUE)
    .resetOdometry(true)
    .to(REEF_G);
Python
from tempo import Alliance, Composer
from wpimath.geometry import Pose2d, Rotation2d

START_CENTER = Pose2d(7.58, 4.03, Rotation2d.fromDegrees(180))
REEF_G = Pose2d(5.77, 4.03, Rotation2d.fromDegrees(180))

self.approach = (Composer.named("Center approach").start_at(START_CENTER)
    .origin_alliance(Alliance.BLUE)
    .reset_odometry(True)
    .to(REEF_G))
C++
#include <frc/geometry/Pose2d.h>
#include <tempo/Composer.h>

const frc::Pose2d START_CENTER{7.58_m, 4.03_m, 180_deg};
const frc::Pose2d REEF_G{5.77_m, 4.03_m, 180_deg};

tempo::Composer approach_ = tempo::Composer::named("Center approach").start_at(START_CENTER)
    .origin_alliance(tempo::Alliance::Blue)
    .reset_odometry(true)
    .to(REEF_G);

2. Put it in a chooser

TempoAutos.populate adds every named Tempo auto to your chooser.

Java
import com.tempo.TempoAutos;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;

private final SendableChooser<Command> autos = new SendableChooser<>();

// once at startup, after the route
TempoAutos.populate(autos);
SmartDashboard.putData("Auto", autos);

public Command getAutonomousCommand() {
    return autos.getSelected();
}
Java
import com.tempo.TempoAutos;
import org.wpilib.command2.Command;
import org.wpilib.tunable.Selectable;
import org.wpilib.tunable.Tunables;

private final Selectable<Command> autos = new Selectable<>();

// once at startup, after the route
TempoAutos.populate(autos);
Tunables.publish("Auto", autos);

public Command getAutonomousCommand() {
    return autos.getSelected();
}
Python
import commands2
from tempo import TempoAutos
from wpilib import SendableChooser, SmartDashboard

def robotInit(self):
    # after the route
    self.auto = None
    self.autos = SendableChooser()
    TempoAutos.populate(self.autos)
    SmartDashboard.putData("Auto", self.autos)

def robotPeriodic(self):
    commands2.CommandScheduler.getInstance().run()

def autonomousInit(self):
    self.auto = self.autos.getSelected()
    if self.auto is not None:
        commands2.CommandScheduler.getInstance().schedule(self.auto)

def teleopInit(self):
    if self.auto is not None:
        self.auto.cancel()
Python
import commands2
import tunables
from tempo import TempoAutos

def __init__(self):
    super().__init__()
    # after the route
    self.auto = None
    self.autos = tunables.Selectable()
    TempoAutos.populate(self.autos)
    tunables.publish("Auto", self.autos)

def robot_periodic(self):
    commands2.CommandScheduler.get_instance().run()

def autonomous_init(self):
    self.auto = self.autos.get_selected()
    if self.auto is not None:
        commands2.CommandScheduler.get_instance().schedule(self.auto)

def teleop_init(self):
    if self.auto is not None:
        self.auto.cancel()
C++
#include <frc/smartdashboard/SendableChooser.h>
#include <frc/smartdashboard/SmartDashboard.h>
#include <frc2/command/Command.h>
#include <tempo/wpi/TempoAutos.h>

// members, after approach_
frc::SendableChooser<frc2::Command*> autos_;

// once at startup
tempo::wpi::TempoAutos::populate(autos_);
frc::SmartDashboard::PutData("Auto", &autos_);

frc2::Command* RobotContainer::GetAutonomousCommand() {
    return autos_.GetSelected();
}
C++
#include <tempo/wpi/TempoAutos.h>
#include <wpi/commands2/Command.hpp>
#include <wpi/tunables/Selectable.hpp>
#include <wpi/tunables/Tunables.hpp>

// class members, after approach_
wpi::tunables::Selectable<wpi::cmd::Command*> autos_;

// once at startup
tempo::wpi::TempoAutos::populate(autos_);
wpi::tunables::Publish("Auto", autos_);

wpi::cmd::Command* RobotContainer::GetAutonomousCommand() {
    return autos_.GetSelected();
}

WPILib’s C++ template returns a CommandPtr, and the chooser holds plain pointers. Change GetAutonomousCommand() to return a Command*, change the autonomous command field in Robot.h to a Command* that starts as nullptr, and remove .value() in Robot::AutonomousInit(). Keep the route and the chooser as members so they last as long as the robot program. The _m and _deg literals need no using line (Geometry and units).

The whole thing

This is RobotContainer.java from WPILib’s command-based template after the two steps. Drive is your drivetrain subsystem, and it calls Tempo.configure(...) when it’s constructed, so the route is built after it. Robot.java stays the way the template wrote it, plus the priority line from Connect the drivetrain.

Java
package frc.robot;

import com.tempo.Alliance;
import com.tempo.Composer;
import com.tempo.TempoAutos;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.Command;
import frc.robot.subsystems.Drive;

public class RobotContainer {
    static final Pose2d START_CENTER = new Pose2d(7.58, 4.03, Rotation2d.fromDegrees(180));
    static final Pose2d REEF_G = new Pose2d(5.77, 4.03, Rotation2d.fromDegrees(180));

    private final Drive drive = new Drive();
    private final SendableChooser<Command> autos = new SendableChooser<>();

    public RobotContainer() {
        // Routes don't have to be built in RobotContainer
        Composer approach = Composer.named("Center approach").startAt(START_CENTER)
            .originAlliance(Alliance.BLUE)
            .resetOdometry(true)
            .to(REEF_G);

        TempoAutos.populate(autos);
        SmartDashboard.putData("Auto", autos);
    }

    public Command getAutonomousCommand() {
        return autos.getSelected();
    }
}

This is for alpha-7 and alpha-8 with the Commands v2 template, and a SystemCore doesn’t need the priority line.

Java
package frc.robot;

import com.tempo.Alliance;
import com.tempo.Composer;
import com.tempo.TempoAutos;
import frc.robot.subsystems.Drive;
import org.wpilib.command2.Command;
import org.wpilib.math.geometry.Pose2d;
import org.wpilib.math.geometry.Rotation2d;
import org.wpilib.tunable.Selectable;
import org.wpilib.tunable.Tunables;

public class RobotContainer {
    static final Pose2d START_CENTER = new Pose2d(7.58, 4.03, Rotation2d.fromDegrees(180));
    static final Pose2d REEF_G = new Pose2d(5.77, 4.03, Rotation2d.fromDegrees(180));

    private final Drive drive = new Drive();
    private final Selectable<Command> autos = new Selectable<>();

    public RobotContainer() {
        // Routes don't have to be built in RobotContainer
        Composer approach = Composer.named("Center approach").startAt(START_CENTER)
            .originAlliance(Alliance.BLUE)
            .resetOdometry(true)
            .to(REEF_G);

        TempoAutos.populate(autos);
        Tunables.publish("Auto", autos);
    }

    public Command getAutonomousCommand() {
        return autos.getSelected();
    }
}

The whole robot.py

In Python, the two steps make this robot.py, with a Tempo.warmup() call and the priority line from Connect the drivetrain added. Drive is your drivetrain subsystem in drive.py, and its __init__ builds the config from Configure the robot and calls Tempo.configure(...) from Connect the drivetrain.

Tempo.warmup() starts the one-time warm-up, which Python doesn’t start on its own.

Python
import commands2
import wpilib
from tempo import Alliance, Composer, Tempo, TempoAutos
from wpimath.geometry import Pose2d, Rotation2d

from drive import Drive

START_CENTER = Pose2d(7.58, 4.03, Rotation2d.fromDegrees(180))
REEF_G = Pose2d(5.77, 4.03, Rotation2d.fromDegrees(180))


class MyRobot(wpilib.TimedRobot):
    def robotInit(self):
        self.auto = None
        self.drive = Drive()
        Tempo.warmup()

        self.approach = (Composer.named("Center approach").start_at(START_CENTER)
            .origin_alliance(Alliance.BLUE)
            .reset_odometry(True)
            .to(REEF_G))

        self.autos = wpilib.SendableChooser()
        TempoAutos.populate(self.autos)
        wpilib.SmartDashboard.putData("Auto", self.autos)

        wpilib.setCurrentThreadPriority(True, 99)  # roboRIO, WPILib 2026

    def robotPeriodic(self):
        commands2.CommandScheduler.getInstance().run()

    def autonomousInit(self):
        self.auto = self.autos.getSelected()
        if self.auto is not None:
            commands2.CommandScheduler.getInstance().schedule(self.auto)

    def teleopInit(self):
        if self.auto is not None:
            self.auto.cancel()

This is for alpha-7 and alpha-8, and a SystemCore doesn’t need the priority line.

Python
import commands2
import tunables
import wpilib
from tempo import Alliance, Composer, Tempo, TempoAutos
from wpimath import Pose2d, Rotation2d

from drive import Drive

START_CENTER = Pose2d(7.58, 4.03, Rotation2d.from_degrees(180))
REEF_G = Pose2d(5.77, 4.03, Rotation2d.from_degrees(180))


class MyRobot(wpilib.TimedRobot):
    def __init__(self):
        super().__init__()
        self.auto = None
        self.drive = Drive()
        Tempo.warmup()

        self.approach = (Composer.named("Center approach").start_at(START_CENTER)
            .origin_alliance(Alliance.BLUE)
            .reset_odometry(True)
            .to(REEF_G))

        self.autos = tunables.Selectable()
        TempoAutos.populate(self.autos)
        tunables.publish("Auto", self.autos)

    def robot_periodic(self):
        commands2.CommandScheduler.get_instance().run()

    def autonomous_init(self):
        self.auto = self.autos.get_selected()
        if self.auto is not None:
            commands2.CommandScheduler.get_instance().schedule(self.auto)

    def teleop_init(self):
        if self.auto is not None:
            self.auto.cancel()

Expected result

Elastic with the Auto chooser open and Center approach selected
View full size (opens in a new tab) ↗

Run it in simulation first. The drivetrain code has to simulate its pose, updating it from the speeds it’s given. Start the simulator with WPILib: Simulate Robot Code (or python -m robotpy sim in Python), pick “Center approach” on the “Auto” chooser and enable autonomous. The pose estimator resets to the start pose, the robot drives to REEF_G facing 180 degrees, and the drive output settles to zero.

On the red alliance the same auto starts and ends at the mirrored poses. The REEFSCAPE 2025 pack mirrors by rotating about (8.774, 4.026):

PoseBlueRed
Start(7.580, 4.030, 180 deg)(9.968, 4.022, 0 deg)
Target(5.770, 4.030, 180 deg)(11.778, 4.022, 0 deg)

Add more with a Setlist

A Setlist runs routes and commands in order as one auto. This one drives to REEF_G, runs a scoring command from your robot code and drives back to the start. Add it after the route, and populate puts it on the chooser next to “Center approach”.

Java
import com.tempo.wpi.Setlist;

Composer back = Composer.startAt(REEF_G)
    .originAlliance(Alliance.BLUE)
    .to(START_CENTER);

Setlist scoreAndBack = Setlist.named("Score and back")
    .drive(approach)
    .then(superstructure.scoreL4())
    .drive(back);
Python
from tempo.wpi import Setlist

self.back = (Composer.start_at(REEF_G)
    .origin_alliance(Alliance.BLUE)
    .to(START_CENTER))

self.score_and_back = (Setlist.named("Score and back")
    .drive(self.approach)
    .then(superstructure.score_l4())
    .drive(self.back))
C++
#include <tempo/wpi/Setlist.h>

// members, after approach_
tempo::Composer back_ = tempo::Composer::start_at(REEF_G)
    .origin_alliance(tempo::Alliance::Blue)
    .to(START_CENTER);

tempo::Setlist scoreAndBack_ = tempo::Setlist::named("Score and back")
    .drive(approach_)
    .then(superstructure.ScoreL4())
    .drive(back_);

If it fails…

The robot never moves, or the auto ends early Troubleshooting →

A leg was skipped or the auto was interrupted. Inspect a running auto shows how to tell which.

"Center approach" is missing from the chooser Auto chooser →

populate adds named autos. Check that the route starts with Composer.named(...) and that the chooser lines from step 2 run at startup.

Startup stops with a WPILib version message Troubleshooting → [Tempo] This Tempo build targets WPILib 2027.0.0-alpha-7; the robot runs WPILib 2027.0.0-alpha-6. ...

Install the vendordep or robotpy-tempo release the message names.

The robot drives the wrong way Troubleshooting →

One of the four drivetrain methods uses the wrong frame. Test them without an auto.

Next

esc

Loading search...