COPP for MATLAB

Mathematical orientation, package layout, and a complete first workflow.

COPP solves optimal path-parameterization problems. A geometric path is written as

\[q = q(s), \qquad s \in [s_{\min}, s_{\max}],\]

where \(q\) is robot configuration and \(s\) is a scalar path coordinate. The solver does not change the geometric path. It computes a time law

\[s = s(t)\]

so the robot traverses the path while respecting velocity, acceleration, torque, jerk, and user-supplied constraints. In short, COPP turns a geometry-space path into a feasible and optimized time schedule.

The MATLAB package is named copp. Public code should call APIs through that package namespace.

Start Here

guide

Path Module

Build geometric paths (q(s)) from waypoints, callbacks, symbolic formulas, CasADi, or Jet3 formulas.

guide

Robot and Constraints

Store station grids, sampled derivatives, physical limits, raw inequalities, and inverse dynamics.

guide

Interpolation

Convert path-domain profiles into time grids and sample (s(t)).

guide

API Reference

Public classes, functions, solver namespaces, options, results, and profile helpers.

API Namespaces

module

clarabel

Clarabel solver settings and option adapters.

module

diag

Diagnostics, error objects, and verbosity helpers.

module

interpolation

Convert solver profiles between station and time domains.

module

objective

Objective descriptors used by COPP solvers.

module

solver

Second- and third-order solver namespaces.

Solver profiles

Solvers return compact path-speed profiles rather than time-sampled robot trajectories. In second-order solvers the main output is \(a\), the squared path speed at station nodes. Third-order solvers return copp.Profile3rd, which stores the node profiles needed by the third-order interpolation helpers.

Use the interpolation functions to convert solver output into time-domain data:

TOPP and COPP

TOPP means time-optimal path parameterization. A TOPP solver seeks the shortest feasible traversal time under a selected constraint model.

COPP means convex-objective path parameterization. COPP solvers keep the same path-domain constraints, but optimize convex objective terms such as time, linear penalties, thermal energy, or total variation of torque.

The MATLAB binding exposes both second-order and third-order families:

Package layout

The MATLAB API mirrors the Rust and Python structure while using MATLAB idioms:

MATLAB public station indices are 1-based. Matrices use MATLAB's natural column-major convention: a \(\mathrm{dim} \times N\) matrix stores one station/sample per column.

The MATLAB binding is a workflow facade, not a one-to-one C ABI mirror. It prioritizes the public Path, Robot, solver, objective, and interpolation workflows. Raw native pointers, owned C buffers, status-code plumbing, and low-level debug/introspection calls are intentionally hidden unless they make a user-facing workflow clearer.

Shape glossary

The binding deliberately uses one convention across all MATLAB entry points:

A quick mental check: if a matrix is about robot coordinates, rows are axes and columns are stations. If a matrix is about raw inequalities, rows are inequality rows and columns are stations.

First complete workflow

This example solves a compact TOPP2-RA problem. The path is \(q(s)=s\), sampled on seven stations. The robot starts and ends at rest, with unit velocity and acceleration bounds.

MATLAB
n = 7;
s = linspace(0.0, 1.0, n).';

robot = copp.Robot(1, Capacity=n);
cleanup = onCleanup(@() robot.release());
robot.append_s(s);
% q, dq, and ddq are dim x N matrices. Here dim=1 and N=n.
robot.set_q_2nd(s.', ones(1, n), zeros(1, n));
robot.add_velocity_limits(1, -1);
robot.add_acceleration_limits(1, -1);

problem = copp.solver.topp2_ra.Problem( ...
    robot, ...
    idx_s_interval=[1, n], ...
    a_boundary=[0, 0]);
a = copp.solver.topp2_ra.solve(problem);
[t_final, t_s] = copp.interpolation.s_to_t_topp2(s, a);

fprintf("a shape: %d x %d, t_s shape: %d x %d\n", ...
    size(a, 1), size(a, 2), size(t_s, 1), size(t_s, 2));
summary = table(s, a, t_s, 'VariableNames', {'s', 'a', 't_s'});
disp(summary)
fprintf("Final traversal time: %.6f seconds\n", t_final);

Reading the rest of the documentation

A useful learning order is:

  1. Path Module - choose how to represent geometry.
  2. Robot and Constraints - convert geometry into station-indexed limits.
  3. TOPP2 and COPP2 Solvers - solve the easiest full problems first.
  4. TOPP3 and COPP3 Solvers - add jerk-level modeling.
  5. Interpolation - turn \(a(s)\) or Profile3rd into \(s(t)\).
  6. Errors and Diagnostics - understand exceptions, expert solver statuses, and verbosity.