1#ifndef BITSIM_PLANNING_OCCUPANCY_GRID_H
2#define BITSIM_PLANNING_OCCUPANCY_GRID_H
27 return col == other.col &&
row == other.row;
100 std::size_t index_(
const GridCell &c)
const noexcept;
107 std::vector<bool> occupied_;
115template <>
struct std::hash<
bitsim::planning::GridCell>
117 std::size_t operator()(
const bitsim::planning::GridCell &c)
const noexcept
119 return std::hash<long long>()((
static_cast<long long>(c.col) << 32) ^
120 static_cast<long long>(c.row & 0xffffffff));
The basic types of bitsim. Code outside this file names Eigen's matrix and vector types only through ...
std::vector< GridCell > neighbours(const GridCell &c, bool diagonal=true) const
The free cells next to c: the four that share a side, and with diagonal the four that share a corner ...
Definition occupancy_grid.cpp:85
bool in_bounds(const GridCell &c) const noexcept
Definition occupancy_grid.cpp:22
uint_t n_occupied() const
The number of occupied cells.
Definition occupancy_grid.cpp:116
void add_circle(real_t x, real_t y, real_t radius)
Occupy the cells whose centres are within radius of (x, y).
Definition occupancy_grid.cpp:58
real_t cell_size() const noexcept
Definition occupancy_grid.h:56
OccupancyGrid(uint_t n_cols, uint_t n_rows, real_t cell_size, real_t x0=0.0, real_t y0=0.0)
Definition occupancy_grid.cpp:12
std::array< real_t, 2 > to_world(const GridCell &c) const noexcept
The centre of a cell [m].
Definition occupancy_grid.cpp:80
bool is_free(const GridCell &c) const noexcept
True if the cell is in the grid and not occupied.
Definition occupancy_grid.cpp:28
void add_rectangle(real_t x_min, real_t y_min, real_t x_max, real_t y_max)
Occupy the cells whose centres are in the rectangle [x_min, x_max] x [y_min, y_max].
Definition occupancy_grid.cpp:42
GridCell to_cell(real_t x, real_t y) const noexcept
The cell that the point (x, y) is in. It may be out of bounds.
Definition occupancy_grid.cpp:74
uint_t n_cols() const noexcept
Definition occupancy_grid.h:54
uint_t n_rows() const noexcept
Definition occupancy_grid.h:55
void set_occupied(const GridCell &c, bool occupied=true)
Definition occupancy_grid.cpp:33
Definition a_star_search.cpp:8
Definition dc_motor_backend_base.h:9
std::size_t uint_t
uint_t
Definition bitsim_types.h:40
double real_t
real_t
Definition bitsim_types.h:20
int int_t
integer type
Definition bitsim_types.h:30
A cell of an OccupancyGrid: its column, along x, and row, along y.
Definition occupancy_grid.h:21
bool operator==(const GridCell &other) const noexcept
Definition occupancy_grid.h:25
int_t row
Definition occupancy_grid.h:23
bool operator!=(const GridCell &other) const noexcept
Definition occupancy_grid.h:29
int_t col
Definition occupancy_grid.h:22