Skip to main content

plan_sweep_coverage

Function plan_sweep_coverage 

Source
pub fn plan_sweep_coverage(
    ox: &[f64],
    oy: &[f64],
    config: &GridBasedSweepConfig,
) -> SweepCoveragePath
Expand description

Plan a boustrophedon (lawn-mower) coverage path over the area enclosed by the given polygon.

The polygon is specified as a sequence of vertices (ox, oy) forming a closed ring (first vertex == last vertex).

§Arguments

  • ox - x-coordinates of the polygon boundary.
  • oy - y-coordinates of the polygon boundary.
  • config - planner configuration.

§Returns

A SweepCoveragePath containing the planned waypoints in global coordinates.

§Example

use rust_robotics_planning::grid_based_sweep_cpp::{
    plan_sweep_coverage, GridBasedSweepConfig,
};

let ox = vec![0.0, 50.0, 50.0, 0.0, 0.0];
let oy = vec![0.0, 0.0, 30.0, 30.0, 0.0];
let config = GridBasedSweepConfig {
    resolution: 5.0,
    ..Default::default()
};
let path = plan_sweep_coverage(&ox, &oy, &config);
assert!(!path.x.is_empty());