Non-owning view of a Rust-backed constraint buffer. More...
#include <robot.hpp>
Public Member Functions | |
| ConstraintsRef () noexcept=default | |
| bool | valid () const noexcept |
| Return whether this reference points to a live bridge handle. | |
| std::size_t | dim () const |
| Return the robot/path dimension. | |
| std::size_t | len () const |
| Return the number of stored path stations. | |
| std::size_t | size () const |
| Alias for len(), useful for STL-style code. | |
| std::size_t | capacity () const |
| Return the allocated station-buffer capacity. | |
| bool | is_empty () const |
| Return whether no path stations are stored. | |
| std::pair< std::size_t, std::size_t > | idx_s_range () const |
| Return the active global station-id interval [first, second). | |
| ConstraintsRef & | append_s (Span< const double > s) |
| Append strictly increasing path station samples. | |
| std::vector< double > | s_values (std::size_t idx_s_from, std::size_t idx_s_to) const |
| Export stored station samples over [idx_s_from, idx_s_to). | |
| std::vector< double > | amax_values (std::size_t idx_s_from, std::size_t idx_s_to) const |
| Export first-order upper bounds over [idx_s_from, idx_s_to). | |
| double | s_value (std::size_t idx_s) const |
| Read one stored station sample by global station id. | |
| double | amax_value (std::size_t idx_s) const |
| Read one first-order upper bound by global station id. | |
| ConstraintsRef & | amax_substitute (Span< const double > amax, std::size_t idx_s) |
| Overwrite first-order upper bounds starting at idx_s. | |
| ConstraintsRef & | clear (bool keep_idx_s=false) |
| Clear all stored stations and constraints. | |
| ConstraintsRef & | pop_front_n (std::size_t n_cols) |
| Remove n_cols logical stations from the front. | |
| ConstraintsRef & | pop_back_n (std::size_t n_cols) |
| Remove n_cols logical stations from the back. | |
| ConstraintsRef & | pop_front_until (std::size_t idx_s_cut) |
| Remove front stations until the kept window starts at idx_s_cut. | |
| ConstraintsRef & | pop_back_until (std::size_t idx_s_cut) |
| Remove back stations until the kept window ends at or before idx_s_cut. | |
| ConstraintsRef & | add_constraint_1st (Span< const double > amax, std::size_t idx_s) |
| Add or tighten first-order constraints from a vector. | |
| ConstraintsRef & | add_constraint_1st (MatrixView amax, std::size_t idx_s) |
| Add or tighten first-order constraints from an R x N matrix. | |
| ConstraintsRef & | add_constraint_2nd (MatrixView acc_a, MatrixView acc_b, MatrixView acc_max, std::size_t idx_s, bool is_negative=false) |
| Append second-order raw constraint rows. | |
| ConstraintsRef & | add_constraint_3rd (MatrixView jerk_a, MatrixView jerk_b, MatrixView jerk_c, MatrixView jerk_d, MatrixView jerk_max, std::size_t idx_s, bool is_negative=false) |
| Append third-order raw constraint rows. | |
Friends | |
| class | Robot |
| class | Constraints |
| const void * | detail::constraints_handle (ConstraintsRef constraints) noexcept |
| void * | detail::constraints_handle_mut (ConstraintsRef constraints) noexcept |
Non-owning view of a Rust-backed constraint buffer.
ConstraintsRef is returned by Robot::constraints() and by Constraints::ref(). It is intentionally lightweight and copyable: it only stores a borrowed pointer to an owning C++ facade object. The owner must outlive every copied reference.
The first C++ milestone mirrors the Python Constraints surface for raw TOPP constraints: station management, first-order bound replacement, and raw first-/second-/third-order constraint rows. Physical velocity, acceleration, jerk, and torque limits live on Robot, because they need path derivative data and robot semantics.
|
defaultnoexcept |
|
noexcept |
Return whether this reference points to a live bridge handle.
| std::size_t copp::ConstraintsRef::dim | ( | ) | const |
Return the robot/path dimension.
| std::size_t copp::ConstraintsRef::len | ( | ) | const |
Return the number of stored path stations.
| std::size_t copp::ConstraintsRef::size | ( | ) | const |
Alias for len(), useful for STL-style code.
| std::size_t copp::ConstraintsRef::capacity | ( | ) | const |
Return the allocated station-buffer capacity.
| bool copp::ConstraintsRef::is_empty | ( | ) | const |
Return whether no path stations are stored.
| std::pair< std::size_t, std::size_t > copp::ConstraintsRef::idx_s_range | ( | ) | const |
Return the active global station-id interval [first, second).
| ConstraintsRef & copp::ConstraintsRef::append_s | ( | Span< const double > | s | ) |
Append strictly increasing path station samples.
The values are borrowed only for this call. If the buffer is not empty, the first new sample must be greater than the current last stored station.
| s | New station samples in strictly increasing order. |
| copp::Error | if station order or range validation fails. |
| std::vector< double > copp::ConstraintsRef::s_values | ( | std::size_t | idx_s_from, |
| std::size_t | idx_s_to ) const |
Export stored station samples over [idx_s_from, idx_s_to).
| std::vector< double > copp::ConstraintsRef::amax_values | ( | std::size_t | idx_s_from, |
| std::size_t | idx_s_to ) const |
Export first-order upper bounds over [idx_s_from, idx_s_to).
| double copp::ConstraintsRef::s_value | ( | std::size_t | idx_s | ) | const |
Read one stored station sample by global station id.
| double copp::ConstraintsRef::amax_value | ( | std::size_t | idx_s | ) | const |
Read one first-order upper bound by global station id.
| ConstraintsRef & copp::ConstraintsRef::amax_substitute | ( | Span< const double > | amax, |
| std::size_t | idx_s ) |
Overwrite first-order upper bounds starting at idx_s.
Unlike add_constraint_1st, this replaces amax values instead of taking the elementwise minimum. It is mainly used by reachability algorithms that refine an existing profile.
| ConstraintsRef & copp::ConstraintsRef::clear | ( | bool | keep_idx_s = false | ) |
Clear all stored stations and constraints.
If keep_idx_s is true, the current global station origin is kept; otherwise it is reset to zero.
| ConstraintsRef & copp::ConstraintsRef::pop_front_n | ( | std::size_t | n_cols | ) |
Remove n_cols logical stations from the front.
| ConstraintsRef & copp::ConstraintsRef::pop_back_n | ( | std::size_t | n_cols | ) |
Remove n_cols logical stations from the back.
| ConstraintsRef & copp::ConstraintsRef::pop_front_until | ( | std::size_t | idx_s_cut | ) |
Remove front stations until the kept window starts at idx_s_cut.
| ConstraintsRef & copp::ConstraintsRef::pop_back_until | ( | std::size_t | idx_s_cut | ) |
Remove back stations until the kept window ends at or before idx_s_cut.
| ConstraintsRef & copp::ConstraintsRef::add_constraint_1st | ( | Span< const double > | amax, |
| std::size_t | idx_s ) |
Add or tighten first-order constraints from a vector.
The input represents one amax value per station. Stored amax is updated as the elementwise minimum of the existing and new values.
| amax | Node-based upper bounds for a = (ds/dt)^2. |
| idx_s | Global station id of amax[0]. |
| ConstraintsRef & copp::ConstraintsRef::add_constraint_1st | ( | MatrixView | amax, |
| std::size_t | idx_s ) |
Add or tighten first-order constraints from an R x N matrix.
Each matrix column is reduced to its minimum before being fused into the stored amax row. This matches Rust/Python raw constraint semantics.
| ConstraintsRef & copp::ConstraintsRef::add_constraint_2nd | ( | MatrixView | acc_a, |
| MatrixView | acc_b, | ||
| MatrixView | acc_max, | ||
| std::size_t | idx_s, | ||
| bool | is_negative = false ) |
Append second-order raw constraint rows.
For every station column, each row encodes acc_a * a + acc_b * b <= acc_max. If is_negative is true, the row is inserted with signs flipped; this is how lower bounds are represented internally.
| ConstraintsRef & copp::ConstraintsRef::add_constraint_3rd | ( | MatrixView | jerk_a, |
| MatrixView | jerk_b, | ||
| MatrixView | jerk_c, | ||
| MatrixView | jerk_d, | ||
| MatrixView | jerk_max, | ||
| std::size_t | idx_s, | ||
| bool | is_negative = false ) |
Append third-order raw constraint rows.
For every station column, each row encodes sqrt(a) * (jerk_a*a + jerk_b*b + jerk_c*c + jerk_d) <= jerk_max. Linearization is performed later by TOPP3/COPP3 problem builders.
| jerk_a | Coefficient matrix multiplying a. |
| jerk_b | Coefficient matrix multiplying b. |
| jerk_c | Coefficient matrix multiplying third-order control c. |
| jerk_d | Constant term matrix. |
| jerk_max | Right-hand-side matrix. |
| idx_s | Global station id of the first column. |
| is_negative | Whether to insert the sign-flipped lower-bound row. |
|
friend |
|
friend |