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

Files

file  bindings/c/include/copp/interpolation.h
 Second- and third-order interpolation utilities.

Functions

enum CoppStatus copp_a_to_b_2nd (struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppVecF64 *out_b)
 Compute TOPP2 segment profile b from node profile a.
enum CoppStatus copp_s_to_t_2nd (struct CoppSliceF64 s, struct CoppSliceF64 a, double t0, double *out_t_final, struct CoppVecF64 *out_t_s)
 Compute cumulative TOPP2 time profile t(s) from node profile a(s).
enum CoppStatus copp_t_to_s_uniform_2nd (struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppSliceF64 t_s, double t0, double dt, bool include_final, struct CoppVecF64 *out_s_t)
 Interpolate s(t) from TOPP2 profiles using a uniform time grid.
enum CoppStatus copp_t_to_s_non_uniform_2nd (struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppSliceF64 t_s, struct CoppSliceF64 t_sample, struct CoppVecF64 *out_s_t)
 Interpolate s(t) from TOPP2 profiles using caller-provided time samples.
enum CoppStatus copp_s_to_t_3rd (struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppSliceF64 b, size_t num_stationary_start, size_t num_stationary_end, double t0, double *out_t_final, struct CoppVecF64 *out_t_s)
 Compute cumulative TOPP3/COPP3 time profile t(s) from node profiles a(s) = dot{s}^2 and b(s) = ddot{s}.
enum CoppStatus copp_t_to_s_uniform_3rd (struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppSliceF64 b, size_t num_stationary_start, size_t num_stationary_end, struct CoppSliceF64 t_s, double t0, double dt, bool include_final, struct CoppVecF64 *out_s_t)
 Interpolate s(t) from TOPP3/COPP3 profiles using a uniform time grid.
enum CoppStatus copp_t_to_s_non_uniform_3rd (struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppSliceF64 b, size_t num_stationary_start, size_t num_stationary_end, struct CoppSliceF64 t_s, struct CoppSliceF64 t_sample, struct CoppVecF64 *out_s_t)
 Interpolate s(t) from TOPP3/COPP3 profiles using caller-provided time samples.
enum CoppStatus copp_force_positive_a_3rd (struct CoppSliceF64 s, struct CoppSliceMutF64 a, struct CoppSliceMutF64 b, size_t num_stationary_start, size_t num_stationary_end, double a_min, bool *out_succeed)
 Adjust mutable TOPP3/COPP3 a and b node profiles in place so interpolated a(s) stays strictly positive per interval.

Detailed Description

Function Documentation

◆ copp_a_to_b_2nd()

enum CoppStatus copp_a_to_b_2nd ( struct CoppSliceF64 s,
struct CoppSliceF64 a,
struct CoppVecF64 * out_b )

Compute TOPP2 segment profile b from node profile a.

On success, out_b owns a COPP-allocated vector and must be released with copp_vec_f64_free.

Example

The example below converts a solved second-order node profile into interval-based b values.

struct CoppVecF64 b = {0};
(struct CoppSliceF64){s, n},
(struct CoppSliceF64){a.data, a.len},
&b));
void copp_vec_f64_free(struct CoppVecF64 vec)
Release a library-owned f64 vector returned by COPP.
enum CoppStatus copp_a_to_b_2nd(struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppVecF64 *out_b)
Compute TOPP2 segment profile b from node profile a.
Borrowed immutable f64 slice passed from C to COPP.
Definition core.h:781
Library-owned f64 vector returned to C.
Definition core.h:828
Warning
Safety s.data and a.data must be valid for len reads when their lengths are non-zero. out_b must be valid for one CoppVecF64 write.

◆ copp_s_to_t_2nd()

enum CoppStatus copp_s_to_t_2nd ( struct CoppSliceF64 s,
struct CoppSliceF64 a,
double t0,
double * out_t_final,
struct CoppVecF64 * out_t_s )

Compute cumulative TOPP2 time profile t(s) from node profile a(s).

On success, *out_t_final receives the final time and out_t_s owns a COPP-allocated vector that must be released with copp_vec_f64_free.

Example

The example below converts a TOPP2 a(s) profile into cumulative time samples and the final duration.

