Expand description
Path abstraction for trajectory planning.
The main entry point is Path. It supports two construction modes and a
uniform evaluation API: pick the one that fits your use case:
| You have | Use |
|---|---|
An analytic formula q(s) | Path::from_parametric |
| A set of waypoint positions | Path::from_waypoints |
| Explicit derivatives from an external evaluator | Path::from_evaluator_2nd / Path::from_evaluator_3rd |
Once built, call one of the evaluation methods with a one-dimensional parameter slice:
| Method | Output |
|---|---|
Path::evaluate_q | position q only |
Path::evaluate_up_to_2nd | q, dq, ddq |
Path::evaluate_up_to_3rd | q, dq, ddq, dddq |
§Examples
§Analytic path: automatic differentiation
use copp::path::{Path, sin, cos};
use copp::path::autodiff::Jet3;
// Build a 2-DOF path: q0 = sin(s), q1 = cos(s), s in [0, 1]
let path = Path::from_parametric(
|s: Jet3| vec![sin(s), cos(s)],
0.0, 1.0,
).unwrap();
// Evaluate at 5 uniformly-spaced parameter values
let s = [0.0, 0.25, 0.5, 0.75, 1.0];
let out = path.evaluate_up_to_3rd(&s).unwrap();
// out.q : shape (2, 5)
// out.dq : Some, shape (2, 5) first derivative w.r.t. s
// out.dddq: Some, shape (2, 5) third derivative w.r.t. s§Spline path: waypoint interpolation
use copp::path::{Path, SplineConfig};
use nalgebra::DMatrix;
// 2-DOF path with 5 waypoints; the spline passes exactly through each one.
// waypoints shape: (dim=2, n_points=5)
let waypoints = DMatrix::from_row_slice(2, 5, &[
0.0, 0.25, 0.5, 0.75, 1.0, // dim 0
0.0, 0.1, -0.1, 0.2, 0.0, // dim 1
]);
let path = Path::from_waypoints(&waypoints, SplineConfig::default()).unwrap();
let s = [0.0, 0.5, 1.0];
let out = path.evaluate_q(&s).unwrap();
// out.q shape (2, 3); out.dq / ddq / dddq are all NoneRe-exports§
pub use autodiff::Jet3;pub use autodiff::cos;pub use autodiff::exp;pub use autodiff::ln;pub use autodiff::powi;pub use autodiff::sin;pub use autodiff::sqrt;pub use spline::Parametrization;pub use spline::SplineConfig;
Modules§
- autodiff
- Third-order forward-mode automatic differentiation primitives.
- spline
- Waypoint-based spline path construction and evaluation kernels.
Structs§
- Path
- Unified path abstraction over parametric, spline, and evaluator representations.
- Path
Derivatives - Output of path evaluation.
Enums§
- OutOf
Range Mode - Policy for handling path queries outside the configured
srange.
Traits§
- Path
Evaluator - Compatibility alias for third-order explicit path evaluators.
- Path
Evaluator2nd - User-provided path evaluator with explicit derivatives up to second order.
- Path
Evaluator3rd - User-provided path evaluator with explicit derivatives up to third order.
Type Aliases§
- Parametric
Fn - Shared analytic path function used by
Path::from_parametric.