Registry / ai-ml / toppra

toppra

JSON →
library0.6.8pypypi✓ verified 85d ago

toppra (Time-Optimal Path Parameterization via Reachability Analysis) is a Python library for computing time-optimal parametrizations of robot trajectories subject to constraints such as joint velocity, acceleration, and torque limits. It implements the TOPP-RA algorithm. Current version is 0.6.8. Release cadence is irregular, with occasional minor updates.

pip install toppra
INSTALL
IMPORT
SIG · TOPPRA
T
toppra
ai-mlpythonv0.6.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

toppra
import toppra
Correct import.
toppra.algorithm
from toppra import algorithm
import toppra.algorithm
toppra.algorithm is a module; use from toppra import algorithm.
toppra.constraint
from toppra import constraint
import toppra.constraint
toppra.constraint is a module; use from toppra import constraint.
SolverWrapper
from toppra.solverwrapper import SolverWrapper
from toppra import SolverWrapper
SolverWrapper is in the solverwrapper submodule.

Creates a time-optimal trajectory for a 3-DOF robot with joint velocity and acceleration limits.

import numpy as np import toppra from toppra import constraint, algorithm # Define a simple joint-space trajectory (position waypoints) waypoints = np.array([ [0, 0, 0], [0.5, 0.5, 0.5], [1, 1, 1], ]) # Create a piecewise linear path path = toppra.SplineInterpolator(np.linspace(0, 1, waypoints.shape[0]), waypoints) # Define constraints vel_limits = np.array([2.0, 2.0, 2.0]) acc_limits = np.array([1.0, 1.0, 1.0]) pc_vel = constraint.JointVelocityConstraint(vel_limits) pc_acc = constraint.JointAccelerationConstraint(acc_limits) # Create TOPPRA instance solver = algorithm.TOPPRA([pc_vel, pc_acc], path, gridpoints=100) jnt_traj = solver.compute_trajectory() if jnt_traj is not None: print("Time-optimal trajectory computed.") else: print("Infeasible.")
Debug
Known issues
breakingVersion 0.3.0 introduced a new C++ backend and significant API changes. Old code using TOPPRA class directly from earlier versions may break.
fix
Update code to use algorithm.TOPPRA class and new constraint interfaces as shown in the quickstart.
affects: <0.3.0
gotchaThe path (first argument to algorithm.TOPPRA) must be an instance of toppra.Path or SplineInterpolator. Passing raw waypoints without constructing a Path object causes cryptic errors.
fix
Wrap waypoints in toppra.SplineInterpolator or use a custom Path subclass.
affects: *
gotchaThe gridpoints parameter in algorithm.TOPPRA must be an integer (number of grid points). Setting it too low (e.g., <10) may cause infeasibility, too high (>1000) may cause performance issues.
fix
Use gridpoints=100 as a reasonable default; adjust based on path complexity.
affects: *
deprecatedThe old toppra.TOPPRA class (without algorithm submodule) was deprecated in 0.3.0 and may be removed in future versions.
fix
Use from toppra import algorithm; solver = algorithm.TOPPRA(...)
affects: >=0.3.0, <0.7.0
Errors
Common errors & fixes
AttributeError: module 'toppra' has no attribute 'TOPPRA'
Attempting to use the old top-level TOPPRA class after version 0.3.0.
fix
Replace toppra.TOPPRA with algorithm.TOPPRA: from toppra import algorithm; solver = algorithm.TOPPRA(...)
TypeError: 'NoneType' object is not iterable
The compute_trajectory() method returns None when the problem is infeasible. Code expects a trajectory object.
fix
Check the return value: traj = solver.compute_trajectory(); if traj is not None: ... else: handle infeasibility.
ValueError: Path must be callable and return a matrix of shape (N, dof)
Passing raw waypoints array directly to algorithm.TOPPRA instead of a Path object.
fix
Wrap waypoints in a Path object, e.g., path = toppra.SplineInterpolator(ss, waypoints).
Upgrade
Version history
0.6.8latest on PyPI · released May 3, 2026
Audit
Dependencies
numpyrequiredCore dependency for array operations and linear algebra.
scipyrequiredUsed for interpolation and optimization routines.
cvxoptoptionalSolver for the underlying quadratic programs (optional, fallback to other solvers).
qpsolversoptionalUnified interface to multiple QP solvers; recommended for better performance.
Agent activity
60 hits · last 30 days
node
54
OpenAI (training)
2
Resources
toppra — pip install toppra · libregistry