4.15 Arrival
arrival(...) sets whether the robot carries speed through a waypoint, stops
there, or stops and waits. It applies to the leg it follows and every later leg
until changed.
import static edu.wpi.first.units.Units.Seconds;
import com.tempo.Arrival;
import com.tempo.Composer;
Composer.startAt(start)
.to(a)
.arrival(Arrival.through(0.9)) // carry up to 90 percent
.to(b)
.arrival(Arrival.pause(Seconds.of(0.5))) // stop, wait 0.5 s
.to(c)
.arrival(Arrival.STOP);from tempo import Arrival, Composer
(Composer.start_at(start)
.to(a)
.arrival(Arrival.through(0.9)) # carry up to 90 percent
.to(b)
.arrival(Arrival.pause(0.5)) # stop, wait 0.5 s
.to(c)
.arrival(Arrival.STOP))#include <tempo/Arrival.h>
#include <tempo/Composer.h>
tempo::Composer::start_at(start)
.to(a)
.arrival(tempo::Arrival::through(0.9)) // carry up to 90 percent
.to(b)
.arrival(tempo::Arrival::pause(0.5)) // stop, wait 0.5 s
.to(c)
.arrival(tempo::Arrival::Stop());Values
| Java and Python | C++ | Behavior |
|---|---|---|
Arrival.THROUGH (default) | Arrival::Through() | Keep moving through the waypoint, at up to the full carry speed |
Arrival.through(fraction) | Arrival::through(fraction) | The same, with the carry speed capped at fraction, in (0, 1] |
Arrival.STOP | Arrival::Stop() | Stop at the target. The next leg starts from rest |
Arrival.pause(duration) | Arrival::pause(seconds) | Stop, then wait before the next leg (Java Time, seconds in Python and C++, nonnegative) |
A fraction outside (0, 1] or a negative wait throws IllegalArgumentException,
ValueError or std::invalid_argument. A route run on its own stops at its last waypoint
whatever arrival is set there. In a Setlist, a through last waypoint can carry speed into
the next drive (Join speed). A pause on the last
waypoint isn’t waited out.
Carry speed
The carry speed is the speed the robot keeps through a waypoint between two legs that are planned separately.
- It’s at most the
throughfraction of the smaller of the two legs’ maximum velocities. - The corner at the waypoint is rounded, and the carry speed drops to what that curve allows under the centripetal limit. An end velocity above zero on the leg into the waypoint also caps it.
- A corner beside a leg with an
aimTargetisn’t rounded. The carry speed is multiplied by the cosine of the turn, so a corner of 90 degrees or more carries none. - The robot stops at the waypoint when the corner nearly reverses direction (about 175 degrees or more), when rounding it is no faster than stopping, or when no rounded path clears the field.
- The robot also stops at the waypoint when the leg into it has a
runAfter, awaitUntilor anarriveWith, when the leg out of it has arunBefore, or when either leg has a terrain crossing target with a heading.
A through corner that carries no speed prints
[Tempo] arrival(through) carries no speed into leg N: ... with the reason. When
the leg into the waypoint is too short to reach the carry speed, through(f)
may change nothing and Tempo prints
[Tempo] arrival(through) may shape nothing at leg N: .... Each line prints once
for a route.
When consecutive legs are planned together as one planning unit, the path’s curvature sets the speed at the waypoint instead (Which legs share a plan).
During a pause the robot doesn’t move or turn, so an aim doesn’t turn it until the next leg starts.
Junction
Each Arrival holds a Junction. No Composer method takes a Junction, so
routes pass an Arrival.
Arrival | Java and Python Junction | C++ tempo::Junction |
|---|---|---|
THROUGH | smooth(1.0) | smooth(1.0) |
through(f) | smooth(f) | smooth(f) |
STOP | STOP | stop() |
pause(t) | wait(t) | wait(t) |
Junction.SMOOTH is smooth(0.7), which no Arrival constant uses. C++ has no
SMOOTH constant, and Junction::smooth() with no argument is 0.7.