COPP C ABI
C interface for COPP trajectory optimization
Loading...
Searching...
No Matches
Copp_copp3

Files

file  bindings/c/include/copp/copp3.h
 COPP3-SOCP solver APIs.

Data Structures

struct  Copp3SocpResult
 Compact COPP3-SOCP expert result returned to C. More...

Functions

enum CoppStatus copp3_socp (struct Copp3Problem problem, struct CoppClarabelOptions options, struct CoppProfile3rd *out_profile)
 Solve a COPP3-SOCP problem.
enum CoppStatus copp3_socp_expert (struct Copp3Problem problem, struct CoppClarabelOptions options, struct Copp3SocpResult *out_result)
 Solve a COPP3-SOCP problem and always return Clarabel diagnostics.
void copp3_socp_result_free (struct Copp3SocpResult result)
 Release memory owned by a Copp3SocpResult.

Detailed Description

Function Documentation

◆ copp3_socp()

enum CoppStatus copp3_socp ( struct Copp3Problem problem,
struct CoppClarabelOptions options,
struct CoppProfile3rd * out_profile )

Solve a COPP3-SOCP problem.

This C ABI builds an internal COPP3 problem from the borrowed Copp3Problem, forwards options to the Clarabel backend, and returns only the accepted third-order profile.

Supported objective kinds are Time, Linear, ThermalEnergy, and TotalVariationTorque. Torque objectives use the robot's stored inverse-dynamics callback when provided, otherwise point dynamics (tau = ddq) is used.

On success, out_profile owns COPP-allocated a and b vectors and must be released with copp_profile_3rd_free.

Example

The example below solves COPP3-SOCP with Clarabel options and releases the accepted third-order profile.

struct CoppClarabelOptions options;
struct Copp3Problem problem = {
robot, 0, (struct CoppSliceF64){a_seed.data, a_seed.len},
0.0, 0.0, 0.0, 0.0, 1, 1, 1e-10,
objectives, num_objectives,
};
struct CoppProfile3rd profile = {{0}, {0}, 0, 0};
check(copp3_socp(problem, options, &profile));
enum CoppStatus copp3_socp(struct Copp3Problem problem, struct CoppClarabelOptions options, struct CoppProfile3rd *out_profile)
Solve a COPP3-SOCP problem.
enum CoppStatus copp_clarabel_default_options(struct CoppClarabelOptions *out_options)
Write default shared Clarabel options into out_options.
void copp_profile_3rd_free(struct CoppProfile3rd profile)
Release a third-order profile returned by COPP.
Borrowed value descriptor for a COPP3 problem solved from C.
struct CoppRobot * robot
Mutable robot handle that owns station-indexed constraint storage.
Shared Clarabel options for COPP SOCP solvers.
Definition core.h:627
Owned third-order profile returned by TOPP3/COPP3 C ABI solvers.
Borrowed immutable f64 slice passed from C to COPP.
Definition core.h:781
Safety
problem.robot must be a non-null mutable handle returned by copp_robot_create and must remain valid for the duration of this call. problem.objectives must be valid for problem.num_objectives reads when non-zero. If the robot has a stored inverse-dynamics callback, it must remain valid for this call. The solver builds the internal problem by linearizing third-order constraints, which mutates the robot's internal constraint cache. out_profile must be valid for one CoppProfile3rd write.

◆ copp3_socp_expert()

enum CoppStatus copp3_socp_expert ( struct Copp3Problem problem,
struct CoppClarabelOptions options,
struct Copp3SocpResult * out_result )

Solve a COPP3-SOCP problem and always return Clarabel diagnostics.

This expert entry follows the advanced-diagnostics convention: true runtime failures still return a non-OK CoppStatus, but non-accepted Clarabel statuses are reported inside out_result with has_profile == false and the function returns COPP_STATUS_OK.

Use the same advanced-diagnostics pattern as copp2_socp_expert. The result type is Copp3SocpResult, and has_profile replaces has_a.

Safety
Same safety requirements as copp3_socp. out_result must be valid for one Copp3SocpResult write and must later be released with copp3_socp_result_free.

◆ copp3_socp_result_free()

void copp3_socp_result_free ( struct Copp3SocpResult result)

Release memory owned by a Copp3SocpResult.

Passing an already-freed result is invalid. Prefer freeing the full result with this function instead of freeing result.profile manually.