COPP
Convex-Objective Path Parameterization (Rust/C)
This library targets Optimal Path Parameterization (OPP) for robotic trajectory generation. Typical application domains include robotic motion planning and CNC machining.
Given an $n$-dimensional geometric path parameterization
$$ \boldsymbol{q} = \boldsymbol{q}(s),\text{ }s\in[0,s_\text{f}],\text{ (}s_\text{f}\text{ is known)} $$
the objective is to schedule a dynamically feasible time parameterization
$$ s = s(t),\text{ }t\in[0,t_\text{f}],\text{ (}t_\text{f}\text{ is unknown)} $$
so that the specified system constraints are satisfied while an objective $J$ is optimized. In this way, the problem is transformed from geometry-space description to time-space scheduling along a fixed path.
At a high level, this project unifies two system orders and two objective families:
- 2nd-order models: constraints on velocity, acceleration, torque, etc. The constraint can be written as $\boldsymbol{f}(\boldsymbol{q}(s),\dot{\boldsymbol{q}}(s),\ddot{\boldsymbol{q}}(s);s)\leq\boldsymbol{0}$, and the objective is $\min J=\int_0^{t_\text{f}}L(\boldsymbol{q}(s),\dot{\boldsymbol{q}}(s),\ddot{\boldsymbol{q}}(s);s)\mathrm{d}t$.
- 3rd-order models: additionally include jerk-related effects. The constraint can be written as $\boldsymbol{f}(\boldsymbol{q}(s),\dot{\boldsymbol{q}}(s),\ddot{\boldsymbol{q}}(s),\dddot{\boldsymbol{q}}(s);s)\leq\boldsymbol{0}$, and the objective is $\min J=\int_0^{t_\text{f}}L(\boldsymbol{q}(s),\dot{\boldsymbol{q}}(s),\ddot{\boldsymbol{q}}(s),\dddot{\boldsymbol{q}}(s);s)\mathrm{d}t$.
- TOPP (Time-Optimal Path Parameterization): minimizes traversal time, i.e., $L\equiv1$ and the objective is $J=t_\text{f}$.
- COPP (Convex-Objective Path Parameterization): supports broader convex objectives. The objective $L$ should be convex with respect to the state and control: $(\dot{s}^2,\ddot{s})$ in 2nd-order models and $(\dot{s}^2,\ddot{s},\frac{\dddot{s}}{\dot{s}})$ in 3rd-order models.
The resulting taxonomy is summarized below.
| Smoothness order | Time-optimal objective | General convex objective |
|---|---|---|
| 2nd-order (velocity/acceleration/torque constraints) | TOPP2 | COPP2 |
| 3rd-order (+ jerk constraints) | TOPP3 | COPP3 |
Algorithm availability
This section focuses on open-source algorithms. If you need the best possible performance for difficult large-scale problems, please see PRO.
| Problem class | Algorithm | Notes |
|---|---|---|
| TOPP2 | TOPP2-RA | Ultra-fast reachability-analysis-based method; near-global-optimal in common benchmarks, with relative error typically below $10^{-4}$ versus global optimization baselines. |
| COPP2 | COPP2-SOCP | Solved as an SOCP using clarabel; globally optimal under the convex formulation, with moderate-to-high runtime cost. |
| TOPP3 | TOPP3-SOCP | clarabel-based conic formulation; returns KKT solutions with strong optimality quality, and may incur higher computational cost on specific datasets. |
| TOPP3 | TOPP3-LP | Linear-objective approximation of TOPP3-SOCP; usually faster, but can become sub-optimal under tight jerk constraints (recommended mainly when jerk bounds are loose). |
| COPP3 | COPP3-SOCP | clarabel-based conic formulation; returns KKT solutions with strong practical optimality, at relatively high computational cost. |
Algorithm Selection Guide
| Scenario / primary priority | Recommended algorithm | Why this is recommended | Typical caveat | Alternative |
|---|---|---|---|---|
| 2nd-order, time-optimal planning with very low runtime | TOPP2-RA | Excellent speed-performance trade-off; near-global-optimal in benchmarks | Objective is fixed to minimum-time style | |
| 2nd-order, convex objective with strong global guarantees | COPP2-SOCP | Convex conic formulation with global optimality under model assumptions | Higher runtime than RA-style methods | See PRO for higher-performance solvers |
| 3rd-order, best open-source optimality quality | TOPP3-SOCP (time objective) / COPP3-SOCP (general convex objective) | Strong KKT-quality solutions and broad applicability | On specific datasets, computational cost may be higher | TOPP3-LP or higher-performance solvers in PRO |
| 3rd-order, faster open-source approximation | TOPP3-LP | Use this only when your own path-dataset benchmark shows better runtime/performance | May become sub-optimal under tight jerk bounds | TOPP3-SOCP or higher-performance solvers in PRO |
Benchmark
The tests are provided in test_random_spline.rs. Condition:
release, --include-ignored- CPU: Intel(R) Core(TM) Ultra 9 285K.
- Dataset: 100 random 7-DOF spline paths, each discretized into 1000 intervals.
All metrics are listed in the form of "mean ± std".
Time-Optimal
| Method | Computation time (ms) | Traversal time (s) |
|---|---|---|
| TOPP2-RA | 0.665447 ± 0.278833 | 40.903420 ± 1.378671 |
| COPP2-SOCP | 161.544955 ± 13.342861 | 40.900036 ± 1.378611 |
| TOPP3-LP | 346.354708 ± 38.865584 | 41.422937 ± 1.381852 |
| TOPP3-SOCP | 312.118867 ± 20.544208 | 41.418608 ± 1.381202 |
| COPP3-SOCP | 305.931003 ± 22.910681 | 41.418608 ± 1.381202 |
Convex-Objective
In this test, TOPP methods still use traversal time as the optimization objective.
| Method | Computation time (ms) | Objective value |
|---|---|---|
| TOPP2-RA | 0.696362 ± 0.300599 | 223.896965 ± 9.485003 |
| COPP2-SOCP | 300.428479 ± 71.154448 | 97.746537 ± 2.652869 |
| TOPP3-LP | 384.399012 ± 79.626532 | 217.858895 ± 9.324830 |
| TOPP3-SOCP | 340.468745 ± 59.209470 | 218.026329 ± 9.285519 |
| COPP3-SOCP | 376.119382 ± 88.865232 | 97.871570 ± 2.645819 |
Why use COPP instead of re-implementing from scratch?
Unless you are a specialist researcher in TOPP/COPP, we strongly recommend using this library directly. In practical deployment, many critical implementation details are easy to overlook, for example:
- strict constraint satisfaction rather than soft-constraint relaxation;
- guaranteed geometric consistency: the executed trajectory $\boldsymbol{q}=\boldsymbol{q}(s(t))$ remains exactly on the original geometric path $\boldsymbol{q}=\boldsymbol{q}(s)$, avoiding additional contour error introduced by the COPP stage;
- prevention of reverse motion and zero-velocity singularities (i.e., enforcing $\dot{s}>0$ strictly almost everywhere);
- certifiable feasibility guarantees, especially for long-path online planning, a challenge only recently addressed in the literature;
- boundary acceleration continuity handling, which is frequently problematic in existing methods. Some algorithms bypass this issue by ignoring boundary-acceleration constraints or by disallowing stationary boundary conditions $\dot{s}=0,\ddot{s}=0$, instead requiring $\dot{s}>\delta$.
Citing
If your work uses the open-source TOPP3/COPP3 functionalities, please cite:
@article
If your work uses RDDP methods from the PRO release, please cite:
@article
For other use cases, please cite:
@misc
Quick Start
General workflow
- Inputs
- path grid: prepare a strictly increasing station grid $0=s_0<s_1<\dots<s_{n-1}=s_\text{f}$;
- path data: provide path derivatives through
Pathevaluators or sampled matrices. 2nd-order problems use $\boldsymbol{q}$, $\frac{\mathrm{d}\boldsymbol{q}}{\mathrm{d}s}$, and $\frac{\mathrm{d}2\boldsymbol{q}}{\mathrm{d}s2}$; 3rd-order problems additionally use $\frac{\mathrm{d}3\boldsymbol{q}}{\mathrm{d}s3}$; - robot and constraints: create a
Robot, attach the station grid withwith_s, then fill path data withwith_q_from_path_2ndorwith_q_from_path_3rd. Standard constraint APIs includewith_axial_velocity,with_axial_acceleration,with_axial_torque, andwith_axial_jerkfor 3rd-order problems. Asymmetric and station-dependent limits are supported; - objective: TOPP solvers use traversal time as the objective. COPP solvers take a list of built-in
CoppObjectiveterms, such asCoppObjective::Time,CoppObjective::ThermalEnergy,CoppObjective::TotalVariationTorque, andCoppObjective::Linear.
- Problem construction
- 2nd-order: build a
Topp2ProblemorCopp2ProblemwithTopp2ProblemBuilderorCopp2ProblemBuilder; - 3rd-order: first prepare a feasible linearization profile
a_linearization, commonly fromtopp2_ra. Optionally userobot.constraints.amax_substitute(...)to tighten the first-order upper bound. Then build the problem withTopp3ProblemBuilder::build_with_linearizationorCopp3ProblemBuilder::build_with_linearization.
- 2nd-order: build a
- Solving
- choose the solver namespace according to the problem class and algorithm, for example
solver::topp2_ra,solver::copp2_socp,solver::topp3_lp,solver::topp3_socp, orsolver::copp3_socp; - build solver options with the corresponding options builder, then call the solver function.
- choose the solver namespace according to the problem class and algorithm, for example
- Outputs and post-processing
- 2nd-order solvers return an
aprofile, where $a(s)=\dot{s}^2$; - 3rd-order solvers return a
Topp3Profile, containinga,b, and stationary-boundary metadata; - convert path-domain profiles to timing data with
s_to_t_topp2ors_to_t_topp3. For aTopp3Profile, passprofile.as_parts(); - convert timing data to sampled inverse parameterization
s(t)witht_to_s_topp2ort_to_s_topp3; - evaluate the original path at
s(t)to generate position, velocity, and acceleration references for downstream controllers.
- 2nd-order solvers return an
Documentation
The latest documentation for the published crate is available at https://docs.rs/copp/latest/copp/. For unreleased updates on the main branch, we recommend generating the documentation locally:
git clone https://github.com/TOPP-THU/copp.git
cd ./copp
cargo doc --no-deps --open
The generated docs include mathematical foundations, path/constraint construction methods, logging and output conventions, error definitions, and solver interfaces.
Rust
To use the Rust API, add the crate dependency in your Cargo manifest:
[]
= "*"
Complete runnable examples are available in the examples directory. A quick example (2nd-order) is as follows:
//! This example uses [`topp2_ra`] to convert an analytic path into a second-order
//! time-optimal trajectory whose axial velocity and acceleration both stay within
//! `[-1, 1]`.
use InterpolationMode;
use CoppError;
use ;
use Robot;
use ;
use PI;
API for Other languages
- C: Please refer to README.md for C.
- Bindings for other languages are under active development. Planned targets include C++, Python, and MATLAB. If you have suggestions for these language interfaces, please feel free to contact us.
PRO
Open-source vs PRO
The open-source release and PRO release provide complementary solvers for the above problem classes. Performance evaluations for each method are documented in the corresponding Rust test/example source files and summarized below. For challenging trajectory-planning tasks that require both high solution quality and robust numerical behavior, we recommend the PRO solvers. If you are interested in COPP PRO licensing or collaboration, please see Contact Us.
| Problem class | Algorithm | Availability | Notes |
|---|---|---|---|
| TOPP2 | TOPP2-RA | Open-source | Ultra-fast reachability-analysis-based method; near-global-optimal in common benchmarks, with relative error typically below $10^{-4}$ versus global optimization baselines. |
| COPP2 | COPP2-SOCP | Open-source | Solved as an SOCP using clarabel; globally optimal under the convex formulation, with moderate-to-high runtime cost. |
| COPP2 | COPP2-RDDP | PRO | Ultra-fast original method; globally optimal and substantially faster than COPP2-SOCP. |
| TOPP3 | TOPP3-SOCP | Open-source | clarabel-based conic formulation; returns KKT solutions with strong optimality quality, and may incur higher computational cost on specific datasets. |
| TOPP3 | TOPP3-LP | Open-source | Linear-objective approximation of TOPP3-SOCP; usually faster, but can become sub-optimal under tight jerk constraints (recommended mainly when jerk bounds are loose). |
| TOPP3 | TOPP3-RA | PRO | Ultra-fast reachability-analysis-based method; may be sub-optimal under tight jerk constraints (recommended mainly when jerk bounds are loose). |
| COPP3 | COPP3-SOCP | Open-source | clarabel-based conic formulation; returns KKT solutions with strong practical optimality, at relatively high computational cost. |
| COPP3 | COPP3-RDDP | PRO | Fast original method; returns KKT-quality solutions comparable to TOPP3-SOCP while running substantially faster than TOPP3-SOCP, TOPP3-LP, and COPP3-SOCP. COPP3-RDDP can also be used as a TOPP3 solver, with significantly better time-optimality than TOPP3-RA and TOPP3-LP in many cases. For very long paths, COPP3-RDDP may even exhibit better practical optimality and numerical stability than COPP3-SOCP, since large-scale conic optimization can become limited by convergence behavior and computational-resource constraints. |
Algorithm Selection Guide
| Scenario / primary priority | Recommended algorithm | Availability | Why this is recommended | Typical caveat | Alternative |
|---|---|---|---|---|---|
| 2nd-order, time-optimal planning with very low runtime | TOPP2-RA | Open-source | Excellent speed-performance trade-off; near-global-optimal in typical benchmarks | Objective is fixed to minimum-time style | |
| 2nd-order, convex objective with strong global guarantees | COPP2-SOCP | Open-source | Convex conic formulation with global optimality under model assumptions | Higher runtime than RA/RDDP methods | COPP2-RDDP (PRO) for major speed gains |
| 2nd-order, convex objective with maximum efficiency | COPP2-RDDP | PRO | Global-optimal quality with substantially improved speed | PRO license required | COPP2-SOCP (Open-source) |
| 3rd-order, best open-source optimality quality | TOPP3-SOCP (time objective) / COPP3-SOCP (general convex objective) | Open-source | Strong KKT-quality solutions and broad applicability | On specific datasets, computational cost may be higher | COPP3-RDDP (PRO) for major speed gains |
| 3rd-order, faster open-source approximation | TOPP3-LP | Open-source | Use this only when your own path-dataset benchmark shows better runtime/performance | May become sub-optimal under tight jerk bounds | COPP3-RDDP (PRO) for major speed gains |
| 3rd-order, ultra-fast RA-style method under loose jerk bounds | TOPP3-RA | PRO | Very low computational cost | Can be sub-optimal when jerk constraints are tight | COPP3-RDDP or TOPP3-SOCP |
| 3rd-order, high-quality + high-stability planning for difficult long paths | COPP3-RDDP | PRO | Strong practical optimality with significantly better runtime; often robust on very long horizons | PRO license required | COPP3-SOCP (Open-source) |
Benchmark-PRO
All settings are the same as those in benchmark.
All metrics are listed in the form of "mean ± std".
Time-Optimal
| Method | Computation time (ms) | Traversal time (s) |
|---|---|---|
| TOPP2-RA | 0.615425 ± 0.244409 | 40.903420 ± 1.378671 |
| COPP2-SOCP | 149.969964 ± 9.364334 | 40.900039 ± 1.378613 |
| COPP2-RDDP | 5.436142 ± 0.465495 | 40.900135 ± 1.378613 |
| TOPP3-LP | 327.074029 ± 28.893341 | 41.422945 ± 1.381874 |
| TOPP3-SOCP | 289.654071 ± 12.862133 | 41.418608 ± 1.381202 |
| COPP3-SOCP | 285.004302 ± 13.471264 | 41.418608 ± 1.381202 |
| TOPP3-RA (Iteration 1) | 10.571045 ± 0.857653 | 41.499200 ± 1.385735 |
| TOPP3-RA (Iteration 2) | 20.300932 ± 1.237908 | 41.399867 ± 1.386791 |
Convex-Objective
In this test, TOPP methods still use traversal time as the optimization objective.
| Method | Computation time (ms) | Objective value |
|---|---|---|
| TOPP2-RA | 0.534700 ± 0.069296 | 217.444861 ± 12.462360 |
| COPP2-SOCP | 270.059250 ± 52.073677 | 96.517354 ± 3.641154 |
| COPP2-RDDP | 12.667700 ± 0.429214 | 96.525785 ± 3.639733 |
| TOPP3-LP | 348.000000 ± 9.326314 | 211.611085 ± 12.367224 |
| TOPP3-SOCP | 301.227000 ± 12.938498 | 211.974066 ± 12.323865 |
| COPP3-SOCP | 301.227000 ± 12.938498 | 96.634962 ± 3.613264 |
| COPP3-RDDP | 65.823050 ± 0.087893 | 98.708998 ± 3.354004 |
Contact Us
For COPP PRO licensing, commercial collaboration, or technical consulting, please contact:
- Mr. Yunan Wang: wang-yn22@mails.tsinghua.edu.cn
- Dr. Suqin He: hsq_thu2012@163.com
- Dr. Shize Lin: linszthume@gmail.com
- Prof. Chuxiong Hu: cxhu@tsinghua.edu.cn
Furthermore, we thank Jizhou Yan for his expertise on Rust and robotics.