double t_final = 0.0;
struct CoppVecF64 t_s = {0};
(struct CoppSliceF64){s, n},
(struct CoppSliceF64){a.data, a.len},
0.0,
&t_final,
&t_s));
enum CoppStatus copp_s_to_t_2nd(struct CoppSliceF64 s, struct CoppSliceF64 a, double t0, double *out_t_final, struct CoppVecF64 *out_t_s)
Compute cumulative TOPP2 time profile t(s) from node profile a(s).
Warning
Safety s.data and a.data must be valid for len reads when their lengths are non-zero. out_t_final must be valid for one double write and out_t_s must be valid for one CoppVecF64 write. C callers can pass the address of ordinary stack variables; heap allocation is not required for these outputs.

◆ copp_t_to_s_uniform_2nd()

enum CoppStatus copp_t_to_s_uniform_2nd ( struct CoppSliceF64 s,
struct CoppSliceF64 a,
struct CoppSliceF64 t_s,
double t0,
double dt,
bool include_final,
struct CoppVecF64 * out_s_t )

Interpolate s(t) from TOPP2 profiles using a uniform time grid.

On success, out_s_t owns a COPP-allocated vector and must be released with copp_vec_f64_free.

Example

The example below resamples a TOPP2 trajectory on a uniform time grid.

struct CoppVecF64 s_t = {0};
(struct CoppSliceF64){s, n},
(struct CoppSliceF64){a.data, a.len},
(struct CoppSliceF64){t_s.data, t_s.len},
0.0,
1e-3,
true,
&s_t));
enum CoppStatus copp_t_to_s_uniform_2nd(struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppSliceF64 t_s, double t0, double dt, bool include_final, struct CoppVecF64 *out_s_t)
Interpolate s(t) from TOPP2 profiles using a uniform time grid.
Warning
Safety s.data, a.data, and t_s.data must be valid for len reads when their lengths are non-zero. out_s_t must be valid for one CoppVecF64 write.

◆ copp_t_to_s_non_uniform_2nd()

enum CoppStatus copp_t_to_s_non_uniform_2nd ( struct CoppSliceF64 s,
struct CoppSliceF64 a,
struct CoppSliceF64 t_s,
struct CoppSliceF64 t_sample,
struct CoppVecF64 * out_s_t )

Interpolate s(t) from TOPP2 profiles using caller-provided time samples.

On success, out_s_t owns a COPP-allocated vector and must be released with copp_vec_f64_free.

Warning
Safety s.data, a.data, t_s.data, and t_sample.data must be valid for len reads when their lengths are non-zero. out_s_t must be valid for one CoppVecF64 write.

◆ copp_s_to_t_3rd()

enum CoppStatus copp_s_to_t_3rd ( struct CoppSliceF64 s,
struct CoppSliceF64 a,
struct CoppSliceF64 b,
size_t num_stationary_start,
size_t num_stationary_end,
double t0,
double * out_t_final,
struct CoppVecF64 * out_t_s )

Compute cumulative TOPP3/COPP3 time profile t(s) from node profiles a(s) = dot{s}^2 and b(s) = ddot{s}.

C callers pass profile parts explicitly: a and b are node-based arrays with length s.len, and num_stationary_* are the effective stationary interval counts at the start and end.

On success, *out_t_final receives the final time and out_t_s owns a COPP-allocated vector that must be released with copp_vec_f64_free.

Example

The example below converts a TOPP3/COPP3 profile into cumulative time samples and the final duration.

