4.3 TempoConfig
new TempoConfig() (TempoConfig() in Python, tempo::TempoConfig{} in C++) starts a
config, and each with call sets one thing on it. Every with call is listed on
Configuration.
Building a config
import com.tempo.config.*;
import com.tempo.config.SwerveModules.SdsMk4iGear;
import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.system.plant.DCMotor;
import static edu.wpi.first.units.Units.*;
public static final TempoConfig CONFIG = new TempoConfig()
.withModule(SwerveModules.SDS.MK4i(SdsMk4iGear.L2, DCMotor.getKrakenX60Foc(1), Amps.of(60)))
.withModuleOffsets(new Translation2d(0.3, 0.3), new Translation2d(0.3, -0.3),
new Translation2d(-0.3, 0.3), new Translation2d(-0.3, -0.3))
.withMass(Kilograms.of(55))
.withFrame(0.71, 0.71)
.withBumpers(new BumperConfigs().thickness(0.09));from tempo import BumperConfigs, SwerveModules, TempoConfig
from wpimath.system.plant import DCMotor
CONFIG = (TempoConfig()
.with_module(SwerveModules.SDS.MK4i(SwerveModules.SdsMk4iGear.L2, DCMotor.krakenX60FOC(1), 60.0))
.with_module_offsets((0.3, 0.3), (0.3, -0.3), (-0.3, 0.3), (-0.3, -0.3))
.with_mass(55.0)
.with_frame(0.71, 0.71)
.with_bumpers(BumperConfigs().thickness(0.09)))#include <tempo/SwerveModules.h>
#include <tempo/Tempo.h>
inline const tempo::TempoConfig kConfig = tempo::TempoConfig{}
.with_module(tempo::SwerveModules::SDS::MK4i(
tempo::SwerveModules::SdsMk4iGear::L2, tempo::DcMotor::kraken_x60_foc(), 60.0))
.with_module_offsets({{0.3, 0.3}, {0.3, -0.3}, {-0.3, 0.3}, {-0.3, -0.3}})
.with_mass(55.0)
.with_frame(0.71, 0.71)
.with_bumpers(tempo::BumperConfigs{}.thickness(0.09));RobotPy 2027 alpha-7 and beyond spell the motor DCMotor.kraken_x60_foc(1)
(2026 vs 2027).
Every call changes the config and returns it, so a call on its own line works too. The order
of the calls doesn’t matter, and when the same setter is called twice the last value is kept.
A group passed to a with call is copied, so changing the group afterward doesn’t change the
config.
Pass the config to Tempo.configure(...) once, before
you build any route. It copies the config and loads the game pack, so changing CONFIG
afterward does nothing until you configure again.
A bad single value throws on its own call. A problem with the whole config throws when the
config is resolved, which is when Tempo.configure(...) runs or a value is read from it, such
as constraints() (the constraints field in Python).
| Java | Python / C++ | Effect |
|---|---|---|
withPID(PIDConstants, PIDConstants), withPID(translationKp, rotationKp) | with_pid(...) | Follower gains, translation then rotation. The kP form also takes two suppliers |
withTunablePID(translation, rotation) | with_tunable_pid(translation, rotation) | Two suppliers of PIDConstants, for tunable kP, kI and kD |
withTolerance(m, rad), withTolerance(Distance, Angle), withTolerance(m, Angle) | with_tolerance(m, rad) | Arrival tolerance, 0.05 m and 3 deg by default. Both are finite and positive |
withLag(s), withLag(Time) | with_lag(s) | How far the follower leads its commands (Follower latency) |
withObstacleMargin(m), withObstacleMargin(Distance) | with_obstacle_margin(m) | The obstacle margin, the distance the planner prefers to keep beyond the body. 0.10 m by default |
| Error (Java text) | Cause |
|---|---|
TempoConfig needs one drivetrain: withModule, withTank or withMecanum | No drivetrain |
TempoConfig takes one drivetrain; got withModule and withTank | More than one drivetrain |
TempoConfig needs withMass beside withTank | A tank drivetrain without mass |
ModuleConfigs needs wheelRadius, motor, ratio and statorCurrentLimit; missing motor | A new ModuleConfigs() missing a required setting, named at the end |
TankConfigs needs left, right, topSpeed and trackWidth; missing trackWidth | A new TankConfigs() missing a required setting |
TankSideConfigs needs motor, ratio, wheelRadius and statorCurrentLimit; the left side is missing motor | A new TankSideConfigs() missing a required setting |
LimitsConfigs needs .maxAcceleration(...) beside .maxVelocity(...), or a drivetrain to take the acceleration from | Mecanum with a velocity cap alone |
LimitsConfigs needs .maxVelocity(...) beside .maxAcceleration(...), or a drivetrain to take the velocity from | Mecanum with an acceleration cap alone |
TempoConfig needs limits to plan with: withLimits, or withModule with withMass and withModuleOffsets, or withTank | No limits to plan with, as on mecanum with no withLimits |
TempoConfig needs the robot's outline: withFrame, withFootprint or withModuleOffsets | No outline, as on a mecanum or tank drive with no withFrame or withFootprint |
TempoConfig takes withFootprint or withFrame with withBumpers, not both | withFootprint with withFrame or withBumpers |
TempoConfig needs withFrame beside withBumpers | withBumpers with no frame |
with_game_pack got an empty GamePack, one that was moved from | C++: a GamePack that was moved from |
Python and C++ word these with their own call names, such as with_module and
.max_acceleration(...). C++ has one message for both LimitsConfigs cases:
LimitsConfigs needs .max_velocity(...) and .max_acceleration(...), or a drivetrain to take them from.
Game pack
Tempo.configure(...) loads a pack given to withGamePack(...) first, then tempo/game.toml in the deploy folder
(src/main/deploy for Java and C++, deploy beside robot.py), then the
default pack.
import com.tempo.GamePacks;
public static final TempoConfig CONFIG = new TempoConfig()
// ... the rest of the config
.withGamePack(GamePacks.REBUILT_2026);from tempo import GamePacks, TempoConfig
CONFIG = (TempoConfig()
# ... the rest of the config
.with_game_pack(GamePacks.REBUILT_2026))#include <tempo/GamePacks.h>
inline const tempo::TempoConfig kConfig = tempo::TempoConfig{}
// ... the rest of the config
.with_game_pack(tempo::GamePacks::kRebuilt2026);Load errors and the loaders are on GamePack.
Tolerances
public static final TempoConfig CONFIG = new TempoConfig()
// ... the rest of the config
.withTolerance(0.05, 0.05); // m, radCONFIG = (TempoConfig()
# ... the rest of the config
.with_tolerance(0.05, 0.05)) # m, radinline const tempo::TempoConfig kConfig = tempo::TempoConfig{}
// ... the rest of the config
.with_tolerance(0.05, 0.05); // m, radThe default arrival tolerance is 0.05 m and 3 deg (0.0524 rad), and both values must be
finite and positive. A leg overrides it with arriveWithin(...). The translation tolerance
also sets the derived replan threshold (Replanning).
Obstacle clearance
import static edu.wpi.first.units.Units.Meters;
public static final TempoConfig CONFIG = new TempoConfig()
// ... the rest of the config
.withObstacleMargin(Meters.of(0.12));CONFIG = (TempoConfig()
# ... the rest of the config
.with_obstacle_margin(0.12))inline const tempo::TempoConfig kConfig = tempo::TempoConfig{}
// ... the rest of the config
.with_obstacle_margin(0.12);The default obstacle margin is 0.10 m beyond the footprint, bumpers and extensions
included. The planner can leave less than the margin in a narrow opening, and the margin
adds no speed cap. Zero plans against the body alone, and a negative or non-finite value
throws [Tempo] obstacle margin must be finite and non-negative; got {value}. In Tempo’s GUI
it’s Preferred gap under Obstacle clearance.
withTolerance(...), withLag(...) and withObstacleMargin(...) also take a plain SI
supplier (Live tuning).
Reading a built config
Tempo.config() returns the installed config. Its Java accessors include:
| Accessor | Returns |
|---|---|
drivetrainType() | SWERVE, MECANUM or DIFFERENTIAL |
constraints() | The resolved TrajectoryConstraints |
footprint(), robotRadiusM() | The outline and its circumradius, m |
mecanum() | strafeEfficiency(), mecanumMargin(), wheelOffsets(), turnRadiusM(). Null for swerve and differential drives |
trackWidthM() | m for a differential drive, 0 otherwise |
maxAngularVelocityRadps(), maxAngularAccelerationRadps2() | The limits as configured, 0 when unset |
followerLatencyS() | s, 0 for none |
followerLatencyEstimated() | True when the latency was neither set nor calibrated. A route then leads by the lag it measures once that reads more than half a loop longer |
followerLatencyCalibrated() | True when the latency is the calibrated lag, with none set. A swerve then leads its direction by the calibrated steering lag |
defaultTranslationToleranceM(), defaultRotationToleranceRad() | Default arrival tolerance |
moduleConfig(), robotMassKg(), moduleOffsets() | Swerve hardware. Null or 0 from bare constraints |
In Python and C++ these are fields, and most are the Java name in snake_case. moduleOffsets() is module_offsets_m in both. C++ also spells three
differently: footprint_vertices for the outline, max_angular_velocity_rad_s and
max_angular_acceleration_rad_s2. In C++ Tempo::config() returns the resolved values as
a struct (mecanum is a std::optional<MecanumSettings>).