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

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(...).

Java
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);
Python
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))
C++
#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.

JavaPython and C++SetsRequired
withModule(module)with_module(module)The swerve module, from a preset or new ModuleConfigs()One drivetrain
withTank(tank)with_tank(tank)A tank drivetrainOne drivetrain
withMecanum(mecanum)with_mecanum(mecanum)A mecanum drivetrainOne 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 arraySwerve, to derive limits
withMass(mass)with_mass(mass)Robot mass, kgTank, and swerve to derive limits
withFrame(width, length)with_frame(width, length)Frame size without bumpers, mMecanum and tank need this or withFootprint. Swerve falls back to its offsets
withBumpers(bumpers)with_bumpers(bumpers)The bumpers. Leave it out for noneOptional, needs withFrame
withFootprint(outline)with_footprint(outline)A whole custom outline, bumpers included, in place of frame and bumpersOptional
withLimits(limits)with_limits(limits)The speed and acceleration capsMecanum, and swerve without mass or module offsets
withMeasured(measured)with_measured(measured)Limits measured on the robot by the calibration routinesOptional
withPID(translation, rotation)with_pid(translation, rotation)Path-following PID gainsOptional
withTunablePID(translation, rotation)with_tunable_pid(translation, rotation)Two suppliers of PIDConstants, for tunable kP, kI and kDOptional
withTolerance(translation, rotation)with_tolerance(translation, rotation)How close counts as arrived, m and radOptional
withLag(seconds)with_lag(seconds)How far the follower leads its commands, sOptional
withObstacleMargin(meters)with_obstacle_margin(meters)Extra space kept from obstacles, mOptional
withPlanning(planning)with_planning(planning)Planning threads, disabled warm-up, plans kept aheadOptional
withReplanning(replanning)with_replanning(replanning)When and how a route replansOptional
withTerrain(terrain)with_terrain(terrain)Speed caps inside crossed terrainOptional
withGamePack(pack)with_game_pack(pack)A bundled pack, or one you loadedOptional

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.

Java
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));
Python
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)))
C++
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.

KindJavaC++ exampleSettings
LengthDistance3.25_inwithFrame, withObstacleMargin, withTolerance distance, wheelRadius, trackWidth, every bumper size, drift, RobotFootprint sizes
MassMass125_lbwithMass
TimeTime40_mswithLag, lag, steeringLag, blend
CurrentCurrent80_APreset limits, statorCurrentLimit, supplyCurrentLimit
SpeedLinearVelocity4.5_mpstopSpeed, maxVelocity, defaultCap, cap, the speed in accelerationAt and turningAt
AccelerationLinearAcceleration8.5_mps_sqmaxAcceleration, maxDeceleration, maxCentripetal, the acceleration in accelerationAt
AngleAngle2_degwithTolerance rotation
Turn rateAngularVelocity9.5_rad_per_smaxAngularVelocity, the rate in turningAt
Turn accelerationAngularAcceleration30_rad_per_s_sqmaxAngularAcceleration, the acceleration in turningAt
FrequencyFrequency20_Hzrate

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.

esc

Loading search...