Skip to main content

Crate clearpath

Crate clearpath 

Source
Expand description

clearpath — deterministic 2D obstacle-avoidance path planning and smooth spline fitting.

See docs/SPEC.md for the normative specification this crate implements.

The crate is #![no_std] and needs only alloc. Enable the default std feature for the ergonomic std-backed build; build with --no-default-features for bare-metal targets.

§Example

use clearpath::{BoundingBox, Point2D, Polygon};

// A 2x2 square obstacle.
let obstacle = Polygon::new(vec![
    Point2D::new(4.0, 4.0),
    Point2D::new(6.0, 4.0),
    Point2D::new(6.0, 6.0),
    Point2D::new(4.0, 6.0),
]).unwrap();

assert!(obstacle.contains(Point2D::new(5.0, 5.0)));
assert!(!obstacle.contains(Point2D::new(7.0, 5.0)));
assert_eq!(obstacle.bounds(), BoundingBox::new(Point2D::new(4.0, 4.0), Point2D::new(6.0, 6.0)));

Re-exports§

pub use corridor::AdmissibleSet;
pub use corridor::AdmissibleTangents;
pub use error::InvalidObstacleReason;
pub use error::PathPlanError;
pub use geom::clearance::Clearance;
pub use geom::BoundingBox;
pub use geom::FreeSpace;
pub use geom::Orientation;
pub use geom::Point2D;
pub use geom::Polygon;
pub use router::Config;
pub use router::OrthogonalPolyline;
pub use router::PathPlanner;
pub use router::PortConstraint;
pub use router::Route;
pub use router::RouteKind;
pub use router::RouteRequest;
pub use spline::CubicBezierSegment;

Modules§

corridor
Admissible tangents: how far a spline may pull away from a knot before it leaves the free space.
decomp
The vertical (trapezoidal) decomposition of the offset free space.
error
Error type for the crate.
funnel
Finding a corridor and pulling a taut string through it.
geom
Low-level geometric primitives and robust predicates.
router
The public routing API.
spline
Cubic Bezier segments, the tangent solver, and the containment repair.