pub struct GridMap {
pub resolution: f64,
pub robot_radius: f64,
pub min_x: f64,
pub min_y: f64,
pub max_x: f64,
pub max_y: f64,
pub x_width: i32,
pub y_width: i32,
pub obstacle_map: Vec<Vec<bool>>,
}Expand description
Occupancy grid map for path planning
Fields§
§resolution: f64§robot_radius: f64§min_x: f64§min_y: f64§max_x: f64§max_y: f64§x_width: i32§y_width: i32§obstacle_map: Vec<Vec<bool>>Implementations§
Source§impl GridMap
impl GridMap
Sourcepub fn new(ox: &[f64], oy: &[f64], resolution: f64, robot_radius: f64) -> Self
pub fn new(ox: &[f64], oy: &[f64], resolution: f64, robot_radius: f64) -> Self
Create a new grid map from obstacle points
Sourcepub fn try_new(
ox: &[f64],
oy: &[f64],
resolution: f64,
robot_radius: f64,
) -> RoboticsResult<Self>
pub fn try_new( ox: &[f64], oy: &[f64], resolution: f64, robot_radius: f64, ) -> RoboticsResult<Self>
Create a validated grid map from obstacle points
Sourcepub fn from_obstacles(
obstacles: &Obstacles,
resolution: f64,
robot_radius: f64,
) -> RoboticsResult<Self>
pub fn from_obstacles( obstacles: &Obstacles, resolution: f64, robot_radius: f64, ) -> RoboticsResult<Self>
Create a validated grid map from obstacle points
Sourcepub fn calc_xy_index(&self, position: f64) -> i32
pub fn calc_xy_index(&self, position: f64) -> i32
Convert world position to grid index (uses min_x as reference)
Sourcepub fn calc_x_index(&self, x: f64) -> i32
pub fn calc_x_index(&self, x: f64) -> i32
Convert world x position to grid index
Sourcepub fn calc_y_index(&self, y: f64) -> i32
pub fn calc_y_index(&self, y: f64) -> i32
Convert world y position to grid index
Sourcepub fn calc_grid_position(&self, index: i32) -> f64
pub fn calc_grid_position(&self, index: i32) -> f64
Convert grid index to world position
Sourcepub fn calc_x_position(&self, ix: i32) -> f64
pub fn calc_x_position(&self, ix: i32) -> f64
Convert grid x index to world x position
Sourcepub fn calc_y_position(&self, iy: i32) -> f64
pub fn calc_y_position(&self, iy: i32) -> f64
Convert grid y index to world y position
Sourcepub fn calc_grid_index(&self, node: &Node) -> i32
pub fn calc_grid_index(&self, node: &Node) -> i32
Calculate unique grid index for a node
Sourcepub fn calc_index(&self, x: i32, y: i32) -> i32
pub fn calc_index(&self, x: i32, y: i32) -> i32
Calculate unique grid index from grid coordinates
Sourcepub fn verify_node(&self, node: &Node) -> bool
pub fn verify_node(&self, node: &Node) -> bool
Verify if a node is valid (within bounds and not in obstacle)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GridMap
impl RefUnwindSafe for GridMap
impl Send for GridMap
impl Sync for GridMap
impl Unpin for GridMap
impl UnsafeUnpin for GridMap
impl UnwindSafe for GridMap
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.