double t_final = 0.0;
struct CoppVecF64 t_s = {0};
(struct CoppSliceF64){s, n},
(struct CoppSliceF64){profile.a.data, profile.a.len},
(struct CoppSliceF64){profile.b.data, profile.b.len},
profile.num_stationary_start,
profile.num_stationary_end,
0.0,
&t_final,
&t_s));
enum CoppStatus copp_s_to_t_3rd(struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppSliceF64 b, size_t num_stationary_start, size_t num_stationary_end, double t0, double *out_t_final, struct CoppVecF64 *out_t_s)
Compute cumulative TOPP3/COPP3 time profile t(s) from node profiles a(s) = dot{s}^2 and b(s) = ddot{s...
Warning
Safety s.data, a.data, and b.data must be valid for reads when their lengths are non-zero. out_t_final must be valid for one double write and out_t_s must be valid for one CoppVecF64 write.

◆ copp_t_to_s_uniform_3rd()

enum CoppStatus copp_t_to_s_uniform_3rd ( struct CoppSliceF64 s,
struct CoppSliceF64 a,
struct CoppSliceF64 b,
size_t num_stationary_start,
size_t num_stationary_end,
struct CoppSliceF64 t_s,
double t0,
double dt,
bool include_final,
struct CoppVecF64 * out_s_t )

Interpolate s(t) from TOPP3/COPP3 profiles using a uniform time grid.

C callers pass profile parts explicitly. On success, out_s_t owns a COPP-allocated vector and must be released with copp_vec_f64_free.

Example

The example below resamples a third-order profile on a uniform time grid.

struct CoppVecF64 s_t = {0};
(struct CoppSliceF64){s, n},
(struct CoppSliceF64){profile.a.data, profile.a.len},
(struct CoppSliceF64){profile.b.data, profile.b.len},
profile.num_stationary_start,
profile.num_stationary_end,
(struct CoppSliceF64){t_s.data, t_s.len},
0.0,
1e-3,
true,
&s_t));
enum CoppStatus copp_t_to_s_uniform_3rd(struct CoppSliceF64 s, struct CoppSliceF64 a, struct CoppSliceF64 b, size_t num_stationary_start, size_t num_stationary_end, struct CoppSliceF64 t_s, double t0, double dt, bool include_final, struct CoppVecF64 *out_s_t)
Interpolate s(t) from TOPP3/COPP3 profiles using a uniform time grid.
double * data
Pointer to the first element, or null for an empty vector.
Definition core.h:832
Warning
Safety s.data, a.data, b.data, and t_s.data must be valid for reads when their lengths are non-zero. out_s_t must be valid for one CoppVecF64 write.

◆ copp_t_to_s_non_uniform_3rd()

enum CoppStatus copp_t_to_s_non_uniform_3rd ( struct CoppSliceF64 s,
struct CoppSliceF64 a,
struct CoppSliceF64 b,
size_t num_stationary_start,
size_t num_stationary_end,
struct CoppSliceF64 t_s,
struct CoppSliceF64 t_sample,
struct CoppVecF64 * out_s_t )

Interpolate s(t) from TOPP3/COPP3 profiles using caller-provided time samples.

C callers pass profile parts explicitly. On success, out_s_t owns a COPP-allocated vector and must be released with copp_vec_f64_free.

Warning
Safety s.data, a.data, b.data, t_s.data, and t_sample.data must be valid for reads when their lengths are non-zero. out_s_t must be valid for one CoppVecF64 write.

◆ copp_force_positive_a_3rd()

enum CoppStatus copp_force_positive_a_3rd ( struct CoppSliceF64 s,
struct CoppSliceMutF64 a,
struct CoppSliceMutF64 b,
size_t num_stationary_start,
size_t num_stationary_end,
double a_min,
bool * out_succeed )

Adjust mutable TOPP3/COPP3 a and b node profiles in place so interpolated a(s) stays strictly positive per interval.

C callers pass mutable profile parts explicitly. a and b must be mutable node-based arrays with length s.len. On success, *out_succeed receives the operation result flag; the a.data and b.data buffers may have been modified.

Example

The example below repairs a mutable third-order profile in place before downstream interpolation.

bool succeeded = false;
(struct CoppSliceF64){s, n},
(struct CoppSliceMutF64){profile.a.data, profile.a.len},
(struct CoppSliceMutF64){profile.b.data, profile.b.len},
profile.num_stationary_start,
profile.num_stationary_end,
1e-12,
&succeeded));
enum CoppStatus copp_force_positive_a_3rd(struct CoppSliceF64 s, struct CoppSliceMutF64 a, struct CoppSliceMutF64 b, size_t num_stationary_start, size_t num_stationary_end, double a_min, bool *out_succeed)
Adjust mutable TOPP3/COPP3 a and b node profiles in place so interpolated a(s) stays strictly positiv...
Borrowed mutable f64 slice passed from C to COPP.
Definition core.h:799
Warning
Safety s.data must be valid for reads when non-empty. a.data and b.data must be valid for unique mutable access when non-empty and must not alias each other. out_succeed must be valid for one bool write.