COPP C ABI
C interface for COPP trajectory optimization
Loading...
Searching...
No Matches
core.h
Go to the documentation of this file.
1#ifndef COPP_CORE_H
2#define COPP_CORE_H
3
4/*
5 * Generated by bindings/c/scripts/generate_headers.ps1.
6 * Do not edit by hand; update src/ffi/c and regenerate.
7 */
8
14
15#include <stddef.h>
16#include <stdbool.h>
17#include <stdint.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
27
34typedef enum CoppStatus {
183} CoppStatus;
184
190const char *copp_status_message(enum CoppStatus status);
191
198
206const char *copp_last_error_message(void);
207
214
262enum CoppStatus copp_last_error_message_copy(char *buffer, size_t capacity, size_t *out_len);
263
268
306enum CoppStatus copp_set_last_error_message(enum CoppStatus status, const char *message);
307
319 const char *message,
320 size_t len);
321
327const char *copp_version(void);
328
350
376
430
456
623
657
668
690
720typedef struct CoppMatrixViewF64 {
724 const double *data;
728 size_t rows;
732 size_t cols;
747
753#ifdef __cplusplus
754#define COPP_MATRIX_VIEW_F64_COLUMN_MAJOR(data_, rows_, cols_) \
755 CoppMatrixViewF64{(data_), (rows_), (cols_), COPP_MATRIX_LAYOUT_COLUMN_MAJOR, (rows_)}
756#else
757#define COPP_MATRIX_VIEW_F64_COLUMN_MAJOR(data_, rows_, cols_) \
758 ((struct CoppMatrixViewF64){(data_), (rows_), (cols_), COPP_MATRIX_LAYOUT_COLUMN_MAJOR, (rows_)})
759#endif
760
767#ifdef __cplusplus
768#define COPP_MATRIX_VIEW_F64_ROW_MAJOR(data_, rows_, cols_) \
769 CoppMatrixViewF64{(data_), (rows_), (cols_), COPP_MATRIX_LAYOUT_ROW_MAJOR, (cols_)}
770#else
771#define COPP_MATRIX_VIEW_F64_ROW_MAJOR(data_, rows_, cols_) \
772 ((struct CoppMatrixViewF64){(data_), (rows_), (cols_), COPP_MATRIX_LAYOUT_ROW_MAJOR, (cols_)})
773#endif
774
781typedef struct CoppSliceF64 {
785 const double *data;
789 size_t len;
791
799typedef struct CoppSliceMutF64 {
803 double *data;
807 size_t len;
809
828typedef struct CoppVecF64 {
832 double *data;
836 size_t len;
840 size_t capacity;
841} CoppVecF64;
842
849typedef struct CoppVecUsize {
853 size_t *data;
857 size_t len;
861 size_t capacity;
863
886typedef struct CoppMatrixF64 {
890 double *data;
894 size_t rows;
898 size_t cols;
903 size_t capacity;
905
914
923
932
939struct CoppProfile3rd;
940
968 struct CoppSliceF64 x,
969 struct CoppVecF64 *out_a);
970
1000 struct CoppSliceF64 x,
1001 size_t num_stationary_start,
1002 size_t num_stationary_end,
1003 struct CoppProfile3rd *out_profile);
1004
1006
1007#ifdef __cplusplus
1008}
1009#endif
1010
1011#endif /* COPP_CORE_H */
const char * copp_status_message(enum CoppStatus status)
Return a short static message for a COPP status code.
CoppClarabelSolverStatus
Clarabel solver status returned by SOCP expert results.
Definition core.h:380
const char * copp_version(void)
Return the COPP library version.
enum CoppStatus copp_clarabel_solution_to_profile_3rd(struct CoppSliceF64 s, struct CoppSliceF64 x, size_t num_stationary_start, size_t num_stationary_end, struct CoppProfile3rd *out_profile)
Extract a third-order COPP profile from a Clarabel primal solution.
void copp_vec_usize_free(struct CoppVecUsize vec)
Release a library-owned usize vector returned by COPP.
enum CoppStatus copp_last_error_code(void)
Return the status code associated with the current thread's last error.
CoppClarabelDirectSolveMethod
Direct linear solver method forwarded to Clarabel.
Definition core.h:354
CoppStatus
C ABI status code returned by COPP FFI functions.
Definition core.h:34
enum CoppStatus copp_set_last_error_message_n(enum CoppStatus status, const char *message, size_t len)
Set the current thread's last detailed error message from a byte slice.
void copp_clear_last_error(void)
Clear the current thread's last detailed error message.
enum CoppStatus copp_last_error_message_copy(char *buffer, size_t capacity, size_t *out_len)
Copy the current thread's last UTF-8 error message into a caller buffer.
enum CoppStatus copp_clarabel_solution_to_profile_2nd(size_t s_len, struct CoppSliceF64 x, struct CoppVecF64 *out_a)
Extract a second-order COPP profile from a Clarabel primal solution.
void copp_vec_f64_free(struct CoppVecF64 vec)
Release a library-owned f64 vector returned by COPP.
size_t copp_last_error_message_len(void)
Return the length in bytes of the current thread's last UTF-8 error message.
const char * copp_last_error_message(void)
Return the current thread's last detailed error message as UTF-8.
enum CoppStatus copp_clarabel_default_options(struct CoppClarabelOptions *out_options)
Write default shared Clarabel options into out_options.
void copp_matrix_f64_free(struct CoppMatrixF64 matrix)
Release a library-owned f64 matrix returned by COPP.
enum CoppStatus copp_set_last_error_message(enum CoppStatus status, const char *message)
Set the current thread's last detailed error message from a C string.
CoppMatrixLayout
Matrix memory layout used by CoppMatrixViewF64.
Definition core.h:678
CoppVerbosity
C ABI verbosity level for solver diagnostics.
Definition core.h:332
@ COPP_CLARABEL_SOLVER_STATUS_CALLBACK_TERMINATED
Solver terminated by callback.
Definition core.h:428
@ COPP_CLARABEL_SOLVER_STATUS_SOLVED
Solver terminated with a solution.
Definition core.h:388
@ COPP_CLARABEL_SOLVER_STATUS_ALMOST_DUAL_INFEASIBLE
Problem is dual infeasible with reduced accuracy.
Definition core.h:408
@ COPP_CLARABEL_SOLVER_STATUS_PRIMAL_INFEASIBLE
Problem is primal infeasible.
Definition core.h:392
@ COPP_CLARABEL_SOLVER_STATUS_INSUFFICIENT_PROGRESS
Solver terminated due to lack of progress.
Definition core.h:424
@ COPP_CLARABEL_SOLVER_STATUS_DUAL_INFEASIBLE
Problem is dual infeasible.
Definition core.h:396
@ COPP_CLARABEL_SOLVER_STATUS_ALMOST_SOLVED
Solver terminated with a reduced-accuracy solution.
Definition core.h:400
@ COPP_CLARABEL_SOLVER_STATUS_UNSOLVED
Solver has not run.
Definition core.h:384
@ COPP_CLARABEL_SOLVER_STATUS_MAX_ITERATIONS
Iteration limit reached before an accepted solution or certificate.
Definition core.h:412
@ COPP_CLARABEL_SOLVER_STATUS_NUMERICAL_ERROR
Solver terminated with a numerical error.
Definition core.h:420
@ COPP_CLARABEL_SOLVER_STATUS_MAX_TIME
Time limit reached before an accepted solution or certificate.
Definition core.h:416
@ COPP_CLARABEL_SOLVER_STATUS_ALMOST_PRIMAL_INFEASIBLE
Problem is primal infeasible with reduced accuracy.
Definition core.h:404
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_MKL
Use the optional MKL Pardiso backend when compiled into Clarabel.
Definition core.h:370
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_AUTO
Let Clarabel choose the direct solver.
Definition core.h:358
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_PANUA
Use the optional Panua Pardiso backend when compiled into Clarabel.
Definition core.h:374
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_FAER
Use the optional FAER sparse backend when compiled into Clarabel.
Definition core.h:366
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_QDLDL
Use Clarabel's QDLDL backend.
Definition core.h:362
@ COPP_STATUS_NULL_POINTER
A required pointer argument was null.
Definition core.h:42
@ COPP_STATUS_PATH_SINGULAR_SYSTEM
Internal spline/path linear system is singular.
Definition core.h:146
@ COPP_STATUS_INVALID_ARGUMENT
An unsupported enum value or option was provided through the C ABI.
Definition core.h:54
@ COPP_STATUS_CONSTRAINT_NO_MATCH_ORDER
Constraint input ordering does not match the expected contract.
Definition core.h:78
@ COPP_STATUS_CONSTRAINT_NO_MATCH_DIMENSIONS
Constraint input dimensions do not match the expected shape.
Definition core.h:74
@ COPP_STATUS_PATH_INVALID_DIMENSION
Path dimension is invalid.
Definition core.h:118
@ COPP_STATUS_SOLVER_INVALID_OPTIONS
Solver rejected the provided options.
Definition core.h:166
@ COPP_STATUS_PATH_NOT_ENOUGH_WAYPOINTS
Not enough waypoints were supplied to build a path.
Definition core.h:134
@ COPP_STATUS_PANIC
COPP caught an internal panic at the C ABI boundary.
Definition core.h:58
@ COPP_STATUS_CONSTRAINT_INFEASIBLE_REFERENCE
Reference profile is infeasible under current constraints.
Definition core.h:110
@ COPP_STATUS_CONSTRAINT_NO_GIVEN_Q_INFO
Required path derivative data is missing.
Definition core.h:98
@ COPP_STATUS_CONSTRAINT_OUT_OF_S_BOUNDS
Requested station interval is outside the stored constraint range.
Definition core.h:86
@ COPP_STATUS_PATH_UNSUPPORTED_DERIVATIVE_ORDER
Requested path derivative order is not supported by this path.
Definition core.h:150
@ COPP_STATUS_CONSTRAINT_NON_POSITIVE_LINEARIZATION_FLOOR
Linearization floor is not strictly positive.
Definition core.h:94
@ COPP_STATUS_CONSTRAINT_INVALID_SIGNED_BOUNDS
Signed upper/lower bounds do not satisfy strict feasibility rules.
Definition core.h:82
@ COPP_STATUS_CONSTRAINT_NON_POSITIVE_A
Profile a violates positivity requirements.
Definition core.h:90
@ COPP_STATUS_IO_ERROR
Filesystem or OS I/O failure.
Definition core.h:66
@ COPP_STATUS_INVALID_SHAPE
A matrix/vector shape was invalid.
Definition core.h:50
@ COPP_STATUS_ALLOCATION_FAILED
A memory allocation failed or an output buffer could not be created.
Definition core.h:62
@ COPP_STATUS_PATH_UNSUPPORTED_BOUNDARY
Requested spline boundary condition is unsupported.
Definition core.h:142
@ COPP_STATUS_INVALID_LENGTH
A slice length or vector length was invalid.
Definition core.h:46
@ COPP_STATUS_SOLVER_UNBOUNDED
Solver reported unboundedness.
Definition core.h:158
@ COPP_STATUS_PATH_DIMENSION_MISMATCH
Path matrix/tensor dimensions are incompatible.
Definition core.h:130
@ COPP_STATUS_CONSTRAINT_EMPTY_INTERVAL
Requested constraint interval is empty.
Definition core.h:114
@ COPP_STATUS_SOLVER_OTHER
Backend-specific or uncategorized solver/runtime error.
Definition core.h:178
@ COPP_STATUS_CONSTRAINT_NO_DYNAMIC
Required dynamic-model data is unavailable.
Definition core.h:106
@ COPP_STATUS_OK
Operation completed successfully.
Definition core.h:38
@ COPP_STATUS_CONSTRAINT_NON_INCREASING_S
Constraint input s is not strictly increasing.
Definition core.h:70
@ COPP_STATUS_CLARABEL_SOLVER_ERROR
Clarabel returned an internal solver error.
Definition core.h:170
@ COPP_STATUS_CLARABEL_SOLVER_STATUS
Clarabel terminated with a non-success status.
Definition core.h:174
@ COPP_STATUS_PATH_OUT_OF_RANGE_S
Query parameter is outside the configured path range.
Definition core.h:138
@ COPP_STATUS_PATH_INVALID_ORDER
Spline order is invalid.
Definition core.h:126
@ COPP_STATUS_ROBOT_DYNAMICS_ERROR
User-provided robot inverse dynamics failed.
Definition core.h:182
@ COPP_STATUS_SOLVER_INVALID_INPUT
Solver rejected the input model or data.
Definition core.h:162
@ COPP_STATUS_SOLVER_INFEASIBLE
Solver reported infeasibility.
Definition core.h:154
@ COPP_STATUS_PATH_INVALID_RANGE
Path parameter range is invalid.
Definition core.h:122
@ COPP_STATUS_CONSTRAINT_LINEAR_JERK_NOT_AVAILABLE
Linearized jerk constraints are unavailable for the requested station.
Definition core.h:102
@ COPP_MATRIX_LAYOUT_COLUMN_MAJOR
Column-major storage: element (row, col) is at data[row + col * leading_dim].
Definition core.h:683
@ COPP_MATRIX_LAYOUT_ROW_MAJOR
Row-major storage: element (row, col) is at data[col + row * leading_dim].
Definition core.h:688
@ COPP_VERBOSITY_DEBUG
Detailed debug information will be emitted.
Definition core.h:344
@ COPP_VERBOSITY_SILENT
No log will be emitted.
Definition core.h:336
@ COPP_VERBOSITY_SUMMARY
Only summary information will be emitted.
Definition core.h:340
@ COPP_VERBOSITY_TRACE
Very detailed trace information will be emitted.
Definition core.h:348
Linear solver metadata reported by Clarabel.
Definition core.h:434
bool direct
Whether the linear solver used a direct factorization method.
Definition core.h:446
size_t nnz_a
Number of nonzeros in the linear system.
Definition core.h:450
size_t threads
Number of threads used by the linear solver.
Definition core.h:442
enum CoppClarabelDirectSolveMethod method
Linear solver method name mapped to COPP's stable enum.
Definition core.h:438
size_t nnz_l
Number of nonzeros in the factored system.
Definition core.h:454
Shared Clarabel options for COPP SOCP solvers.
Definition core.h:627
struct CoppClarabelSettings clarabel_settings
Advanced raw Clarabel solver settings.
Definition core.h:655
bool allow_callback_terminated
Accept Clarabel status CallbackTerminated as usable.
Definition core.h:647
bool allow_insufficient_progress
Accept Clarabel status InsufficientProgress as usable.
Definition core.h:651
enum CoppVerbosity verbosity
Crate-level verbosity for COPP assembly diagnostics.
Definition core.h:631
bool allow_almost_solved
Accept Clarabel status AlmostSolved as usable.
Definition core.h:635
bool allow_max_iterations
Accept Clarabel status MaxIterations as usable.
Definition core.h:639
bool allow_max_time
Accept Clarabel status MaxTime as usable.
Definition core.h:643
Advanced raw Clarabel solver settings.
Definition core.h:465
double reduced_tol_infeas_rel
Reduced relative infeasibility tolerance for almost-solved status.
Definition core.h:525
double tol_ktratio
Kappa/tau tolerance.
Definition core.h:505
double min_switch_step_length
Minimum step length for asymmetric-cone switching.
Definition core.h:553
bool equilibrate_enable
Enable data equilibration before solving.
Definition core.h:533
double min_terminate_step_length
Minimum step length for termination checks.
Definition core.h:557
double reduced_tol_infeas_abs
Reduced absolute infeasibility tolerance for almost-solved status.
Definition core.h:521
bool dynamic_regularization_enable
Enable dynamic KKT regularization.
Definition core.h:585
double dynamic_regularization_eps
Dynamic regularization threshold.
Definition core.h:589
uint32_t equilibrate_max_iter
Maximum number of equilibration iterations.
Definition core.h:537
uint32_t iterative_refinement_max_iter
Iterative-refinement maximum iterations.
Definition core.h:609
bool presolve_enable
Enable Clarabel presolve.
Definition core.h:617
bool input_sparse_dropzeros
Drop structural zeros from sparse inputs before solving.
Definition core.h:621
uint32_t max_threads
Maximum solver threads.
Definition core.h:561
double reduced_tol_feas
Reduced feasibility tolerance for almost-solved status.
Definition core.h:517
double equilibrate_max_scaling
Maximum equilibration scaling.
Definition core.h:545
bool direct_kkt_solver
Whether to use a direct KKT solver.
Definition core.h:565
double tol_infeas_rel
Relative infeasibility tolerance.
Definition core.h:501
double time_limit
Maximum solve time in seconds.
Definition core.h:473
double static_regularization_proportional
Static KKT regularization proportional term.
Definition core.h:581
double equilibrate_min_scaling
Minimum equilibration scaling.
Definition core.h:541
enum CoppClarabelDirectSolveMethod direct_solve_method
Direct linear solver method.
Definition core.h:569
double iterative_refinement_reltol
Iterative-refinement relative tolerance.
Definition core.h:601
uint32_t max_iter
Maximum number of interior-point iterations.
Definition core.h:469
double iterative_refinement_stop_ratio
Iterative-refinement stalling ratio.
Definition core.h:613
double linesearch_backtrack_step
Backtracking factor used by the line search.
Definition core.h:549
double tol_feas
Primal/dual feasibility tolerance.
Definition core.h:493
bool iterative_refinement_enable
Enable iterative refinement for direct solves.
Definition core.h:597
double tol_gap_rel
Relative duality-gap tolerance.
Definition core.h:489
double tol_gap_abs
Absolute duality-gap tolerance.
Definition core.h:485
double iterative_refinement_abstol
Iterative-refinement absolute tolerance.
Definition core.h:605
double reduced_tol_gap_rel
Reduced relative duality-gap tolerance for almost-solved status.
Definition core.h:513
double max_step_fraction
Maximum interior-point step length.
Definition core.h:481
double dynamic_regularization_delta
Dynamic regularization shift.
Definition core.h:593
double reduced_tol_gap_abs
Reduced absolute duality-gap tolerance for almost-solved status.
Definition core.h:509
bool static_regularization_enable
Enable static KKT regularization.
Definition core.h:573
double tol_infeas_abs
Absolute infeasibility tolerance.
Definition core.h:497
double static_regularization_constant
Static KKT regularization constant.
Definition core.h:577
double reduced_tol_ktratio
Reduced kappa/tau tolerance for almost-solved status.
Definition core.h:529
bool verbose
Enable Clarabel's internal solver log.
Definition core.h:477
Library-owned column-major f64 matrix returned to C.
Definition core.h:886
size_t cols
Number of matrix columns.
Definition core.h:898
size_t rows
Number of matrix rows.
Definition core.h:894
double * data
Pointer to the first column-major element, or null for an empty matrix.
Definition core.h:890
size_t capacity
Allocation capacity in number of double elements, used only by copp_matrix_f64_free.
Definition core.h:903
Borrowed immutable f64 matrix passed from C to COPP.
Definition core.h:720
size_t leading_dim
Leading dimension / physical stride.
Definition core.h:745
enum CoppMatrixLayout layout
Matrix memory layout.
Definition core.h:736
const double * data
Pointer to the first matrix element.
Definition core.h:724
size_t rows
Number of matrix rows.
Definition core.h:728
size_t cols
Number of matrix columns.
Definition core.h:732
Owned third-order profile returned by TOPP3/COPP3 C ABI solvers.
size_t num_stationary_end
Effective stationary interval count at the end.
size_t num_stationary_start
Effective stationary interval count at the start.
Borrowed immutable f64 slice passed from C to COPP.
Definition core.h:781
const double * data
Pointer to the first element.
Definition core.h:785
size_t len
Number of elements.
Definition core.h:789
Borrowed mutable f64 slice passed from C to COPP.
Definition core.h:799
double * data
Pointer to the first mutable element.
Definition core.h:803
size_t len
Number of elements.
Definition core.h:807
Library-owned f64 vector returned to C.
Definition core.h:828
size_t capacity
Allocation capacity, used only by copp_vec_f64_free.
Definition core.h:840
size_t len
Number of initialized elements.
Definition core.h:836
double * data
Pointer to the first element, or null for an empty vector.
Definition core.h:832
Library-owned usize vector returned to C.
Definition core.h:849
size_t len
Number of initialized elements.
Definition core.h:857
size_t capacity
Allocation capacity, used only by copp_vec_usize_free.
Definition core.h:861
size_t * data
Pointer to the first element, or null for an empty vector.
Definition core.h:853