dim
Robot/path dimension.
Indexing note: Path itself does not expose station indices. Robot and solver APIs use 1-based MATLAB station indices at the public boundary.
from_waypointsConstruct a waypoint spline path.
from_evaluator_2ndConstruct a callback-backed second-order path.
from_evaluator_3rdConstruct a callback-backed third-order path.
from_symbolicConstruct a third-order path from symbolic formulas.
from_casadiConstruct a third-order path from a CasADi expression.
from_parametricConstruct a third-order path from a MATLAB formula.
evaluate_qEvaluate path position \(q(s)\).
evaluate_up_to_2ndEvaluate \(q(s)\), dq/ds, and d2q/ds2.
evaluate_up_to_3rdEvaluate \(q(s)\) and derivatives through d3q/ds3.
deleteRelease the native path handle during MATLAB cleanup.
releaseExplicitly release the native CoppPath handle.
is_validReturn whether this object still owns a live native path.
from_waypointsOBJ = copp.Path.from_waypoints(WAYPOINTS)
Builds a quintic spline over s in [0, 1]. WAYPOINTS must be a real finite \(\mathrm{dim} \times N\) matrix with each column storing one waypoint q(:, k). At least enough waypoints for the selected native spline order must be provided.
Name-value options: s_range: \(1 \times 2\) finite vector [s_min, s_max]. Defaults to [0, 1]. order: Odd spline order accepted by the native path module. Defaults to 5, matching Rust/Python defaults. out_of_range_mode: "error" to reject out-of-range evaluation, or "clamp" to clamp query values into s_range. start_state, end_state: Optional dim-by-K boundary derivative matrices. Column j stores the j-th boundary derivative. Empty arrays request zero boundary derivatives from the native default path options.
The returned object owns the native path handle. release() may be called explicitly, but ordinary MATLAB object cleanup is also sufficient.
from_evaluator_2ndOBJ = copp.Path.from_evaluator_2nd(F, dim=D, s_range=[A,B])
[q, dq, ddq] = F(s)
OBJ = copp.Path.from_evaluator_2nd(E, ...)
[q, dq, ddq] = E.evaluate_up_to_2nd(s)
The callback input s is always a \(1 \times N\) row vector. The three outputs must be real finite D-by-N matrices. The native path borrows the callback, so this Path object keeps the MATLAB function handle alive until release()/delete().
also accepts an object or handle object E that implements:
Function handles are handy for scripts and quick demos. Objects are better when the evaluator owns parameters, caches, or helper methods that should be tested independently.
Name-value options: dim: Positive integer path dimension D. s_range: \(1 \times 2\) finite vector [s_min, s_max]. Defaults to [0, 1].
The resulting native path supports evaluate_q() and evaluate_up_to_2nd(). Third-order evaluation raises a path unsupported-derivative error.
from_evaluator_3rdOBJ = copp.Path.from_evaluator_3rd(F, dim=D, s_range=[A,B])
[q, dq, ddq, dddq] = F(s)
OBJ = copp.Path.from_evaluator_3rd(E, ...)
[q, dq, ddq, dddq] = E.evaluate_up_to_3rd(s)
The callback input s is always a \(1 \times N\) row vector. All outputs must be real finite D-by-N matrices. If the native library only needs second-order derivatives, it may still call F and discard dddq.
also accepts an object or handle object E that implements:
If E also implements evaluate_up_to_2nd(s), native second-order evaluation uses that lighter callback. Otherwise it falls back to evaluate_up_to_3rd(s) and discards dddq, matching the C/Python binding semantics.
Name-value options: dim: Positive integer path dimension D. s_range: \(1 \times 2\) finite vector [s_min, s_max]. Defaults to [0, 1].
from_symbolicOBJ = copp.Path.from_symbolic(Q_EXPR)
OBJ = copp.Path.from_symbolic(Q_EXPR, symbol=S)
q = [sin(s); cos(2*s); s + sym(1)/10*s^2];
path = copp.Path.from_symbolic(q, symbol=s, s_range=[0, 1])
differentiates a Symbolic Math Toolbox vector expression Q_EXPR with respect to its only symbolic variable, then wraps the generated batch evaluator with Path.from_evaluator_3rd().
uses the scalar symbolic variable S explicitly. Passing symbol= is required when Q_EXPR contains zero variables or more than one variable.
Name-value options: symbol: Scalar sym variable used as the path parameter. If omitted, it is inferred only when symvar(Q_EXPR) has exactly one variable. s_range: \(1 \times 2\) finite vector [s_min, s_max]. Defaults to [0, 1].
must be a symbolic row or column vector. Matrix-valued expressions are rejected so the path dimension is unambiguous. The callback created by this constructor receives s as a \(1 \times N\) row vector and returns q/dq/ddq/dddq as \(\mathrm{dim} \times N\) double matrices.
This constructor requires MATLAB Symbolic Math Toolbox. It throws copp:MissingDependency when the toolbox is unavailable.
syms s q = [sin(s); cos(2*s); s + sym(1)/10*s^2]; path = copp.Path.from_symbolic(q, symbol=s, s_range=[0, 1]);
from_casadiOBJ = copp.Path.from_casadi(Q_EXPR, symbol=S)
s = SX.sym('s')
q = [sin(s); cos(2*s); s + 0.1*s^2];
path = copp.Path.from_casadi(q, symbol=s, s_range=[0, 1])
differentiates a scalar-parameter CasADi SX/MX vector expression Q_EXPR up to third order with respect to scalar symbol S, then wraps the generated batch evaluator with Path.from_evaluator_3rd().
Name-value options: symbol: Required scalar CasADi SX or MX symbol used as the path parameter. s_range: \(1 \times 2\) finite vector [s_min, s_max]. Defaults to [0, 1].
must be a CasADi row or column vector. Matrix-valued expressions are rejected so the path dimension is unambiguous. The evaluator first tries CasADi Function.map(N) for batch evaluation and falls back to a scalar loop if map evaluation is not supported by the installed CasADi version.
This constructor requires the CasADi MATLAB package on the MATLAB path. It throws copp:MissingDependency when CasADi is unavailable.
import casadi.*
s = SX.sym('s');
q = [sin(s); cos(2*s); s + 0.1*s^2];
path = copp.Path.from_casadi(q, symbol=s, s_range=[0, 1]);from_parametricOBJ = copp.Path.from_parametric(F, s_range=[A,B])
path = copp.Path.from_parametric( ...
calls F with a scalar copp.Jet3 path parameter. F must return a numeric vector or a Jet3 vector. The returned value defines \(q(s)\), and Jet3 automatically supplies dq/ds, d2q/ds2, and d3q/ds3.
Name-value options: s_range: \(1 \times 2\) finite vector [s_min, s_max]. Defaults to [0, 1]. dim: Optional positive integer path dimension. If omitted, the dimension is inferred by probing F at mean(s_range).
The generated evaluator is batch-compatible with the native MEX callback path. Internally it receives s as a \(1 \times N\) row vector, evaluates the scalar Jet3 formula once per sample, and returns \(\mathrm{dim} \times N\) q/dq/ddq/dddq matrices.
path = copp.Path.from_parametric( ... @(s) [sin(s); cos(2*s); s + 0.1*s^2], ... s_range=[0, 1]);
evaluate_qQ = evaluate_q(OBJ, S)
path position at each sample in S, where N = numel(S). S may be
Returns a \(\mathrm{dim} \times N\) matrix containing the path position at each sample in S, where N = numel(S). S may be a row or column vector, but must be real and finite. The output orientation is always \(\mathrm{dim} \times N\), matching evaluate_up_to_2nd().
evaluate_up_to_2ndOUT = evaluate_up_to_2nd(OBJ, S)
[Q, DQ, DDQ] = evaluate_up_to_2nd(OBJ, S)
Returns a struct with fields: q: \(\mathrm{dim} \times N\) path position matrix. dq: \(\mathrm{dim} \times N\) first derivative matrix. ddq: \(\mathrm{dim} \times N\) second derivative matrix.
Returns the same matrices as separate outputs. S may be a \(1 \times N\) or \(N \times 1\) vector, and all outputs are always \(\mathrm{dim} \times N\).
evaluate_up_to_3rdOUT = evaluate_up_to_3rd(OBJ, S)
[Q, DQ, DDQ, DDDQ] = evaluate_up_to_3rd(OBJ, S)
dim-by-N matrices as separate outputs, where N = numel(S).
Returns a struct with fields: q: \(\mathrm{dim} \times N\) path position matrix. dq: \(\mathrm{dim} \times N\) first derivative matrix. ddq: \(\mathrm{dim} \times N\) second derivative matrix. dddq: \(\mathrm{dim} \times N\) third derivative matrix.
Returns the same \(\mathrm{dim} \times N\) matrices as separate outputs, where N = numel(S). Second-order-only evaluator paths raise copp:PathError for this method.
deletedelete(obj)
is idempotent through release(); it is safe for MATLAB to call it after the user has already called release().
releaseRELEASED = release(OBJ)
is_validtf = is_valid(obj)
A false result means either release() has been called or the MEX registry no longer contains this handle id.
waypoints = [0 1 2; 0 0.5 0]; path = copp.Path.from_waypoints(waypoints, s_range=[0, 1]); s = linspace(0, 1, 5); q = path.evaluate_q(s); disp(q)