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

4.8 Replanning

ReplanningConfigs sets when a route replans and what a replan aims for. Pass it to withReplanning(...). drift, rate and blend also take a plain SI supplier (Live tuning). A leg sets its own policy with Composer.replanning(...) or noReplanning(), which takes the same group.

ReplanningConfigs

Java
import static edu.wpi.first.units.Units.Hertz;
import static edu.wpi.first.units.Units.Meters;
import static edu.wpi.first.units.Units.Seconds;

import com.tempo.config.ReplanningConfigs;
import com.tempo.config.Sensitivity;

ReplanningConfigs replanning = new ReplanningConfigs()
    .drift(Sensitivity.HIGH)            // or Sensitivity.LOW, or Meters.of(0.4)
    .rate(Hertz.of(8))
    .blend(Seconds.of(0.3))
    .openingFirst(true);

ReplanningConfigs.off();                // never replan
Python
from tempo import ReplanningConfigs, Sensitivity

replanning = (ReplanningConfigs()
    .drift(Sensitivity.HIGH)            # or Sensitivity.LOW, or 0.4 (meters)
    .rate(8.0)                          # Hz
    .blend(0.3)                         # s
    .opening_first(True))

ReplanningConfigs.off()                 # never replan
C++
auto replanning = tempo::ReplanningConfigs{}
    .drift(tempo::Sensitivity::High)      // or Sensitivity::Low, or 0.4 (meters)
    .rate(8.0)                            // Hz
    .blend(0.3)                           // s
    .opening_first(true);

tempo::ReplanningConfigs::off();          // never replan
JavaPython / C++DefaultRange
new ReplanningConfigs()ReplanningConfigs(), tempo::ReplanningConfigs{}Drift replanning on
ReplanningConfigs.off()ReplanningConfigs.off()Never replans
drift(Sensitivity)drift(s)Derived thresholdHIGH halves it, LOW doubles it
drift(meters), drift(Distance)drift(m)Derived thresholdPositive
rate(hz), rate(Frequency)rate(hz)10 Hz (0.10 s apart)Positive
blend(seconds), blend(Time)blend(s)0.25 s0 or more
openingFirst(boolean)opening_first(b)false
mode(ReplanMode)mode(m)REJOIN_PATH (RejoinPath in C++)REJOIN_PATH, NEW_PATH
  • The drift threshold is the tracking error that starts a replan. The derived value is max(3 * translation tolerance, 0.4 * footprint circumradius) in meters.
  • rate is the most replans a leg makes per second. blend is how long the command blends from the old plan into the new one.
  • On a leg, a drift, rate or blend supplier is read once, when the route first freezes. Settings the leg doesn’t name follow the robot’s live values each time the route is built.
  • openingFirst(true) plans the first 3 m of a leg longer than 8 m, drives it, and switches to the whole leg when that plan is ready. You probably won’t need this, because Tempo plans the auto picked on the chooser while the robot is disabled. In a SimRun and a standalone Replanner it also makes that leg’s replans on a worker thread instead of in the tick.
  • With the default REJOIN_PATH, a replan after drift, after falling behind schedule or after a pose jump returns to the planned path ahead of the robot. With mode(ReplanMode.NEW_PATH) it plans a new path to the leg’s target.
  • Ahead of a crossing whose target has a heading, a REJOIN_PATH replan plans to the leg’s target until the path’s turn toward that heading is finished. The turn counts as unfinished while the path’s heading at the robot’s position is more than 0.05 rad from both the crossing’s heading and the robot’s heading.

If the robot replans too often, raise drift or lower rate. A longer blend is smoother, but the robot stays on the old path longer near obstacles.

Replanning covers when each kind of replan runs.

ReplanSettings

ReplanSettings is the type that holds the resolved values: whether replanning is on, the tracking-error threshold, the time between replans, the blend time, the openingFirst flag and the mode. ReplanSettings names that flag asyncReplan in Java and async_replan in Python and C++.

  • settings() on ReplanningConfigs returns the authored values, before they’re scaled against a robot.
  • resolveAgainst(config) (resolve_against) on ReplanningConfigs returns them resolved against a TempoConfig. C++ takes the robot’s ReplanSettings there.
  • Tempo.config().replanSettings() (replan_settings in Python, the replan field in C++) returns the values resolved for the installed robot.
  • ReplanSettings.defaults() is a 0.25 m tracking-error threshold, 0.10 s between replans, a 0.25 s blend and REJOIN_PATH. These are the values before the threshold is derived from the robot.
  • ReplanSettings.mode(ReplanMode) (with_mode in Python and C++) returns a copy with another mode.
esc

Loading search...