COPP C++ API 0.2.3
C++ interface for COPP trajectory optimization
Loading...
Searching...
No Matches
copp::Profile3rd Struct Reference

Owned third-order TOPP/COPP profile. More...

#include <interpolation.hpp>

Public Member Functions

 Profile3rd ()=default
 Profile3rd (std::vector< double > a_values, std::vector< double > b_values)
 Profile3rd (std::vector< double > a_values, std::vector< double > b_values, std::pair< std::size_t, std::size_t > num_stationary)
 Profile3rd (std::vector< double > a_values, std::vector< double > b_values, std::size_t stationary_start, std::size_t stationary_end)
std::size_t len () const noexcept
std::size_t size () const noexcept
bool empty () const noexcept
std::pair< std::size_t, std::size_t > num_stationary () const noexcept
Profile3rdRef ref () const
 Borrow this owned profile without copying arrays.
Profile3rdRef slice (std::size_t idx_s_start, std::size_t idx_s_final) const
 Borrow a closed station subrange idx_s_start..=idx_s_final.
Profile3rdRef segment (std::size_t idx_s) const
 Borrow one segment as the two-node profile idx_s..=idx_s+1.
bool force_positive_a (Span< const double > s, double a_min=1.0e-12)
 Adjust a and b in place so interpolated a(s) stays strictly positive on every interval.
Expected< bool > force_positive_a (Span< const double > s, double a_min, NoThrowTag)
 No-throw forms of force_positive_a.
Expected< bool > force_positive_a (Span< const double > s, NoThrowTag)

Public Attributes

std::vector< double > a
std::vector< double > b
std::size_t num_stationary_start = 0
std::size_t num_stationary_end = 0

Detailed Description

Owned third-order TOPP/COPP profile.

a and b are both node-based and must have the same length as the station grid s used for interpolation. Public fields intentionally stay writable to match the lightweight Rust/Python storage style; constructors validate the initial shape, while direct later edits are the user's responsibility.

Definition at line 68 of file interpolation.hpp.

Constructor & Destructor Documentation

◆ Profile3rd() [1/4]

copp::Profile3rd::Profile3rd ( )
default

◆ Profile3rd() [2/4]

copp::Profile3rd::Profile3rd ( std::vector< double > a_values,
std::vector< double > b_values )

◆ Profile3rd() [3/4]

copp::Profile3rd::Profile3rd ( std::vector< double > a_values,
std::vector< double > b_values,
std::pair< std::size_t, std::size_t > num_stationary )

◆ Profile3rd() [4/4]

copp::Profile3rd::Profile3rd ( std::vector< double > a_values,
std::vector< double > b_values,
std::size_t stationary_start,
std::size_t stationary_end )

Member Function Documentation

◆ len()

std::size_t copp::Profile3rd::len ( ) const
inlinenoexcept

Definition at line 87 of file interpolation.hpp.

◆ size()

std::size_t copp::Profile3rd::size ( ) const
inlinenoexcept

Definition at line 88 of file interpolation.hpp.

◆ empty()

bool copp::Profile3rd::empty ( ) const
inlinenoexcept

Definition at line 89 of file interpolation.hpp.

◆ num_stationary()

std::pair< std::size_t, std::size_t > copp::Profile3rd::num_stationary ( ) const
inlinenoexcept

Definition at line 90 of file interpolation.hpp.

◆ ref()

Profile3rdRef copp::Profile3rd::ref ( ) const

Borrow this owned profile without copying arrays.

◆ slice()

Profile3rdRef copp::Profile3rd::slice ( std::size_t idx_s_start,
std::size_t idx_s_final ) const

Borrow a closed station subrange idx_s_start..=idx_s_final.

◆ segment()

Profile3rdRef copp::Profile3rd::segment ( std::size_t idx_s) const

Borrow one segment as the two-node profile idx_s..=idx_s+1.

◆ force_positive_a() [1/3]

bool copp::Profile3rd::force_positive_a ( Span< const double > s,
double a_min = 1.0e-12 )

Adjust a and b in place so interpolated a(s) stays strictly positive on every interval.

A profile whose a touches zero at or between stations can have an interpolated a(s) that dips to or below zero inside an interval. Call this before interpolation::s_to_t_topp3 on such profiles. The adjustment rewrites a and b without knowing the acceleration and jerk limits, so re-check the result with ConstraintsRef::exceed_topp3 afterwards.

Parameters
sStrictly increasing station grid with s.size() == len() and at least four stations.
a_minNonnegative lower target for interpolated a.
Returns
true when every interval was adjusted successfully; false when the adjustment failed for some interval (not an error; other intervals may still have been adjusted).
Exceptions
copp::Erroron invalid input: length mismatch, fewer than four stations, negative a or a_min, non-finite values, non-increasing s, or stationary counts that leave no motion interval.

◆ force_positive_a() [2/3]

Expected< bool > copp::Profile3rd::force_positive_a ( Span< const double > s,
double a_min,
NoThrowTag  )
inline

No-throw forms of force_positive_a.

The Expected only reports whether the call itself succeeded (invalid input becomes an error). The repaired flag is its value(), which can be false even when the call succeeded.

Definition at line 135 of file interpolation.hpp.

◆ force_positive_a() [3/3]

Expected< bool > copp::Profile3rd::force_positive_a ( Span< const double > s,
NoThrowTag tag )
inline

Definition at line 143 of file interpolation.hpp.

Member Data Documentation

◆ a

std::vector<double> copp::Profile3rd::a

Definition at line 70 of file interpolation.hpp.

◆ b

std::vector<double> copp::Profile3rd::b

Definition at line 71 of file interpolation.hpp.

◆ num_stationary_start

std::size_t copp::Profile3rd::num_stationary_start = 0

Definition at line 72 of file interpolation.hpp.

◆ num_stationary_end

std::size_t copp::Profile3rd::num_stationary_end = 0

Definition at line 73 of file interpolation.hpp.


The documentation for this struct was generated from the following file: