copp.Robot

Native robot model and station-indexed constraint buffer.

Syntax

OBJ = copp.Robot(DIM)
OBJ = copp.Robot(DIM, CAPACITY)
OBJ = copp.Robot(DIM, Capacity=CAPACITY)

Description

Robot owns a native CoppRobot handle. The handle stores station samples, sampled path derivatives, and constraints used by TOPP/COPP solvers. This MATLAB class exposes the workflow-oriented surface used by TOPP and COPP solvers: station append, path derivative input, limit helpers, raw constraints, inverse dynamics callbacks, and solver metadata.

Matrix convention: MATLAB inputs use \(\mathrm{dim} \times N\) column-major matrices for robot/path data. Here dim is robot.dim and N is the number of station samples covered by the call. Each column corresponds to one station sample. One-dimensional station/profile inputs may be row or column vectors, but solver/profile outputs are returned as double column vectors.

Constraint convention: Per-axis limit vectors have shape \(\mathrm{dim} \times 1\) or 1-by-dim and are broadcast over the selected station interval. Per-axis station-varying limit matrices have shape \(\mathrm{dim} \times N\). Raw constraint matrices have shape R-by-N, where R is the number of inequality rows per station.

Input Arguments

dim

Positive integer path or robot dimension.

capacity

Input value for copp.Robot. See Description for accepted shape and constraints. Default: 0

Name-Value Arguments

Capacity

Name-value option for copp.Robot. Default: capacity

Properties

len

Number of logical station samples currently stored.

capacity

Allocated native station-buffer capacity.

Methods

Robot

Construct a native robot and empty constraint buffer.

delete

Release the native robot handle during MATLAB cleanup.

release

Explicitly release the native CoppRobot handle.

is_valid

Return whether this object still owns a live native robot.

append_s

Append strictly increasing path station samples.

set_q_2nd

Store q, dq/ds, and d2q/ds2 over a station interval.

set_q_3rd

Store q and derivatives through third order.

pop_back_n

Remove N logical stations from the back.

Method Details

Robot

Syntax

OBJ = copp.Robot(DIM)
OBJ = copp.Robot(DIM, CAPACITY)
OBJ = copp.Robot(DIM, Capacity=CAPACITY)

creates an empty DIM-dimensional robot. OBJ = copp.Robot(DIM, CAPACITY) also gives the native station buffer an initial capacity hint. CAPACITY may be zero. OBJ = copp.Robot(DIM, Capacity=CAPACITY) is the name-value equivalent, matching the style used by the rest of the MATLAB facade.

delete

Syntax

delete(obj)

release

Syntax

RELEASED = release(OBJ)

is_valid

Syntax

tf = is_valid(obj)

append_s

Syntax

obj = append_s(obj, s)

appends a real finite vector of station values. S may be \(1 \times N\) or \(N \times 1\). S must be strictly increasing, and if OBJ already stores stations then S(1) must be greater than the current last station.

The method returns OBJ to support chaining.

set_q_2nd

Syntax

This mirrors Python Robot.set_q(..., dddq=None), while MATLAB

writes second-order geometric path derivatives starting at station 1. Q, DQ, and DDQ must have the same \(\mathrm{dim} \times N\) shape. Column k corresponds to station start_idx_s + k - 1.

Name-value options: start_idx_s: 1-based global station index where the first column is written. Defaults to 1.

This mirrors Python Robot.set_q(..., dddq=None), while MATLAB keeps the explicit second-order name for readability.

set_q_3rd

Syntax

obj = set_q_3rd(obj, q, dq, ddq, dddq)
obj = set_q_3rd(obj, q, dq, ddq, dddq, start_idx_s=start_idx_s)

writes third-order geometric path derivatives starting at station 1. All matrices must have the same \(\mathrm{dim} \times N\) shape, with one column per station.

Name-value options: start_idx_s: 1-based global station index where the first column is written. Defaults to 1.

set_q_from_path_2nd

Syntax

set_q_from_path_2nd(..., idx_s_from=I, idx_s_to=J)

evaluates PATH at the station values already stored in OBJ and writes q, dq/ds, and d2q/ds2 from station 1 through OBJ.len.

PATH must remain valid only for the duration of this call; the sampled derivatives are copied into the native Robot.

set_q_from_path_3rd

Syntax

