pub struct Grid {
pub width: i32,
pub height: i32,
pub time_limit: i32,
pub obstacle_paths: Vec<Vec<Position>>,
/* private fields */
}Expand description
A 2-D grid with a time dimension that records obstacle occupancy.
reservation_matrix[x][y][t] holds 0 if free, otherwise an obstacle/agent
identifier.
Fields§
§width: i32§height: i32§time_limit: i32§obstacle_paths: Vec<Vec<Position>>Paths of every dynamic obstacle (list of positions per time step).
Implementations§
Source§impl Grid
impl Grid
Sourcepub fn new(
width: i32,
height: i32,
num_obstacles: usize,
arrangement: ObstacleArrangement,
avoid_points: &[Position],
time_limit: i32,
) -> RoboticsResult<Self>
pub fn new( width: i32, height: i32, num_obstacles: usize, arrangement: ObstacleArrangement, avoid_points: &[Position], time_limit: i32, ) -> RoboticsResult<Self>
Create a grid and populate it with dynamic obstacles.
Sourcepub fn empty(width: i32, height: i32, time_limit: i32) -> RoboticsResult<Self>
pub fn empty(width: i32, height: i32, time_limit: i32) -> RoboticsResult<Self>
Create an empty grid (no obstacles).
pub fn inside_bounds(&self, pos: Position) -> bool
pub fn is_free(&self, pos: Position, t: i32) -> bool
Sourcepub fn reserve(&mut self, pos: Position, agent_id: i32, interval: Interval)
pub fn reserve(&mut self, pos: Position, agent_id: i32, interval: Interval)
Reserve a cell for a given agent during a time interval.
Sourcepub fn reserve_path(&mut self, path: &NodePath, agent_id: i32)
pub fn reserve_path(&mut self, path: &NodePath, agent_id: i32)
Reserve the entire path of an agent.
Sourcepub fn clear_reservation(&mut self, pos: Position, agent_id: i32)
pub fn clear_reservation(&mut self, pos: Position, agent_id: i32)
Clear all reservations for a given agent at a specific position.
Sourcepub fn safe_intervals_at(&self, pos: Position) -> Vec<Interval>
pub fn safe_intervals_at(&self, pos: Position) -> Vec<Interval>
Compute safe intervals for a single cell.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Grid
impl RefUnwindSafe for Grid
impl Send for Grid
impl Sync for Grid
impl Unpin for Grid
impl UnsafeUnpin for Grid
impl UnwindSafe for Grid
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.