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.")
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.
fixReplace 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.
fixCheck 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.
fixWrap 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.