Trajectory¶
TimeOptimalParameterizer¶
TimeOptimalParameterizer(max_velocity: np.ndarray, max_acceleration: np.ndarray, knot_spacing: float = 0.1)
¶
Time-optimal path parameteriser with fixed joint limits.
The piecewise-linear path is resampled every knot_spacing and
joined by a cubic spline, and TOPP-RA finds the fastest velocity
profile along it that starts and ends at rest. The spline passes
through every waypoint and deviates from the straight segments by
about knot_spacing / 10, rounding the corners.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_velocity
|
ndarray
|
|
required |
max_acceleration
|
ndarray
|
|
required |
knot_spacing
|
float
|
Spline knot spacing along the path (path units). Smaller follows the corners more tightly, at the cost of slower cornering and more computation. |
0.1
|
Source code in autolife_planning/trajectory/toppra.py
parameterize(path: np.ndarray, velocity_scaling: float = 1.0, acceleration_scaling: float = 1.0) -> Trajectory
¶
Time-parameterize an (N, ndof) joint-space path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
ndarray
|
|
required |
velocity_scaling
|
float
|
Factor in |
1.0
|
acceleration_scaling
|
float
|
Factor in |
1.0
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If TOPP-RA finds no feasible parameterization. |
Source code in autolife_planning/trajectory/toppra.py
Convenience function¶
parameterize_path(path: np.ndarray, max_velocity: np.ndarray, max_acceleration: np.ndarray, knot_spacing: float = 0.1) -> Trajectory
¶
One-shot :meth:TimeOptimalParameterizer.parameterize.
Source code in autolife_planning/trajectory/toppra.py
Trajectory¶
Trajectory(_handle: '_ToppraTrajectory')
dataclass
¶
A time-optimal trajectory produced by
:class:~autolife_planning.trajectory.TimeOptimalParameterizer.
Instances are immutable handles around a C++ TOPP-RA trajectory;
query them via :meth:position, :meth:velocity,
:meth:acceleration, or one of the batch samplers.
duration: float
property
¶
Trajectory duration in seconds.
position(t: float) -> np.ndarray
¶
Configuration at time t (seconds), clamped to [0, duration].
velocity(t: float) -> np.ndarray
¶
acceleration(t: float) -> np.ndarray
¶
sample(times: np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]
¶
Sample at the user-supplied times grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
times
|
ndarray
|
|
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray, ndarray]
|
|
Source code in autolife_planning/trajectory/trajectory.py
sample_uniform(dt: float) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
¶
Uniformly-spaced rollout at step dt.
The returned times always start at 0 and end at
:attr:duration, which may make the final step shorter than
dt — this matches what a streaming controller expects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float
|
Sample interval in seconds (must be |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
ndarray
|
|
ndarray
|
|
Source code in autolife_planning/trajectory/trajectory.py
Low-level C++ binding¶
ToppraTrajectory
¶
Opaque handle to a parameterised trajectory.
A cubic spline along the waypoint path, timed by TOPP-RA: the path velocity is piecewise linear in time between grid points (constant path acceleration), so joint velocity is continuous.
duration: float
property
¶
Total duration in seconds.
position(t: float) -> NDArray[np.float64]
¶
velocity(t: float) -> NDArray[np.float64]
¶
acceleration(t: float) -> NDArray[np.float64]
¶
sample(times: NDArray[np.float64]) -> tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.float64]]
¶
Batched sampling at times — returns (T, ndof) matrices
of (position, velocity, acceleration).
Source code in autolife_planning/_time_parameterization.pyi
sample_uniform(dt: float) -> tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.float64], NDArray[np.float64]]
¶
Uniform rollout with step dt.
Returns (times, positions, velocities, accelerations).
times starts at 0 and ends at :attr:duration.
Source code in autolife_planning/_time_parameterization.pyi
compute_trajectory(waypoints: NDArray[np.float64], max_velocity: NDArray[np.float64], max_acceleration: NDArray[np.float64], knot_spacing: float = 0.1) -> ToppraTrajectory | None
¶
Time-optimal trajectory along the piecewise-linear path
waypoints (N, ndof), starting and ending at rest.
The path is resampled every knot_spacing and splined; the result
deviates from it by about knot_spacing / 10. Returns None if
TOPP-RA finds no feasible parameterization; raises ValueError if the
limits do not match the path's DOF or the path has no length.