21 #include "glog/logging.h" 24 namespace mapping_3d {
28 void InsertMissesIntoGrid(
const std::vector<uint16>& miss_table,
29 const Eigen::Vector3f& origin,
31 HybridGrid* hybrid_grid,
32 const int num_free_space_voxels) {
33 const Eigen::Array3i origin_cell = hybrid_grid->GetCellIndex(origin);
34 for (
const Eigen::Vector3f&
hit : returns) {
35 const Eigen::Array3i hit_cell = hybrid_grid->GetCellIndex(
hit);
37 const Eigen::Array3i delta = hit_cell - origin_cell;
38 const int num_samples = delta.cwiseAbs().maxCoeff();
39 CHECK_LT(num_samples, 1 << 15);
46 for (
int position = std::max(0, num_samples - num_free_space_voxels);
47 position < num_samples; ++position) {
48 const Eigen::Array3i miss_cell =
49 origin_cell + delta * position / num_samples;
50 hybrid_grid->ApplyLookupTable(miss_cell, miss_table);
59 proto::RangeDataInserterOptions options;
60 options.set_hit_probability(
61 parameter_dictionary->
GetDouble(
"hit_probability"));
62 options.set_miss_probability(
63 parameter_dictionary->
GetDouble(
"miss_probability"));
64 options.set_num_free_space_voxels(
65 parameter_dictionary->
GetInt(
"num_free_space_voxels"));
66 CHECK_GT(options.hit_probability(), 0.5);
67 CHECK_LT(options.miss_probability(), 0.5);
72 const proto::RangeDataInserterOptions& options)
81 CHECK_NOTNULL(hybrid_grid)->StartUpdate();
83 for (
const Eigen::Vector3f&
hit : range_data.
returns) {
84 const Eigen::Array3i hit_cell = hybrid_grid->
GetCellIndex(hit);
91 hybrid_grid,
options_.num_free_space_voxels());
proto::RangeDataInserterOptions options_
std::vector< uint16 > ComputeLookupTableToApplyOdds(const float odds)
Eigen::Array3i GetCellIndex(const Eigen::Vector3f &point) const
const std::vector< uint16 > miss_table_
proto::RangeDataInserterOptions CreateRangeDataInserterOptions(common::LuaParameterDictionary *parameter_dictionary)
int GetInt(const string &key)
const std::vector< uint16 > hit_table_
double GetDouble(const string &key)
float Odds(float probability)
const proto::RangeDataInserterOptions options_
std::vector< Eigen::Vector3f > PointCloud
RangeDataInserter(const proto::RangeDataInserterOptions &options)
void Insert(const sensor::RangeData &range_data, HybridGrid *hybrid_grid) const
bool ApplyLookupTable(const Eigen::Array3i &index, const std::vector< uint16 > &table)