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

4.14 Speed

speed(level) sets a leg’s limits from the robot’s hardware and limits(...) sets them as numbers. Both apply to the next to(...) and every later leg until changed, and the later call replaces the earlier one. Without either one every leg runs at Speed.FULL. In this example the legs to a and b use the numbers, and the leg to c runs at CAREFUL without them.

Java
import com.tempo.Speed;

var route = Composer.startAt(start)
    .limits(3.5, 4.0, 6.0)
    .to(a)
    .to(b)
    .speed(Speed.CAREFUL)
    .to(c);
Python
from tempo import Speed

route = (Composer.start_at(start)
    .limits(3.5, 4.0, 6.0)
    .to(a)
    .to(b)
    .speed(Speed.CAREFUL)
    .to(c))
C++
#include <tempo/Speed.h>

auto route = tempo::Composer::start_at(start)
    .limits(3.5, 4.0, 6.0)
    .to(a)
    .to(b)
    .speed(tempo::Speed::Careful)
    .to(c);

Speed levels

C++ spells them Full, Careful, Half and Crawl.

LevelWith a drivetrain model: rated velocity / drive current / gripWithout one: velocity / acceleration / centripetal
FULL1.00 / 1.00 / 1.001.00 / 1.00 / 1.00
CAREFUL0.95 / 0.85 / 0.900.80 / 0.50 / 0.71
HALF0.50 of every FULL limit0.50 / 0.50 / 0.50
CRAWL0.25 of every FULL limit0.25 / 0.25 / 0.25

A drivetrain model is a swerve module or differential configuration with motor, current limit and wheel data. With one, FULL and CAREFUL each take the table’s share of the rated velocity, the drive current limit and the grip, and the limits are worked out from those (Limits Tempo derives). Limits set in the config stay ceilings.

A level whose share of the current can’t overcome the drivetrain’s losses throws Drive current budget cannot overcome calibrated drivetrain losses at 12 V.

HALF and CRAWL scale every FULL limit, the turn limits included. They have no current share of their own, so they work wherever FULL does.

speed(level) is worked out again each time Tempo builds the route, so it follows a live speed limit in the config. A slower level doesn’t change the arrival tolerance.

MemberReturns
constraints()The level’s limits for the active config. Throws before Tempo.configure(...)
of(config)The level’s limits for a TempoConfig
of(ceiling)The level’s fractions applied to a TrajectoryConstraints
velocityFraction(), accelerationFraction()The level’s fractions

Python’s of(...) takes either a TempoConfig or a TrajectoryConstraints, and velocity_fraction and acceleration_fraction are properties.

C++ resolves with tempo::speed_of(level, config) or tempo::speed_of(level, ceiling).

TrajectoryConstraints

Java
import com.tempo.TrajectoryConstraints;

var limits = new TrajectoryConstraints(3.5, 4.0, 6.0, 0.0, 0.0);
var turnLimited = new TrajectoryConstraints(3.5, 4.0, 6.0, 0.0, 0.0, 12.0, 4.0, 8.0);
route.limits(turnLimited);
Python
from tempo import TrajectoryConstraints

limits = TrajectoryConstraints(3.5, 4.0, 6.0, 0.0, 0.0)
turn_limited = TrajectoryConstraints(3.5, 4.0, 6.0, 0.0, 0.0, 12.0, 4.0, 8.0)
route.limits(turn_limited)
C++
tempo::TrajectoryConstraints limits{3.5, 4.0, 6.0, 0.0, 0.0};
tempo::TrajectoryConstraints turn_limited{3.5, 4.0, 6.0, 0.0, 0.0, 12.0, 4.0, 8.0};
route.limits(turn_limited);
PositionFieldUnitsRule
1Maximum velocitym/sfinite, positive
2Maximum accelerationm/s^2finite, positive
3Maximum centripetal accelerationm/s^2finite, positive
4Start velocitym/sfinite, nonnegative
5End velocitym/sfinite, nonnegative
6, optionalModule steer rate. 0 means no caprad/sfinite, nonnegative
7, optionalChassis angular velocity. 0 uses the robot caprad/sfinite, nonnegative
8, optionalChassis angular acceleration. 0 uses the robot caprad/s^2finite, nonnegative

Java has five-, six- and eight-argument constructors.

Python and C++ default omitted trailing fields to 0.

In Java and C++, TrajectoryConstraints.defaults() (TrajectoryConstraints::defaults()) is 5 m/s velocity, 6 m/s^2 acceleration and 8.1 m/s^2 centripetal with every other field 0.

Python has no defaults().

The start velocity is used on the route’s first leg and the end velocity on its last. Between legs the arrival sets the speed. The robot is at rest at a STOP or pause, and at the carry speed at a through waypoint. An end velocity above zero on the arriving leg caps the carry speed. In a Setlist, a route entered or left moving uses the join speed at that end.

Composer formSets
limits(v, a, c)Fields 1 to 3. Start and end velocities 0, no steer cap, robot angular caps
limits(v, a, c, omega, alpha)Fields 1 to 3, then chassis angular velocity (rad/s) and acceleration (rad/s^2), fields 7 and 8, as arguments 4 and 5. The start and end velocities stay 0
limits(constraints)Every field

Fields 1 to 3 can only lower the robot’s Speed.FULL limits. A larger value is lowered to Speed.FULL’s, and the route prints a line naming it the first time it freezes. Fields 7 and 8 can only lower the robot’s turn caps.

An invalid value throws IllegalArgumentException, ValueError or std::invalid_argument naming the field. Java also checks in the constructor, and Python and C++ check when limits(...) receives it.

esc

Loading search...