void Submap2D::Finish()
1 2 3 4
| CHECK(grid_); CHECK(!insertion_finished()); grid_ = grid_->ComputeCroppedGrid(); set_insertion_finished(true);
|
这里的set_insertion_finished(true);
就是子图结束建图了,可以添加函数isFinished
判断,其实就是判断insertion_finished_
是否true。 子图建完才会进入后端
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| std::unique_ptr<Grid2D> ProbabilityGrid::ComputeCroppedGrid() const { Eigen::Array2i offset; CellLimits cell_limits; ComputeCroppedLimits(&offset, &cell_limits); const double resolution = limits().resolution(); const Eigen::Vector2d max = limits().max() - resolution * Eigen::Vector2d(offset.y(), offset.x()); std::unique_ptr<ProbabilityGrid> cropped_grid = absl::make_unique<ProbabilityGrid>( MapLimits(resolution, max, cell_limits), conversion_tables_); for (const Eigen::Array2i& xy_index : XYIndexRangeIterator(cell_limits)) { if (!IsKnown(xy_index + offset)) continue; cropped_grid->SetProbability(xy_index, GetProbability(xy_index + offset) ); } return std::unique_ptr<Grid2D>(cropped_grid.release()); }
|
1 2 3 4
| void set_insertion_finished(bool insertion_finished) { insertion_finished_ = insertion_finished; }
|