23 #include "occupancygrid.h" 45 OccupancyGrid::OccupancyGrid(
int width,
int height,
int cell_width,
int cell_height)
49 cell_width_ = cell_width;
50 cell_height_ = cell_height;
56 OccupancyGrid::~OccupancyGrid()
58 occupancy_probs_.clear();
65 OccupancyGrid::get_cell_width()
74 OccupancyGrid::get_cell_height()
83 OccupancyGrid::get_width()
92 OccupancyGrid::get_height()
101 OccupancyGrid::set_cell_width(
int width)
110 OccupancyGrid::set_cell_height(
int height)
112 cell_height_ = height;
119 OccupancyGrid::set_width(
int width)
129 OccupancyGrid::set_height(
int height)
144 if( (x < width_) && (y < height_) && ((
isProb(prob)) || (prob == 2.f)) )
145 occupancy_probs_[x][y] = prob;
154 if((
isProb(prob)) || (prob == -1.f)) {
155 for(
int x = 0; x < width_; x++) {
156 for(
int y = 0; y < height_; y++) {
157 occupancy_probs_[x][y] = prob;
169 OccupancyGrid::get_prob(
int x,
int y)
171 if( (x >= 0) && (x < width_) && (y >= 0) && (y < height_) ) {
172 return occupancy_probs_[x][y];
184 OccupancyGrid::operator () (
const int x,
const int y)
186 return occupancy_probs_[x][y];
191 OccupancyGrid::init_grid()
193 occupancy_probs_.clear();
194 std::vector<Probability> column;
195 column.resize(height_, 0.f);
196 occupancy_probs_.resize(width_, column);
float Probability
A probability type.
Fawkes library namespace.
bool isProb(Probability p)
Check if the probability value is valid.