COPP C ABI 0.2.3
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 {
187} CoppStatus;
188
194const char *copp_status_message(enum CoppStatus status);
195
202
210const char *copp_last_error_message(void);
211
218
266enum CoppStatus copp_last_error_message_copy(char *buffer, size_t capacity, size_t *out_len);
267
272
310enum CoppStatus copp_set_last_error_message(enum CoppStatus status, const char *message);
311
323 const char *message,
324 size_t len);
325
331const char *copp_version(void);
332
340#define COPP_VERSION_MAJOR 0
341
345#define COPP_VERSION_MINOR 2
346
350#define COPP_VERSION_PATCH 3
351
358#define COPP_VERSION_STRING "0.2.3"
359
381
407
461
487
654
688
699
721
751typedef struct CoppMatrixViewF64 {
755 const double *data;
759 size_t rows;
763 size_t cols;
778
784#ifdef __cplusplus
785#define COPP_MATRIX_VIEW_F64_COLUMN_MAJOR(data_, rows_, cols_) \
786 CoppMatrixViewF64{(data_), (rows_), (cols_), COPP_MATRIX_LAYOUT_COLUMN_MAJOR, (rows_)}
787#else
788#define COPP_MATRIX_VIEW_F64_COLUMN_MAJOR(data_, rows_, cols_) \
789 ((struct CoppMatrixViewF64){(data_), (rows_), (cols_), COPP_MATRIX_LAYOUT_COLUMN_MAJOR, (rows_)})
790#endif
791
798#ifdef __cplusplus
799#define COPP_MATRIX_VIEW_F64_ROW_MAJOR(data_, rows_, cols_) \
800 CoppMatrixViewF64{(data_), (rows_), (cols_), COPP_MATRIX_LAYOUT_ROW_MAJOR, (cols_)}
801#else
802#define COPP_MATRIX_VIEW_F64_ROW_MAJOR(data_, rows_, cols_) \
803 ((struct CoppMatrixViewF64){(data_), (rows_), (cols_), COPP_MATRIX_LAYOUT_ROW_MAJOR, (cols_)})
804#endif
805
812typedef struct CoppSliceF64 {
816 const double *data;
820 size_t len;
822
830typedef struct CoppSliceMutF64 {
834 double *data;
838 size_t len;
840
847typedef struct CoppSliceUsize {
851 const size_t *data;
855 size_t len;
857
876typedef struct CoppVecF64 {
880 double *data;
884 size_t len;
888 size_t capacity;
889} CoppVecF64;
890
897typedef struct CoppVecUsize {
901 size_t *data;
905 size_t len;
909 size_t capacity;
911
934typedef struct CoppMatrixF64 {
938 double *data;
942 size_t rows;
946 size_t cols;
951 size_t capacity;
953
962
971
980
987struct CoppProfile3rd;
988
1016 struct CoppSliceF64 x,
1017 struct CoppVecF64 *out_a);
1018
1048 struct CoppSliceF64 x,
1049 size_t num_stationary_start,
1050 size_t num_stationary_end,
1051 struct CoppProfile3rd *out_profile);
1052
1054
1055#ifdef __cplusplus
1056}
1057#endif
1058
1059#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:411
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:385
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:709
CoppVerbosity
C ABI verbosity level for solver diagnostics.
Definition core.h:363
@ COPP_CLARABEL_SOLVER_STATUS_CALLBACK_TERMINATED
Solver terminated by callback.
Definition core.h:459
@ COPP_CLARABEL_SOLVER_STATUS_SOLVED
Solver terminated with a solution.
Definition core.h:419
@ COPP_CLARABEL_SOLVER_STATUS_ALMOST_DUAL_INFEASIBLE
Problem is dual infeasible with reduced accuracy.
Definition core.h:439
@ COPP_CLARABEL_SOLVER_STATUS_PRIMAL_INFEASIBLE
Problem is primal infeasible.
Definition core.h:423
@ COPP_CLARABEL_SOLVER_STATUS_INSUFFICIENT_PROGRESS
Solver terminated due to lack of progress.
Definition core.h:455
@ COPP_CLARABEL_SOLVER_STATUS_DUAL_INFEASIBLE
Problem is dual infeasible.
Definition core.h:427
@ COPP_CLARABEL_SOLVER_STATUS_ALMOST_SOLVED
Solver terminated with a reduced-accuracy solution.
Definition core.h:431
@ COPP_CLARABEL_SOLVER_STATUS_UNSOLVED
Solver has not run.
Definition core.h:415
@ COPP_CLARABEL_SOLVER_STATUS_MAX_ITERATIONS
Iteration limit reached before an accepted solution or certificate.
Definition core.h:443
@ COPP_CLARABEL_SOLVER_STATUS_NUMERICAL_ERROR
Solver terminated with a numerical error.
Definition core.h:451
@ COPP_CLARABEL_SOLVER_STATUS_MAX_TIME
Time limit reached before an accepted solution or certificate.
Definition core.h:447
@ COPP_CLARABEL_SOLVER_STATUS_ALMOST_PRIMAL_INFEASIBLE
Problem is primal infeasible with reduced accuracy.
Definition core.h:435
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_MKL
Use the optional MKL Pardiso backend when compiled into Clarabel.
Definition core.h:401
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_AUTO
Let Clarabel choose the direct solver.
Definition core.h:389
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_PANUA
Use the optional Panua Pardiso backend when compiled into Clarabel.
Definition core.h:405
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_FAER
Use the optional FAER sparse backend when compiled into Clarabel.
Definition core.h:397
@ COPP_CLARABEL_DIRECT_SOLVE_METHOD_QDLDL
Use Clarabel's QDLDL backend.
Definition core.h:393
@ 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:170
@ 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:162
@ 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:182
@ 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:174
@ COPP_STATUS_PATH_SMOOTHING
Tolerance-bounded waypoint fitting failed.
Definition core.h:154
@ COPP_STATUS_CLARABEL_SOLVER_STATUS
Clarabel terminated with a non-success status.
Definition core.h:178
@ 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:186
@ COPP_STATUS_SOLVER_INVALID_INPUT
Solver rejected the input model or data.
Definition core.h:166
@ COPP_STATUS_SOLVER_INFEASIBLE
Solver reported infeasibility.
Definition core.h:158
@ 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:714
@ COPP_MATRIX_LAYOUT_ROW_MAJOR
Row-major storage: element (row, col) is at data[col + row * leading_dim].
Definition core.h:719
@ COPP_VERBOSITY_DEBUG
Detailed debug information will be emitted.
Definition core.h:375
@ COPP_VERBOSITY_SILENT
No log will be emitted.
Definition core.h:367
@ COPP_VERBOSITY_SUMMARY
Only summary information will be emitted.
Definition core.h:371
@ COPP_VERBOSITY_TRACE
Very detailed trace information will be emitted.
Definition core.h:379
Linear solver metadata reported by Clarabel.
Definition core.h:465
bool direct
Whether the linear solver used a direct factorization method.
Definition core.h:477
size_t nnz_a
Number of nonzeros in the linear system.
Definition core.h:481
size_t threads
Number of threads used by the linear solver.
Definition core.h:473
enum CoppClarabelDirectSolveMethod method
Linear solver method name mapped to COPP's stable enum.
Definition core.h:469
size_t nnz_l
Number of nonzeros in the factored system.
Definition core.h:485
Shared Clarabel options for COPP SOCP solvers.
Definition core.h:658
struct CoppClarabelSettings clarabel_settings
Advanced raw Clarabel solver settings.
Definition core.h:686
bool allow_callback_terminated
Accept Clarabel status CallbackTerminated as usable.
Definition core.h:678
bool allow_insufficient_progress
Accept Clarabel status InsufficientProgress as usable.
Definition core.h:682
enum CoppVerbosity verbosity
Crate-level verbosity for COPP assembly diagnostics.
Definition core.h:662
bool allow_almost_solved
Accept Clarabel status AlmostSolved as usable.
Definition core.h:666
bool allow_max_iterations
Accept Clarabel status MaxIterations as usable.
Definition core.h:670
bool allow_max_time
Accept Clarabel status MaxTime as usable.
Definition core.h:674
Advanced raw Clarabel solver settings.
Definition core.h:496
double reduced_tol_infeas_rel
Reduced relative infeasibility tolerance for almost-solved status.
Definition core.h:556
double tol_ktratio
Kappa/tau tolerance.
Definition core.h:536
double min_switch_step_length
Minimum step length for asymmetric-cone switching.
Definition core.h:584
bool equilibrate_enable
Enable data equilibration before solving.
Definition core.h:564
double min_terminate_step_length
Minimum step length for termination checks.
Definition core.h:588
double reduced_tol_infeas_abs
Reduced absolute infeasibility tolerance for almost-solved status.
Definition core.h:552
bool dynamic_regularization_enable
Enable dynamic KKT regularization.
Definition core.h:616
double dynamic_regularization_eps
Dynamic regularization threshold.
Definition core.h:620
uint32_t equilibrate_max_iter
Maximum number of equilibration iterations.
Definition core.h:568
uint32_t iterative_refinement_max_iter
Iterative-refinement maximum iterations.
Definition core.h:640
bool presolve_enable
Enable Clarabel presolve.
Definition core.h:648
bool input_sparse_dropzeros
Drop structural zeros from sparse inputs before solving.
Definition core.h:652
uint32_t max_threads
Maximum solver threads.
Definition core.h:592
double reduced_tol_feas
Reduced feasibility tolerance for almost-solved status.
Definition core.h:548
double equilibrate_max_scaling
Maximum equilibration scaling.
Definition core.h:576
bool direct_kkt_solver
Whether to use a direct KKT solver.
Definition core.h:596
double tol_infeas_rel
Relative infeasibility tolerance.
Definition core.h:532
double time_limit
Maximum solve time in seconds.
Definition core.h:504
double static_regularization_proportional
Static KKT regularization proportional term.
Definition core.h:612
double equilibrate_min_scaling
Minimum equilibration scaling.
Definition core.h:572
enum CoppClarabelDirectSolveMethod direct_solve_method
Direct linear solver method.
Definition core.h:600
double iterative_refinement_reltol
Iterative-refinement relative tolerance.
Definition core.h:632
uint32_t max_iter
Maximum number of interior-point iterations.
Definition core.h:500
double iterative_refinement_stop_ratio
Iterative-refinement stalling ratio.
Definition core.h:644
double linesearch_backtrack_step
Backtracking factor used by the line search.
Definition core.h:580
double tol_feas
Primal/dual feasibility tolerance.
Definition core.h:524
bool iterative_refinement_enable
Enable iterative refinement for direct solves.
Definition core.h:628
double tol_gap_rel
Relative duality-gap tolerance.
Definition core.h:520
double tol_gap_abs
Absolute duality-gap tolerance.
Definition core.h:516
double iterative_refinement_abstol
Iterative-refinement absolute tolerance.
Definition core.h:636
double reduced_tol_gap_rel
Reduced relative duality-gap tolerance for almost-solved status.
Definition core.h:544
double max_step_fraction
Maximum interior-point step length.
Definition core.h:512
double dynamic_regularization_delta
Dynamic regularization shift.
Definition core.h:624
double reduced_tol_gap_abs
Reduced absolute duality-gap tolerance for almost-solved status.
Definition core.h:540
bool static_regularization_enable
Enable static KKT regularization.
Definition core.h:604
double tol_infeas_abs
Absolute infeasibility tolerance.
Definition core.h:528
double static_regularization_constant
Static KKT regularization constant.
Definition core.h:608
double reduced_tol_ktratio
Reduced kappa/tau tolerance for almost-solved status.
Definition core.h:560
bool verbose
Enable Clarabel's internal solver log.
Definition core.h:508
Library-owned column-major f64 matrix returned to C.
Definition core.h:934
size_t cols
Number of matrix columns.
Definition core.h:946
size_t rows
Number of matrix rows.
Definition core.h:942
double * data
Pointer to the first column-major element, or null for an empty matrix.
Definition core.h:938
size_t capacity
Allocation capacity in number of double elements, used only by copp_matrix_f64_free.
Definition core.h:951
Borrowed immutable f64 matrix passed from C to COPP.
Definition core.h:751
size_t leading_dim
Leading dimension / physical stride.
Definition core.h:776
enum CoppMatrixLayout layout
Matrix memory layout.
Definition core.h:767
const double * data
Pointer to the first matrix element.
Definition core.h:755
size_t rows
Number of matrix rows.
Definition core.h:759
size_t cols
Number of matrix columns.
Definition core.h:763
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:812
const double * data
Pointer to the first element.
Definition core.h:816
size_t len
Number of elements.
Definition core.h:820
Borrowed mutable f64 slice passed from C to COPP.
Definition core.h:830
double * data
Pointer to the first mutable element.
Definition core.h:834
size_t len
Number of elements.
Definition core.h:838
Borrowed immutable size_t slice passed from C to COPP.
Definition core.h:847
const size_t * data
Pointer to the first element.
Definition core.h:851
size_t len
Number of elements.
Definition core.h:855
Library-owned f64 vector returned to C.
Definition core.h:876
size_t capacity
Allocation capacity, used only by copp_vec_f64_free.
Definition core.h:888
size_t len
Number of initialized elements.
Definition core.h:884
double * data
Pointer to the first element, or null for an empty vector.
Definition core.h:880
Library-owned usize vector returned to C.
Definition core.h:897
size_t len
Number of initialized elements.
Definition core.h:905
size_t capacity
Allocation capacity, used only by copp_vec_usize_free.
Definition core.h:909
size_t * data
Pointer to the first element, or null for an empty vector.
Definition core.h:901