Trajectory¶
TimeOptimalParameterizer¶
TimeOptimalParameterizer(max_velocity: np.ndarray, max_acceleration: np.ndarray, max_deviation: float = 0.1, time_step: float = 0.001, method: TimeParameterizationMethod | str = 'toppra')
¶
Time-optimal trajectory parameteriser with fixed joint limits.
Instantiate once per robot (limits are cached), then call
:meth:parameterize on every path. The parameteriser itself holds
no state between calls — it is safe to reuse across threads so long
as the limits do not change.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_velocity
|
ndarray
|
|
required |
max_acceleration
|
ndarray
|
|
required |
max_deviation
|
float
|
TOTG-only radial tolerance (same unit as the path)
for the circular blend inserted at every interior waypoint.
Larger values make cornering faster but deviate further from
the original piecewise-linear path. Defaults to |
0.1
|
time_step
|
float
|
TOTG-only forward-integration step along the path.
Smaller values are more accurate and slower; the MoveIt
default of |
0.001
|
method
|
TimeParameterizationMethod | str
|
Time-parameterization backend. |
'toppra'
|
Source code in autolife_planning/trajectory/totg.py
parameterize(path: np.ndarray, velocity_scaling: float = 1.0, acceleration_scaling: float = 1.0) -> Trajectory
¶
Convert a piecewise-linear joint-space path into a time-optimal trajectory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
ndarray
|
|
required |
velocity_scaling
|
float
|
Scalar in |
1.0
|
acceleration_scaling
|
float
|
Scalar in |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
Trajectory
|
class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in autolife_planning/trajectory/totg.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
Convenience function¶
parameterize_path(path: np.ndarray, max_velocity: np.ndarray, max_acceleration: np.ndarray, max_deviation: float = 0.1, time_step: float = 0.001, method: TimeParameterizationMethod | str = 'toppra') -> Trajectory
¶
One-shot helper that builds a :class:TimeOptimalParameterizer
and immediately calls :meth:parameterize on path.
Prefer the class form when you are going to re-use the limits — it avoids revalidating them on every call.
Source code in autolife_planning/trajectory/totg.py
Trajectory¶
Trajectory(_handle: Any)
dataclass
¶
A time-optimal trajectory produced by
:class:~autolife_planning.trajectory.TimeOptimalParameterizer.
Instances are immutable handles around a concrete timing backend;
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¶
TotgTrajectory
¶
Opaque handle to a parameterised trajectory.
Queries are C¹-consistent: :meth:position / :meth:velocity /
:meth:acceleration sample a quadratic segment between the
algorithm's internal forward-integration grid points.
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], max_deviation: float = ..., time_step: float = 0.001) -> TotgTrajectory | None
¶
Build a time-optimal trajectory for a piecewise-linear path.
Returns None if waypoints has fewer than two rows, the
velocity/acceleration bounds are infeasible, or the integrator
failed (e.g. a 180-degree reversal in the waypoints).