Skip to content

Commit

Permalink
refactor: Remove debug print statements and optimize grid initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
technolojin committed Nov 12, 2024
1 parent 47cc4cf commit 02ba345
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,27 +160,6 @@ class Grid

// set initialized flag
is_initialized_ = true;

{
// print debug information, size,
std::cout << "Grid initialized." << std::endl;
// grid_radial_limit_
std::cout << "Grid radial limit: " << grid_radial_limit_ << std::endl;
// distance grid size and positions
std::cout << "Grid distance size: " << grid_dist_size_ << std::endl;
for (size_t i = 0; i < grid_radial_boundaries_.size(); ++i) {
std::cout << "Grid radial boundary: " << grid_radial_boundaries_[i]
<< ", Grid azimuth number: " << azimuth_grids_per_radial_[i]
<< ", Grid azimuth interval: " << azimuth_interval_per_radial_[i] * 180 / (M_PI)
<< std::endl;
}

// offset list
for (size_t i = 0; i < radial_idx_offsets_.size(); ++i) {
std::cout << "Grid id offset: " << radial_idx_offsets_[i] << std::endl;
}
std::cout << "Grid size: " << cells_.size() << std::endl;
}
}

// method to add a point to the grid
Expand Down Expand Up @@ -231,53 +210,6 @@ class Grid
}
}

// may not needed
void setGridStatistics()
{
// debug information for new grid

// check a line of cells
int current_grid_idx = 2;
while (current_grid_idx >= 0) {
const Cell & cell = cells_[current_grid_idx];
std::cout << "====== Grid id: " << cell.grid_idx_
<< ", Number of points: " << cell.getPointNum() << std::endl;

// print previous grid, only exists
if (cell.prev_grid_idx_ >= 0) {
const Cell & prev_cell = cells_[cell.prev_grid_idx_];
std::cout << "- prev grid id: " << prev_cell.grid_idx_
<< ", position radius: " << prev_cell.center_radius_
<< " azimuth: " << prev_cell.center_azimuth_ * 180 / M_PI << std::endl;
}

if (cell.scan_grid_root_idx_ >= 0) {
const Cell & scan_root_cell = cells_[cell.scan_grid_root_idx_];
std::cout << "- scan root grid id: " << scan_root_cell.grid_idx_
<< ", position radius: " << scan_root_cell.center_radius_
<< " azimuth: " << scan_root_cell.center_azimuth_ * 180 / M_PI << std::endl;
}

// print index of the cell
std::cout << "- curr grid id: " << cell.grid_idx_
<< ", position radius: " << cell.center_radius_
<< " azimuth: " << cell.center_azimuth_ * 180 / M_PI << std::endl;

// print position of the cell
std::cout << "index radial: " << cell.radial_idx_ << " azimuth: " << cell.azimuth_idx_
<< std::endl;

// print next grid, only exists
if (cell.next_grid_idx_ >= 0) {
const Cell & next_cell = cells_[cell.next_grid_idx_];
std::cout << "- next grid id: " << next_cell.grid_idx_
<< ", position radius: " << next_cell.center_radius_
<< " azimuth: " << next_cell.center_azimuth_ * 180 / M_PI << std::endl;
}
current_grid_idx = cell.next_grid_idx_;
}
}

void setGridConnections()
{
std::unique_ptr<ScopedTimeTrack> st_ptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ void GridGroundFilter::preprocess()

// eliminate empty cells from connection for efficiency
grid_ptr_->setGridConnections();

// debug message
// grid_ptr_->setGridStatistics();
}

bool GridGroundFilter::recursiveSearch(
Expand Down Expand Up @@ -390,14 +387,6 @@ void GridGroundFilter::classify(pcl::PointIndices & out_no_ground_indices)

cell.is_processed_ = true;
}

// // debug: cell info for all non-empty cells
// std::cout << "cell index: " << cell.grid_idx_
// << " number of points: " << cell.getPointNum()
// << " has ground: " << cell.has_ground_
// << " avg height: " << cell.avg_height_ << " avg radius: " << cell.avg_radius_
// << " gradient: " << cell.gradient_ << " intercept: " << cell.intercept_
// << std::endl;
}
}

Expand Down

0 comments on commit 02ba345

Please sign in to comment.