4 const double start_augmentation,
const double radius_augmentation,
6 : range_(range), grid_geometry_(angle, radius, start_augmentation, radius_augmentation, fov) {
9 grid_.resize(num_slices_, std::vector<float>(num_bins_, std::numeric_limits<float>::quiet_NaN()));
18 if (slice < 0 || slice >= num_slices_ || bin_idx < 0 || bin_idx >= num_bins_) {
19 return std::numeric_limits<float>::quiet_NaN();
22 return grid_[slice][bin_idx];
31 if (slice < 0 || slice >= num_slices_ || bin_idx < 0 || bin_idx >= num_bins_) {
35 if (std::isnan(
grid_[slice][bin_idx])) {
36 grid_[slice][bin_idx] = height;
39 grid_[slice][bin_idx] = std::min(
grid_[slice][bin_idx], height);
44 for (
auto& row :
grid_) {
45 std::fill(row.begin(), row.end(), std::numeric_limits<float>::quiet_NaN());
std::vector< std::vector< float > > grid_
void set_ground_height(const float x, const float y, const float height)
Set the ground height at a specific (x, y) location.
float get_ground_height(const float x, const float y) const
Get the ground height at a specific (x, y) location.
void reset_grid()
Reset the ground grid to initial state.
GridGeometry grid_geometry_
int get_bin_index(double x, double y) const
Compute bin index for a given (x, y)
int get_slice_index(double x, double y) const
Compute slice index for a given (x, y)
int get_num_slices() const
Get the number of slices in the grid.
int get_num_bins(double range) const
Get the number of bins for a given range.