4.2 Configuration
Start a config with new TempoConfig() (TempoConfig() in Python,
tempo::TempoConfig{} in C++) and chain with calls onto it in any order. Pass it to
Tempo.configure(...).
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))
.withLimits(new LimitsConfigs().maxVelocity(MetersPerSecond.of(4.0)))
.withReplanning(new ReplanningConfigs().drift(Sensitivity.HIGH))
.withPID(8.0, 6.0)
.withTerrain(new TerrainConfigs().cap("bumpLeft", 2.0))
.withPlanning(new PlanningConfigs().preplanAhead(2))
.withTolerance(0.05, 0.05);from tempo import (BumperConfigs, LimitsConfigs, PlanningConfigs, ReplanningConfigs,
Sensitivity, SwerveModules, TempoConfig, TerrainConfigs)
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))
.with_limits(LimitsConfigs().max_velocity(4.0))
.with_replanning(ReplanningConfigs().drift(Sensitivity.HIGH))
.with_pid(8.0, 6.0)
.with_terrain(TerrainConfigs().cap("bumpLeft", 2.0))
.with_planning(PlanningConfigs().preplan_ahead(2))
.with_tolerance(0.05, 0.05))#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))
.with_limits(tempo::LimitsConfigs{}.max_velocity(4.0))
.with_replanning(tempo::ReplanningConfigs{}.drift(tempo::Sensitivity::High))
.with_pid(8.0, 6.0)
.with_terrain(tempo::TerrainConfigs{}.cap("bumpLeft", 2.0))
.with_planning(tempo::PlanningConfigs{}.preplan_ahead(2))
.with_tolerance(0.05, 0.05);tempo::DcMotor::kraken_x60_foc() is Tempo’s own motor type for one motor, so it
takes no count.
RobotPy 2027 alpha-7 and beyond spell the motor DCMotor.kraken_x60_foc(1)
(2026 vs 2027).
A swerve robot only needs withModule, withMass and withModuleOffsets. Every other
setting has a default.
| Java | Python and C++ | Sets | Required |
|---|---|---|---|
withModule(module) | with_module(module) | The swerve module, from a preset or new ModuleConfigs() | One drivetrain |
withTank(tank) | with_tank(tank) | A tank drivetrain | One drivetrain |
withMecanum(mecanum) | with_mecanum(mecanum) | A mecanum drivetrain | One drivetrain |
withModuleOffsets(frontLeft, frontRight, backLeft, backRight) | with_module_offsets(front_left, front_right, back_left, back_right) | Where each swerve module is, as four Translation2d or one array | Swerve, to derive limits |
withMass(mass) | with_mass(mass) | Robot mass, kg | Tank, and swerve to derive limits |
withFrame(width, length) | with_frame(width, length) | Frame size without bumpers, m | Mecanum and tank need this or withFootprint. Swerve falls back to its offsets |
withBumpers(bumpers) | with_bumpers(bumpers) | The bumpers. Leave it out for none | Optional, needs withFrame |
withFootprint(outline) | with_footprint(outline) | A whole custom outline, bumpers included, in place of frame and bumpers | Optional |
withLimits(limits) | with_limits(limits) | The speed and acceleration caps | Mecanum, and swerve without mass or module offsets |
withMeasured(measured) | with_measured(measured) | Limits measured on the robot by the calibration routines | Optional |
withPID(translation, rotation) | with_pid(translation, rotation) | Path-following PID gains | Optional |
withTunablePID(translation, rotation) | with_tunable_pid(translation, rotation) | Two suppliers of PIDConstants, for tunable kP, kI and kD | Optional |
withTolerance(translation, rotation) | with_tolerance(translation, rotation) | How close counts as arrived, m and rad | Optional |
withLag(seconds) | with_lag(seconds) | How far the follower leads its commands, s | Optional |
withObstacleMargin(meters) | with_obstacle_margin(meters) | Extra space kept from obstacles, m | Optional |
withPlanning(planning) | with_planning(planning) | Planning threads, disabled warm-up, plans kept ahead | Optional |
withReplanning(replanning) | with_replanning(replanning) | When and how a route replans | Optional |
withTerrain(terrain) | with_terrain(terrain) | Speed caps inside crossed terrain | Optional |
withGamePack(pack) | with_game_pack(pack) | A bundled pack, or one you loaded | Optional |
Tunable settings also take a plain SI supplier, so a LoggedTunableNumber goes in directly,
like .maxVelocity(kMaxV). Tempo reads a supplier 5 times a second, while a route runs and
while the selected auto is planned ahead.
Live tuning lists the settings that take one.
Units
A plain number is always SI (m, kg, s, A, m/s, m/s^2, rad, rad/s, rad/s^2 and Hz). Every setting with a unit also takes a WPILib unit.
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)))
.withMass(Pounds.of(125))
.withFrame(Inches.of(28), Inches.of(28))
.withTolerance(0.05, Degrees.of(3));from wpimath import units
CONFIG = (TempoConfig()
.with_module(SwerveModules.SDS.MK4i(SwerveModules.SdsMk4iGear.L2, DCMotor.krakenX60FOC(1), 60))
.with_mass(units.lbsToKilograms(125))
.with_frame(units.inchesToMeters(28), units.inchesToMeters(28))
.with_tolerance(0.05, units.degreesToRadians(3)))inline const tempo::TempoConfig kConfig = tempo::TempoConfig{}
.with_module(tempo::SwerveModules::SDS::MK4i(
tempo::SwerveModules::SdsMk4iGear::L2, tempo::DcMotor::kraken_x60_foc(), 60_A))
.with_mass(125_lb)
.with_frame(28_in, 28_in)
.with_tolerance(0.05, 3_deg);RobotPy’s units are plain floats, so Python takes the converted number. RobotPy 2027
alpha-8 spells the conversions in snake_case, as in
units.inches_to_meters(28). Tempo’s Distances.inches(...) and Angles.deg(...) work on
every year.
| Kind | Java | C++ example | Settings |
|---|---|---|---|
| Length | Distance | 3.25_in | withFrame, withObstacleMargin, withTolerance distance, wheelRadius, trackWidth, every bumper size, drift, RobotFootprint sizes |
| Mass | Mass | 125_lb | withMass |
| Time | Time | 40_ms | withLag, lag, steeringLag, blend |
| Current | Current | 80_A | Preset limits, statorCurrentLimit, supplyCurrentLimit |
| Speed | LinearVelocity | 4.5_mps | topSpeed, maxVelocity, defaultCap, cap, the speed in accelerationAt and turningAt |
| Acceleration | LinearAcceleration | 8.5_mps_sq | maxAcceleration, maxDeceleration, maxCentripetal, the acceleration in accelerationAt |
| Angle | Angle | 2_deg | withTolerance rotation |
| Turn rate | AngularVelocity | 9.5_rad_per_s | maxAngularVelocity, the rate in turningAt |
| Turn acceleration | AngularAcceleration | 30_rad_per_s_sq | maxAngularAcceleration, the acceleration in turningAt |
| Frequency | Frequency | 20_Hz | rate |
A call with several values takes all plain numbers or all units. withTolerance also takes
a plain distance with a unit angle. Module and wheel offsets take Translation2d, which
carries its own units. Gear ratio, grip, motor count, strafe efficiency, mecanum margin,
preplanAhead and PID gains have no unit.