set_q_from_path_3rd(..., idx_s_from=I, idx_s_to=J)

evaluates PATH at OBJ's stored station values and writes q, dq/ds, d2q/ds2, and d3q/ds3 from station 1 through OBJ.len.

add_velocity_limits

Syntax

obj = add_velocity_limits(obj, upper, lower)
obj = add_velocity_limits(obj, upper, lower, start_idx_s=start_idx_s, length=length)

adds per-axis bounds over the interval from station 1 through OBJ.len. Vector inputs must have length dim (\(\mathrm{dim} \times 1\) or 1-by-dim) and are broadcast over the interval. Matrix inputs must have shape \(\mathrm{dim} \times N\) and specify station-varying limits, where N is the selected interval length.

Name-value options: start_idx_s: 1-based first station receiving the limits. Defaults to 1. length: Number of stations for broadcast vector limits. When omitted, length is inferred as OBJ.len - start_idx_s + 1.

The method returns OBJ to support chaining.

add_acceleration_limits

Syntax

obj = add_acceleration_limits(obj, upper, lower)
obj = add_acceleration_limits(obj, upper, lower, start_idx_s=start_idx_s, length=length)

This method has the same vector/matrix shape, indexing, Inf, and length inference rules as add_velocity_limits(), but it writes second-order acceleration constraints used by TOPP2/COPP2.

The method returns OBJ to support chaining.

add_jerk_limits

Syntax

obj = add_jerk_limits(obj, upper, lower)
obj = add_jerk_limits(obj, upper, lower, start_idx_s=start_idx_s, length=length)

This method has the same vector/matrix shape, indexing, Inf, and length inference rules as add_velocity_limits(), but it writes third-order jerk constraints used by TOPP3/COPP3 solvers. The robot must already contain third-order path derivative data over the target interval.

add_torque_limits

Syntax

obj = add_torque_limits(obj, upper, lower)
obj = add_torque_limits(obj, upper, lower, start_idx_s=start_idx_s, length=length)

This method has the same vector/matrix shape, indexing, Inf, and length inference rules as add_velocity_limits(): vector bounds have length dim and are broadcast, while matrix bounds are \(\mathrm{dim} \times N\) with one column per station. Torque evaluation uses the currently installed inverse-dynamics callback, or the native default point dynamics \(\tau = \ddot{q}\) when no callback is installed.

add_raw_constraint_1st

Syntax

obj = add_raw_constraint_1st(obj, amax)
obj = add_raw_constraint_1st(obj, amax, start_idx_s=start_idx_s)

AMAX may be a vector of length N for one raw row per station, or an R-by-N matrix for R raw inequality rows per station. Column k corresponds to station start_idx_s + k - 1.

add_raw_constraint_2nd

Syntax

obj = add_raw_constraint_2nd(obj, acc_a, acc_b, acc_max)
obj = add_raw_constraint_2nd(obj, acc_a, acc_b, acc_max, start_idx_s=start_idx_s)

ACC_A, ACC_B, and ACC_MAX must have identical shapes. Use a length-N vector for one row per station, or an R-by-N matrix for R raw rows per station. Columns are station samples.

add_raw_constraint_3rd

Syntax

obj = add_raw_constraint_3rd(obj, jerk_a, jerk_b, jerk_c, jerk_d, jerk_max)
obj = add_raw_constraint_3rd(obj, jerk_a, jerk_b, jerk_c, jerk_d, jerk_max, start_idx_s=start_idx_s)

JERK_A, JERK_B, JERK_C, JERK_D, and JERK_MAX must have identical shapes. Use a length-N vector for one row per station, or an R-by-N matrix for R raw rows per station. Columns are station samples.

clear_constraints

Syntax

obj = clear_constraints(obj)
obj = clear_constraints(obj, keep_idx_s=keep_idx_s)

keep_idx_s=true keeps the \(1 \times N\)/\(N \times 1\) station vector S and clears derivative and constraint buffers. keep_idx_s=false clears the station vector as well.

pop_front_n

Syntax

obj = pop_front_n(obj, n)

pop_back_n

Syntax

obj = pop_back_n(obj, n)

set_inverse_dynamics

Syntax

tau = callback(q, dq, ddq)

CALLBACK is called pointwise, not batched:

clear_inverse_dynamics

Syntax

obj = clear_inverse_dynamics(obj)

See Also

copp