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

4.23 Alliance

originAlliance states which alliance a route’s coordinates were written for. START_CENTER and REEF_G are the poses from Write the first auto.

Java
import com.tempo.Alliance;
import com.tempo.Composer;

var route = Composer.startAt(START_CENTER)
    .originAlliance(Alliance.BLUE)          // or Alliance.RED, Alliance.NEUTRAL
    .to(REEF_G);
Python
from tempo import Alliance, Composer

route = (Composer.start_at(START_CENTER)
    .origin_alliance(Alliance.BLUE)         # or Alliance.RED, Alliance.NEUTRAL
    .to(REEF_G))
C++
#include <tempo/Tempo.h>

auto route = tempo::Composer::start_at(START_CENTER)
    .origin_alliance(tempo::Alliance::Blue)  // or Alliance::Red, Alliance::Neutral
    .to(REEF_G);
ValueThe route mirrors when the runtime alliance is
BLUE (default)RED
REDBLUE
NEUTRALNever. The coordinates are used as written on both alliances

Set originAlliance (origin_alliance) before the route’s first use freezes it. Alliance flipping covers how mirroring works.

  • A target returned by a supplier is in the field frame and never mirrors.
  • A direct Replanner takes an alliance argument but never mirrors.
  • Planning always includes both alliances’ obstacles and every switched-on avoid zone, whichever alliance the robot is on.

Runtime alliance

The runtime alliance comes from the optional alliance check given to configure, or the Driver Station without one. A route reads it when it’s pre-planned and again when it starts, and keeps that value until it ends.

JavaPythonC++
DefaultAlliance.fromDriverStation()Alliance.from_driver_station()The Driver Station after tempo::wpi::configure(...), otherwise Blue
Set itTempo.configure(..., config, isRedAlliance, subsystem)Tempo.configure(..., config, is_red_alliance, subsystem)tempo::wpi::configure(..., config, is_red_alliance, {this})
What Tempo readsThe route runs as
The check returns trueRED
The check returns falseBLUE
No check, and the Driver Station reports an allianceThat alliance
No check, and the Driver Station reports no allianceBLUE
No check on a C++ robot set up without tempo::wpi::configure(...)Blue
Java
Tempo.configure(this::getPose, this::resetPose, this::getRobotRelativeSpeeds,
    this::driveRobotRelative, CONFIG,
    AllianceFlipUtil::shouldFlip, this);
Python
Tempo.configure(self.get_pose, self.reset_pose, self.get_robot_relative_speeds,
                self.drive_robot_relative, CONFIG,
                AllianceFlipUtil.should_flip, self)
C++
tempo::wpi::configure(
    [this] { return GetPose(); },
    [this](const frc::Pose2d& pose) { ResetPose(pose); },
    [this] { return GetRobotRelativeSpeeds(); },
    [this](const frc::ChassisSpeeds& speeds) { RunVelocity(speeds); },
    kConfig,
    AllianceFlipUtil::ShouldFlip,
    {this});

fromDriverStation() (from_driver_station()) returns BLUE before the Driver Station connects and in tests without one, so BLUE doesn’t confirm the side you were assigned.

is_red_alliance takes any callable with no arguments.

C++

The C++ core has no WPILib dependency, so it can’t read the Driver Station itself:

  • tempo::wpi::configure(...) reads frc::DriverStation::GetAlliance() on 2026 and wpi::MatchState::GetAlliance() on 2027. It answers Red only when the Driver Station reports red.
  • The core tempo::Tempo::configure(...) and tempo::wpi::Setlist::configure(...), which tests use to bind a drivetrain without installing a config, don’t read it, so every route resolves to Blue unless tempo::Tempo::configure(config, is_red_alliance) gave a check.
esc

Loading search...