pub struct Intersection {
pub robots: Vec<Robot>,
pub blocks: Vec<Block>,
pub safety: f64,
pub parameter_bounds: [(f64, f64); 2],
pub time_cost: f64,
}Expand description
The intersection scene.
Fields§
§robots: Vec<Robot>The robots, in planning priority order.
blocks: Vec<Block>The buildings at the corners.
safety: f64The minimum distance between two robots.
parameter_bounds: [(f64, f64); 2]The bounds of each (b_i, h_i) pair: the paper’s b ∈ [1, 6], h ∈ [0.5, 5].
time_cost: f64The cost of one time step, moving or waiting, in length units. Default 1.
Implementations§
Source§impl Intersection
impl Intersection
Sourcepub fn crossing(robots: usize) -> Self
pub fn crossing(robots: usize) -> Self
A four-way crossing of roads 8 wide with buildings at the corners and up to eight robots driving straight across on the right-hand lanes: robots 0–3 come from the west, east, south and north; robots 4–7 follow them on the same lanes, 8 units behind.
§Panics
Panics if robots is not in 1..=8.
Sourcepub fn plan(&self, x: &[f64]) -> Option<Vec<Vec<Point>>>
pub fn plan(&self, x: &[f64]) -> Option<Vec<Vec<Point>>>
The coordinated trajectories (one position per time step, until each robot’s goal)
for parameters x, or None if some robot found no collision-free plan.
Sourcepub fn trajectory_cost(&self, trajectory: &[Point]) -> f64
pub fn trajectory_cost(&self, trajectory: &[Point]) -> f64
The cost of one trajectory: its length plus Intersection::time_cost per step.
Sourcepub fn collisions(&self, trajectories: &[Vec<Point>]) -> usize
pub fn collisions(&self, trajectories: &[Vec<Point>]) -> usize
The number of time steps (and midpoints) at which two robots are closer than safety.