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

Each run of a Composer route goes through the phases on this page. A TempoAuto runs them, but robot code doesn’t build one and no supported call returns one. Java robot code reads a route’s status from the RouteHandle that Composer.handle() returns, and every language reads it through logging.

Phases

These are the phases Java’s RouteHandle.phase() returns. The state logging item reports the same phases in every language as State/Phase, spelled notStarted, preBlocking, driving, handedOff, postBlocking, waiting, done and cancelled.

NOT_STARTED
    |  the route's command starts
    v
PRE_BLOCKING   runBefore commands run; robot stopped
    |  every runBefore command has finished
    v
DRIVING        following the trajectory
    |  the leg arrives, fails or ends on endWhen
    |
    |  arriveWith legs only, at the arriveWith fraction or on arrival:
    |    HANDED_OFF   the arriveWith command drives; Tempo commands nothing
    |    until that command ends, the leg's give-up time, or endWhen
    v
POST_BLOCKING  runAfter commands run; robot stopped
    |  every runAfter command has finished
    v
WAITING        an Arrival.pause(t), or the next leg waiting for its plan; robot stopped
    |  the pause ends or the plan is ready
    v
next leg, or DONE when every leg is done (RouteHandle.phase() then reads CANCELLED)

CANCELLED from any phase when the run is canceled
  • A leg with no runBefore starts in DRIVING, and one with no runAfter and no pause skips POST_BLOCKING and WAITING.
  • Progress and zone triggers fire only while driving, but match-time triggers also fire in blocking phases.

A leg ends once the robot is inside its arrival tolerance of the planned end, with the waits listed under Missed arrivals, which also covers a leg that ends outside the tolerance. Heading counts only on a leg with an end heading, and a pose with a NaN coordinate never arrives. SimRun uses the same test.

Warning A finished run reads CANCELLED

RouteHandle.phase() reads CANCELLED after every run, including one that finished normally. The logged State/Phase stays done after a clean finish and reads cancelled only for a run ended early. On the handle, droveEveryLeg() says no leg has been skipped so far, and arrivedEveryLeg() also says none has been missed, so both stay true for a run interrupted partway. Read them once State/Phase is done, or use the arrivals and giveUps logging items. An arrival’s reached is stricter than arrivedEveryLeg().

Each loop

The route’s command reads the pose and sends robot-relative ChassisSpeeds (ChassisVelocities on 2027) every 20 ms loop. It sends zero speeds in PRE_BLOCKING, POST_BLOCKING and WAITING. A robot still moving when a leg starts waiting for its plan slows to a stop at the leg’s acceleration limit first. In HANDED_OFF Tempo sends nothing and the arriveWith command drives.

What robot code can read while the route runs (a segment in a method name is a leg):

ReadingJava route.handle()Logging item
Phasephase()state
Current legprogress(nowS)state
Planned pose for this loopexpectedPose(nowS)plannedPose
Driving but not progressing (Stalls)wedged()
Replansreplans(), replanFailed()replans
Legs skipped or missedskippedSegments(), missedSegments()giveUps, arrivals

nowS is WPILib’s Timer.getTimestamp(). progress returns the current leg, the leg count and the seconds since the auto started. expectedPose returns the planned pose for that time, or null when the route isn’t driving.

TempoCommand

TempoCommand (com.tempo.wpi, tempo.wpi, <tempo/wpi/TempoCommand.h>) is a public command class, but its constructor needs a TempoAuto and robot code has no way to build one. Use the WPILib Command that Composer.command() and Setlist.command() return (tempo::wpi::command(route) and tempo::wpi::Setlist::command(setlist) in C++). In Java that command isn’t a TempoCommand, so a cast fails.

Named poses

Pose (com.tempo.wpi, tempo.wpi, <tempo/wpi/Pose.h>) keeps named poses in src/main/deploy/tempo-poses.json in Java and C++ and deploy/tempo-poses.json in Python.

JavaPythonC++Behavior
Pose.at(x, y)Pose.at(x, y)Pose::At(x, y)A pose in meters with heading 0. Chain heading(rad) or headingDeg(deg) (heading_deg in Python, Heading and HeadingDeg in C++)
Pose.named(name)Pose.named(name)Pose::Named(name)Looks up a pose. An unknown name throws, and the message lists the known names
Pose.capture(name, pose)Pose.capture(name, pose)Pose::Capture(name, pose)Saves a pose and prints [Tempo] captured pose ...
Pose.captureCommand(poseSupplier, nameSupplier)Pose.capture_command(pose_supplier, name_supplier)Java and Python only. A command that captures when scheduled, including while disabled

In simulation the file persists, but on the robot a capture lasts until the next deploy.

esc

Loading search...