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.
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);from tempo import Alliance, Composer
route = (Composer.start_at(START_CENTER)
.origin_alliance(Alliance.BLUE) # or Alliance.RED, Alliance.NEUTRAL
.to(REEF_G))#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);| Value | The route mirrors when the runtime alliance is |
|---|---|
BLUE (default) | RED |
RED | BLUE |
NEUTRAL | Never. 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.
| Java | Python | C++ | |
|---|---|---|---|
| Default | Alliance.fromDriverStation() | Alliance.from_driver_station() | The Driver Station after tempo::wpi::configure(...), otherwise Blue |
| Set it | Tempo.configure(..., config, isRedAlliance, subsystem) | Tempo.configure(..., config, is_red_alliance, subsystem) | tempo::wpi::configure(..., config, is_red_alliance, {this}) |
| What Tempo reads | The route runs as |
|---|---|
| The check returns true | RED |
| The check returns false | BLUE |
| No check, and the Driver Station reports an alliance | That alliance |
| No check, and the Driver Station reports no alliance | BLUE |
No check on a C++ robot set up without tempo::wpi::configure(...) | Blue |
Tempo.configure(this::getPose, this::resetPose, this::getRobotRelativeSpeeds,
this::driveRobotRelative, CONFIG,
AllianceFlipUtil::shouldFlip, this);Tempo.configure(self.get_pose, self.reset_pose, self.get_robot_relative_speeds,
self.drive_robot_relative, CONFIG,
AllianceFlipUtil.should_flip, self)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(...)readsfrc::DriverStation::GetAlliance()on 2026 andwpi::MatchState::GetAlliance()on 2027. It answersRedonly when the Driver Station reports red.- The core
tempo::Tempo::configure(...)andtempo::wpi::Setlist::configure(...), which tests use to bind a drivetrain without installing a config, don’t read it, so every route resolves toBlueunlesstempo::Tempo::configure(config, is_red_alliance)gave a check.