COPP C++ API
C++ interface for COPP trajectory optimization
Loading...
Searching...
No Matches
copp Namespace Reference

Root namespace for the C++ facade: paths, robots, constraints, matrices, profiles, errors, objectives, interpolation, and solver entry points. More...

Namespaces

namespace  clarabel
 Clarabel option, raw setting, status, and linear-solver diagnostic types shared by Clarabel-backed TOPP/COPP solvers.
namespace  detail
 Internal helpers for error conversion, no-throw overloads, and small implementation utilities used by the public facade.
namespace  eigen
 Optional Eigen adapters that convert Eigen objects to COPP matrix views or map COPP-owned matrices without changing the core API types.
namespace  interpolation
 Time-conversion helpers for TOPP2/TOPP3 profiles, including s -> t, uniform t -> s, explicit-sample t -> s, and third-order profile slicing.
namespace  objective
 Python-like factory namespace for constructing COPP objective descriptors such as time, linear, thermal-energy, and torque-variation costs.
namespace  solver
 Solver entry namespace containing TOPP2, COPP2, TOPP3, COPP3, reachable-set, RA, LP, and SOCP solver families.

Classes

struct  Boundary2
 Second-order endpoint boundary values. More...
struct  Boundary3
 Third-order endpoint boundary values. More...
class  Constraints
 Owning raw constraint-buffer facade. More...
class  ConstraintsRef
 Non-owning view of a Rust-backed constraint buffer. More...
class  Error
 Exception type thrown by the default C++ API. More...
struct  ErrorInfo
 Lightweight error payload returned by no-throw APIs. More...
class  Expected
 Small C++17 expected-like result used by no-throw overloads. More...
struct  IndexInterval
 Closed station-index interval used by TOPP/COPP problem descriptors. More...
struct  Jet3
 Third-order forward-mode automatic-differentiation scalar. More...
class  Matrix
 Lightweight owned column-major matrix. More...
class  MatrixRef
 Mutable column-major matrix view used by callback APIs. More...
class  MatrixView
 Non-owning view of a two-dimensional double matrix. More...
struct  NoThrowTag
 Tag object selecting no-throw overloads. More...
class  Objective
 Owning objective descriptor used by C++ COPP solver problem objects. More...
class  Path
 Geometric path wrapper backed by Rust Path. More...
struct  PathDerivatives
 Result of path evaluation. More...
struct  Profile3rd
 Owned third-order TOPP/COPP profile. More...
struct  Profile3rdRef
 Borrowed third-order TOPP/COPP profile view. More...
class  Robot
 Robot facade backed by Rust Robot<CppRobotModel>. More...
class  Span
 Non-owning view of a contiguous one-dimensional array. More...
struct  SplineConfig
 Configuration for waypoint spline construction. More...

Typedefs

using PathParametric = std::function<std::vector<Jet3>(Jet3 s)>
 Scalar-parametric path callback that returns one Jet3 per dimension.
using PathParametricWriter = std::function<void(Jet3 s, Span<Jet3> q)>
 Allocation-free scalar-parametric path callback that writes one Jet3 per dimension.
using PathEvaluator2nd
 Batch second-order evaluator callback.
using PathEvaluator3rd
 Batch third-order evaluator callback.
using InverseDynamics
 User-supplied inverse dynamics callback.

Enumerations

enum class  Status { ok = 0 , invalid_input , bridge_error }
 Coarse error category reported by the C++ facade. More...
enum class  Verbosity { Silent = 0 , Summary = 1 , Debug = 2 , Trace = 3 }
 Diagnostic verbosity for solver algorithms. More...
enum class  MatrixLayout { ColumnMajor , RowMajor }
 Memory layout for borrowed matrix views. More...
enum class  ObjectiveKind { Time = 0 , Linear = 1 , ThermalEnergy = 2 , TotalVariationTorque = 3 }
 Objective kinds accepted by COPP optimization solvers. More...
enum class  OutOfRangeMode { Error , Clamp }
 Policy for evaluating a path outside its configured s range. More...

Functions

COPP_API std::string version ()
 Return the Rust crate version backing this C++ facade.
