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

Tempo is static. It’s com.tempo.Tempo in Java, tempo.Tempo in Python and tempo::Tempo in C++ (<tempo/Tempo.h>). Call configure once at startup, before you build any route.

Configuration

Java
Tempo.configure(this::getPose, this::resetPose, this::getRobotRelativeSpeeds,
    this::runVelocity, CONFIG, this);
boolean ready = Tempo.isReady();
GamePack field = Tempo.pack();
Python
Tempo.configure(self.get_pose, self.reset_pose, self.get_robot_relative_speeds,
                self.run_velocity, CONFIG, self)
ready = Tempo.is_ready()
field = Tempo.pack()
C++
#include <tempo/wpi/Setlist.h>

tempo::wpi::configure(
    [this] { return GetPose(); },
    [this](const frc::Pose2d& pose) { ResetPose(pose); },
    [this] { return GetRobotRelativeSpeeds(); },
    [this](const frc::ChassisSpeeds& speeds) { RunVelocity(speeds); },
    kConfig,
    {this});
bool ready = tempo::Tempo::is_ready();
tempo::GamePack& field = tempo::Tempo::pack();

configure installs the config, loads the game pack and connects the drivetrain. The arguments are pose, reset, speeds and run (Drivetrain), then the config and the drive subsystem. C++ takes the subsystem as a list, {this}, which the table calls requirements.

FormJavaPythonC++
Command-based robotconfigure(pose, reset, speeds, run, config, subsystem)configure(pose, reset, speeds, run, config, subsystem)tempo::wpi::configure(pose, reset, speeds, run, config, requirements)
Without the command schedulerconfigure(pose, reset, speeds, run, config)configure(pose, reset, speeds, run, config)tempo::wpi::configure(pose, reset, speeds, run, config), or the core Tempo::configure(pose, reset, speeds, run, config)
With an alliance checkconfigure(pose, reset, speeds, run, config, isRedAlliance, subsystem)configure(pose, reset, speeds, run, config, is_red_alliance, subsystem)tempo::wpi::configure(pose, reset, speeds, run, config, is_red_alliance, {this})
Config onlyconfigure(config), configure(config, isRedAlliance)configure(config), configure(config, is_red_alliance)Tempo::configure(config), Tempo::configure(config, is_red_alliance)

The config-only form connects no drivetrain. It’s for tests and tools that plan without driving, as in Registries and tests.

configure throws if an argument is missing, and nothing is installed:

LanguageThrown asMessage
JavaNullPointerExceptiongetRobotRelativeSpeeds is required, with the name of the null argument
PythonTypeError[Tempo] Tempo.configure(...) is missing get_robot_relative_speeds. Its forms are configure(get_pose, reset_pose, get_robot_relative_speeds, drive_robot_relative, config[, drive_subsystem]) and configure(config)
C++std::invalid_argument[Tempo] tempo::wpi::configure needs robot_relative_speeds, the drivetrain's measured robot-relative speeds; got an empty function

In Python the arguments can also be passed by name: get_pose, reset_pose, get_robot_relative_speeds, drive_robot_relative, config and drive_subsystem.

In C++ an empty pose getter, pose setter or velocity runner throws [Tempo] tempo::wpi::configure needs a pose getter, a pose setter and a velocity runner; got an empty one. The core Tempo::configure throws both messages with Tempo::configure in place of tempo::wpi::configure and get_robot_relative_speeds in place of robot_relative_speeds. The lambdas capture a pointer to the drivetrain, so the drivetrain must outlive them.

JavaPythonC++Behavior
config()config()config()The installed config
pack()pack()pack()The active GamePack. Don’t close it
isReady()is_ready()is_ready()True once configure succeeded
bundledGamePack()bundled_game_pack()bundled_game_pack()A fresh copy of the artifact’s default pack, ignoring deploy files

The pack comes from withGamePack(...), then tempo/game.toml in the deploy folder, then the bundled default. A pack that fails to load throws from configure (Java and Python TempoException, C++ std::runtime_error). The messages are on GamePack. Before configure, config() and pack() throw:

LanguageThrown asMessage
JavaIllegalStateException[Tempo] no config is applied yet; call Tempo.configure(...) first
PythonRuntimeError[Tempo] no config is applied yet; call Tempo.configure(...) first
C++std::logic_error[Tempo] no config is applied yet; call Tempo::configure(...) first

configure also indexes the field for both alliances. If that fails it prints [Tempo] field prebake skipped: {reason} and configuration continues.

Drivetrain

The first four arguments of configure are methods of the drivetrain:

ArgumentJavaPythonC++
poseSupplier<Pose2d>returns a Pose2dstd::function<frc::Pose2d()>
resetConsumer<Pose2d>takes a Pose2dstd::function<void(const frc::Pose2d&)>
speedsSupplier<ChassisSpeeds>returns ChassisSpeedsstd::function<std::optional<frc::ChassisSpeeds>()>
runConsumer<ChassisSpeeds>takes ChassisSpeedsstd::function<void(const frc::ChassisSpeeds&)>

pose returns the robot’s pose on the field. reset resets the pose estimator for routes that reset odometry. speeds returns the measured robot-relative speeds. run applies robot-relative ChassisSpeeds, and zero speeds must stop the robot.

