costmap 0.2.0

2D costmaps, occupancy grids, and raycasting for robotics navigation - a Nav2 alternative in pure Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use glam::{IVec2, UVec2};

use crate::{
    OccupancyGrid,
    types::{FREE, OCCUPIED},
};

#[inline]
pub fn in_bounds(cell: IVec2, bounds: UVec2) -> bool {
    (cell.x as u32) < bounds.x && (cell.y as u32) < bounds.y
}

#[inline]
pub fn is_occupied(grid: &OccupancyGrid, cell: IVec2) -> bool {
    let value = grid.get(cell.as_uvec2()).unwrap_or(&FREE);
    value >= &OCCUPIED
}