constexpr Jet3 operator+ (Jet3 lhs, Jet3 rhs) noexcept
constexpr Jet3 operator+ (Jet3 lhs, double rhs) noexcept
constexpr Jet3 operator+ (double lhs, Jet3 rhs) noexcept
constexpr Jet3 operator- (Jet3 lhs, Jet3 rhs) noexcept
constexpr Jet3 operator- (Jet3 lhs, double rhs) noexcept
constexpr Jet3 operator- (double lhs, Jet3 rhs) noexcept
constexpr Jet3 operator- (Jet3 value) noexcept
constexpr Jet3 operator* (Jet3 lhs, Jet3 rhs) noexcept
constexpr Jet3 operator* (Jet3 lhs, double rhs) noexcept
constexpr Jet3 operator* (double lhs, Jet3 rhs) noexcept
Jet3 operator/ (double lhs, Jet3 rhs) noexcept
constexpr Jet3 operator/ (Jet3 lhs, double rhs) noexcept
Jet3 operator/ (Jet3 lhs, Jet3 rhs) noexcept
Jet3 sin (Jet3 x) noexcept
Jet3 cos (Jet3 x) noexcept
Jet3 exp (Jet3 x) noexcept
Jet3 log (Jet3 x) noexcept
Jet3 ln (Jet3 x) noexcept
Jet3 sqrt (Jet3 x) noexcept
Jet3 powi (Jet3 x, int n) noexcept

Variables

constexpr NoThrowTag no_throw {}

Detailed Description

Root namespace for the C++ facade: paths, robots, constraints, matrices, profiles, errors, objectives, interpolation, and solver entry points.

Typedef Documentation

◆ PathParametric

using copp::PathParametric = std::function<std::vector<Jet3>(Jet3 s)>

Scalar-parametric path callback that returns one Jet3 per dimension.

Parameters
sSeeded path parameter. Use normal arithmetic and COPP math helpers (sin, cos, exp, log, sqrt, powi) to propagate derivatives.
Returns
One Jet3 value per path dimension.

Definition at line 257 of file path.hpp.

◆ PathParametricWriter

using copp::PathParametricWriter = std::function<void(Jet3 s, Span<Jet3> q)>

Allocation-free scalar-parametric path callback that writes one Jet3 per dimension.

Parameters
sSeeded path parameter.
qWritable span with length equal to the dimension passed to Path::from_parametric(dim, ...).

Definition at line 264 of file path.hpp.

◆ PathEvaluator2nd

Initial value:
std::function<void(
MatrixRef ddq)>
Mutable column-major matrix view used by callback APIs.
Definition core.hpp:288
Non-owning view of a contiguous one-dimensional array.
Definition core.hpp:139

Batch second-order evaluator callback.

The callback receives all query samples at once and must fill q, dq, and ddq. Output matrices have shape (dim x s.size()) and column-major storage. Throw copp::Error or any std::exception to report evaluation failure.

Definition at line 272 of file path.hpp.

◆ PathEvaluator3rd

Initial value:
std::function<void(
MatrixRef ddq,
MatrixRef dddq)>

Batch third-order evaluator callback.

The callback receives all query samples at once and must fill q, dq, ddq, and dddq. Output matrices have shape (dim x s.size()) and column-major storage. A path built from this callback can also be evaluated with evaluate_q and evaluate_up_to_2nd.

Definition at line 284 of file path.hpp.

◆ InverseDynamics

Initial value:

User-supplied inverse dynamics callback.

The callback receives one robot state and must overwrite every entry of tau. Inputs are borrowed for the duration of the call only. Throw copp::Error or another std::exception to report dynamics failures; the bridge converts the exception into a Rust dynamics error and then back into copp::Error at the public call site.

Parameters
qJoint position vector with length dim.
dqJoint velocity vector with length dim.
ddqJoint acceleration vector with length dim.
tauWritable torque vector with length dim.
copp::InverseDynamics dynamics = [](auto q, auto dq, auto ddq, auto tau) {
for (std::size_t i = 0; i < tau.size(); ++i) {
tau[i] = ddq[i] + 0.1 * dq[i] + std::sin(q[i]);
}
};
std::function< void( Span< const double > q, Span< const double > dq, Span< const double > ddq, Span< double > tau)> InverseDynamics
User-supplied inverse dynamics callback.
Definition robot.hpp:38

Definition at line 38 of file robot.hpp.

Enumeration Type Documentation

◆ Status

enum class copp::Status
strong

Coarse error category reported by the C++ facade.

The C++ layer currently converts Rust bridge failures into Error with a copied diagnostic message. invalid_input is used for user-facing argument and model errors; bridge_error is reserved for lower-level bridge failures.

Enumerator
ok 
invalid_input 
bridge_error 

Definition at line 34 of file core.hpp.

◆ Verbosity

enum class copp::Verbosity
strong

Diagnostic verbosity for solver algorithms.

Values mirror Rust copp::diag::Verbosity. Silent is the default and emits no diagnostic output. Higher levels progressively add summary, debug, and trace messages from the Rust solver core.

Enumerator
Silent 
Summary 
Debug 
Trace 

Definition at line 46 of file core.hpp.

◆ MatrixLayout

enum class copp::MatrixLayout
strong

Memory layout for borrowed matrix views.

COPP's Rust implementation and Matrix storage use column-major layout. Row-major views are accepted by selected public C++ functions and copied to column-major storage before crossing the Rust bridge.