Tempo reads pose and speeds every loop while a route runs. run receives speeds every loop while a route drives, and zero speeds when the route ends or is canceled. Tempo doesn’t call run while an arriveWith command drives, and a route that ends moving into the next drive of its Setlist (Join speed) sends no zero.

When a route starts, or after an arriveWith handover, the first speeds Tempo sends continue from the measured speeds. A loop where speeds returns no value (null in Java, None in Python, an empty std::optional in C++) or a value that isn’t finite is treated as unmeasured.

If one of these methods or the alliance check throws as a route starts, that drive fails and the auto continues.

Pose reset

Tempo calls reset when a route with resetOdometry(true) starts, and the robot holds still until pose shows the reset. That can take a few loops when odometry runs on its own thread or pose returns a snapshot refreshed in periodic.

  • The reset has shown once pose returns a pose within 0.15 m and 10 degrees of the route’s start.
  • It has also shown once pose returns a pose that moved more than that from the one it returned before the reset, like when vision pulls the estimate right after the reset. The route then starts from that pose.
  • If neither has happened after 0.5 s, the route drives from the pose pose returns. Tempo prints a warning that starts [Tempo] the pose getter still reported, and its warning code is poseReset.

Running without the scheduler

JavaPythonC++Behavior
update()update()update()Runs one loop of the auto that start() began (starting an auto ends the one already running), and pre-plans the chooser’s pick while disabled
stop()stop()stop()Ends the started auto as interrupted, and the route stops the robot

Call update() from robotPeriodic() and stop() from disabledInit(). A hook can call cancel(), start() or Tempo.stop(), and the call takes effect after that loop. The guide is Schedule and cancel.

Warm-up (Java)

Java
Tempo.warmup();                           // in simulation, or to warm again later
Command warm = Tempo.warmupCommand();     // the same work as a command to schedule

On the robot, Tempo starts the warm-up once it’s configured and the drivetrain is connected, and stops it when the robot is enabled. It runs temporary routes on a background thread while disabled, so the JIT has compiled the code the first auto runs. It requires no subsystems and sends no output. With warmWhileDisabled(false) on the PlanningConfigs, Tempo doesn’t start it.

warmup() returns at once, and a call made while the boot warm-up runs doesn’t do the work twice. On a command-based robot the scheduler runs the warm-up, so the scheduler must keep running while disabled.

Warm-up (Python)

Python
Tempo.warmup()  # robotInit, after configuration

Python doesn’t start the warm-up on its own, so call it once. It runs temporary routes on a background thread, and the imports, native calls and planner setup happen while the robot is disabled instead of when the first auto starts. It returns at once, requires no subsystems and sends no output.

C++ has no boot warm-up call. A picked auto is warmed with its warmup() (Warm up while disabled).

Alliance

The alliance comes from the optional isRedAlliance argument of configure (is_red_alliance in Python and C++), or the Driver Station without one. See Alliance for each language.

Point to point

Java
driver.a().whileTrue(Tempo.to(REEF_G).command());
Python
driver.a().whileTrue(Tempo.to(REEF_G).command())
C++
driver.A().WhileTrue(tempo::wpi::command(tempo::Tempo::to(REEF_G)));

to starts a Composer with no start pose, and each run plans from the robot’s pose as it starts.

RobotPy 2027 alpha-7 and beyond spell the binding while_true.

  • It takes a Pose2d, a Translation2d, (x, y) or (x, y, heading), each with an optional trailing Bias. Java takes the heading as a Rotation2d, Python as radians or a Rotation2d, and C++ as radians.
  • It also takes a supplier of a pose or point, which is read once as the run starts. If the supplier returns no target or throws, the drive fails without moving the robot, and no exception reaches the robot loop.
  • Fixed targets mirror with the route’s alliance. A supplier’s answer is in the field frame and never mirrors.
  • resetOdometry(true) on such a route throws when the route freezes.

The guide is Point to point.

Registries and tests

extensions() holds the named extensions, and commands() holds the footprint effect bound to each command. An empty cell means the language has no such method.

JavaPythonC++Returns or does
extensions()extensions()extensions()The named-extension registry
commands()commands()commands()The command-effect registry
composer(Pose2d)composer(pose), composer(x, y, heading_rad)composer(pose)Composer.startAt(pose)
coroutine(body, requirements...)Java only. A Commands v3 body for any hook or step (Commands v3)
configureForTesting(config, path)Java only. Installs the config with the pack file at path, no discovery and no drivetrain
resetForTesting()reset_for_testing()reset_for_testing()Clears the config, pack, registries, registered autos and logging consumers
Java
@BeforeEach
void setUp() {
    Tempo.resetForTesting();
    Tempo.configureForTesting(TEST_CONFIG, PACK_PATH);   // absolute path to a pack file
}
Python
def setup_function():
    Tempo.reset_for_testing()
    Tempo.configure(CONFIG.with_game_pack(GamePack.load(PACK_PATH)))
C++
tempo::Tempo::reset_for_testing();
tempo::Tempo::configure(tempo::TempoConfig{kConfig}.with_game_pack(tempo::GamePack::load(PACK_PATH)));

Only Java has configureForTesting. Python and C++ pass the loaded pack to with_game_pack(...) and call the config-only configure.

The reset clears logging too, so a test that reads Tempo’s logging builds its TempoLogging chain and calls apply() again after it.

resetForTesting() (reset_for_testing() in Python and C++) and Java’s configureForTesting() are for tests. Don’t call them from robot code.

esc

Loading search...