21 #include "glog/logging.h" 27 void InsertMissesIntoGrid(
const std::vector<uint16>& miss_table,
28 const Eigen::Vector3f& origin,
30 HybridGrid* hybrid_grid,
31 const int num_free_space_voxels) {
32 const Eigen::Array3i origin_cell = hybrid_grid->GetCellIndex(origin);
33 for (
const Eigen::Vector3f& hit : returns) {
34 const Eigen::Array3i hit_cell = hybrid_grid->GetCellIndex(hit);
36 const Eigen::Array3i delta = hit_cell - origin_cell;
37 const int num_samples = delta.cwiseAbs().maxCoeff();
38 CHECK_LT(num_samples, 1 << 15);
45 for (
int position = std::max(0, num_samples - num_free_space_voxels);
46 position < num_samples; ++position) {
47 const Eigen::Array3i miss_cell =
48 origin_cell + delta * position / num_samples;
49 hybrid_grid->ApplyLookupTable(miss_cell, miss_table);
58 proto::RangeDataInserterOptions3D options;
59 options.set_hit_probability(
60 parameter_dictionary->
GetDouble(
"hit_probability"));
61 options.set_miss_probability(
62 parameter_dictionary->
GetDouble(
"miss_probability"));
63 options.set_num_free_space_voxels(
64 parameter_dictionary->
GetInt(
"num_free_space_voxels"));
65 CHECK_GT(options.hit_probability(), 0.5);
66 CHECK_LT(options.miss_probability(), 0.5);
71 const proto::RangeDataInserterOptions3D& options)
80 CHECK_NOTNULL(hybrid_grid);
82 for (
const Eigen::Vector3f& hit : range_data.
returns) {
83 const Eigen::Array3i hit_cell = hybrid_grid->
GetCellIndex(hit);
90 hybrid_grid,
options_.num_free_space_voxels());
std::vector< uint16 > ComputeLookupTableToApplyOdds(const float odds)
proto::RangeDataInserterOptions3D CreateRangeDataInserterOptions3D(common::LuaParameterDictionary *parameter_dictionary)
const proto::RangeDataInserterOptions3D options_
double GetDouble(const std::string &key)
void Insert(const sensor::RangeData &range_data, HybridGrid *hybrid_grid) const
float Odds(float probability)
proto::ProbabilityGridRangeDataInserterOptions2D options_
bool ApplyLookupTable(const Eigen::Array3i &index, const std::vector< uint16 > &table)
const std::vector< uint16 > hit_table_
std::vector< Eigen::Vector3f > PointCloud
const std::vector< uint16 > miss_table_
Eigen::Array3i GetCellIndex(const Eigen::Vector3f &point) const
RangeDataInserter3D(const proto::RangeDataInserterOptions3D &options)
int GetInt(const std::string &key)