Enumerator
ColumnMajor 
RowMajor 

Definition at line 116 of file core.hpp.

◆ ObjectiveKind

enum class copp::ObjectiveKind
strong

Objective kinds accepted by COPP optimization solvers.

The names mirror Rust/Python CoppObjective. COPP2 currently supports all four standard objectives: time, linear, thermal energy, and total-variation torque.

Enumerator
Time 
Linear 
ThermalEnergy 
TotalVariationTorque 

Definition at line 17 of file objective.hpp.

◆ OutOfRangeMode

enum class copp::OutOfRangeMode
strong

Policy for evaluating a path outside its configured s range.

This is forwarded to the Rust path evaluator. Use Clamp for plotting or UI previews; use Error for solver input so invalid station grids are caught early.

Enumerator
Error 

Throw copp::Error when any query sample is outside [s_min, s_max].

Clamp 

Clamp out-of-range query samples to the nearest endpoint.

Definition at line 296 of file path.hpp.

Function Documentation

◆ version()

COPP_API std::string copp::version ( )

Return the Rust crate version backing this C++ facade.

Returns
A semantic-version string copied from the Rust crate metadata.
std::cout << "COPP version: " << copp::version() << "\n";
COPP_API std::string version()
Return the Rust crate version backing this C++ facade.

◆ operator+() [1/3]

Jet3 copp::operator+ ( Jet3 lhs,
Jet3 rhs )
inlineconstexprnoexcept

Definition at line 61 of file path.hpp.

◆ operator+() [2/3]

Jet3 copp::operator+ ( Jet3 lhs,
double rhs )
inlineconstexprnoexcept

Definition at line 71 of file path.hpp.

◆ operator+() [3/3]

Jet3 copp::operator+ ( double lhs,
Jet3 rhs )
inlineconstexprnoexcept

Definition at line 76 of file path.hpp.

◆ operator-() [1/4]

Jet3 copp::operator- ( Jet3 lhs,
Jet3 rhs )
inlineconstexprnoexcept

Definition at line 81 of file path.hpp.

◆ operator-() [2/4]

Jet3 copp::operator- ( Jet3 lhs,
double rhs )
inlineconstexprnoexcept

Definition at line 91 of file path.hpp.

◆ operator-() [3/4]

Jet3 copp::operator- ( double lhs,
Jet3 rhs )
inlineconstexprnoexcept

Definition at line 96 of file path.hpp.

◆ operator-() [4/4]

Jet3 copp::operator- ( Jet3 value)
inlineconstexprnoexcept

Definition at line 101 of file path.hpp.

◆ operator*() [1/3]

Jet3 copp::operator* ( Jet3 lhs,
Jet3 rhs )
inlineconstexprnoexcept

Definition at line 106 of file path.hpp.

◆ operator*() [2/3]

Jet3 copp::operator* ( Jet3 lhs,
double rhs )
inlineconstexprnoexcept

Definition at line 116 of file path.hpp.

◆ operator*() [3/3]

Jet3 copp::operator* ( double lhs,
Jet3 rhs )
inlineconstexprnoexcept

Definition at line 126 of file path.hpp.

◆ operator/() [1/3]

Jet3 copp::operator/ ( double lhs,
Jet3 rhs )
inlinenoexcept

Definition at line 131 of file path.hpp.

◆ operator/() [2/3]

Jet3 copp::operator/ ( Jet3 lhs,
double rhs )
inlineconstexprnoexcept

Definition at line 146 of file path.hpp.

◆ operator/() [3/3]

Jet3 copp::operator/ ( Jet3 lhs,
Jet3 rhs )
inlinenoexcept

Definition at line 151 of file path.hpp.

◆ sin()

Jet3 copp::sin ( Jet3 x)
inlinenoexcept

Definition at line 156 of file path.hpp.

◆ cos()

Jet3 copp::cos ( Jet3 x)
inlinenoexcept

Definition at line 169 of file path.hpp.

◆ exp()

Jet3 copp::exp ( Jet3 x)
inlinenoexcept

Definition at line 182 of file path.hpp.

◆ log()

Jet3 copp::log ( Jet3 x)
inlinenoexcept

Definition at line 194 of file path.hpp.

◆ ln()

Jet3 copp::ln ( Jet3 x)
inlinenoexcept

Definition at line 208 of file path.hpp.

◆ sqrt()

Jet3 copp::sqrt ( Jet3 x)
inlinenoexcept

Definition at line 213 of file path.hpp.

◆ powi()

Jet3 copp::powi ( Jet3 x,
int n )
inlinenoexcept

Definition at line 229 of file path.hpp.

Variable Documentation

◆ no_throw

NoThrowTag copp::no_throw {}
inlineconstexpr

Definition at line 612 of file core.hpp.