Move single caller function to call site. (#113)

master
Damon Kohler 2016-10-28 16:27:06 +02:00 committed by Wolfgang Hess
parent 1081473be9
commit 32b5beb225
3 changed files with 16 additions and 18 deletions

View File

@ -178,6 +178,20 @@ void InsertSegmentsIntoProbabilityGrid(
} }
} }
// Filters 'laser_fan', retaining only the returns that have no more than
// 'max_range' distance from the laser origin. Removes misses and reflectivity
// information.
sensor::LaserFan FilterLaserFanByMaxRange(const sensor::LaserFan& laser_fan,
const float max_range) {
sensor::LaserFan result{laser_fan.origin, {}, {}, {}};
for (const Eigen::Vector3f& return_ : laser_fan.returns) {
if ((return_ - laser_fan.origin).norm() <= max_range) {
result.returns.push_back(return_);
}
}
return result;
}
} // namespace } // namespace
void InsertIntoProbabilityGrid( void InsertIntoProbabilityGrid(
@ -273,7 +287,7 @@ void Submaps::InsertLaserFan(const sensor::LaserFan& laser_fan) {
for (const int index : insertion_indices()) { for (const int index : insertion_indices()) {
Submap* submap = submaps_[index].get(); Submap* submap = submaps_[index].get();
laser_fan_inserter_.Insert( laser_fan_inserter_.Insert(
sensor::FilterLaserFanByMaxRange(laser_fan, FilterLaserFanByMaxRange(laser_fan,
options_.high_resolution_max_range()), options_.high_resolution_max_range()),
&submap->high_resolution_hybrid_grid); &submap->high_resolution_hybrid_grid);
laser_fan_inserter_.Insert(laser_fan, &submap->low_resolution_hybrid_grid); laser_fan_inserter_.Insert(laser_fan, &submap->low_resolution_hybrid_grid);

View File

@ -94,17 +94,6 @@ LaserFan TransformLaserFan(const LaserFan& laser_fan,
}; };
} }
LaserFan FilterLaserFanByMaxRange(const LaserFan& laser_fan,
const float max_range) {
LaserFan result{laser_fan.origin, {}, {}, {}};
for (const Eigen::Vector3f& return_ : laser_fan.returns) {
if ((return_ - laser_fan.origin).norm() <= max_range) {
result.returns.push_back(return_);
}
}
return result;
}
LaserFan CropLaserFan(const LaserFan& laser_fan, const float min_z, LaserFan CropLaserFan(const LaserFan& laser_fan, const float min_z,
const float max_z) { const float max_z) {
return LaserFan{laser_fan.origin, Crop(laser_fan.returns, min_z, max_z), return LaserFan{laser_fan.origin, Crop(laser_fan.returns, min_z, max_z),

View File

@ -54,11 +54,6 @@ LaserFan FromProto(const proto::LaserFan& proto);
LaserFan TransformLaserFan(const LaserFan& laser_fan, LaserFan TransformLaserFan(const LaserFan& laser_fan,
const transform::Rigid3f& transform); const transform::Rigid3f& transform);
// Filter a 'laser_fan', retaining only the returns that have no more than
// 'max_range' distance from the laser origin. Removes misses and reflectivity
// information.
LaserFan FilterLaserFanByMaxRange(const LaserFan& laser_fan, float max_range);
// Crops 'laser_fan' according to the region defined by 'min_z' and 'max_z'. // Crops 'laser_fan' according to the region defined by 'min_z' and 'max_z'.
LaserFan CropLaserFan(const LaserFan& laser_fan, float min_z, float max_z); LaserFan CropLaserFan(const LaserFan& laser_fan, float min_z, float max_z);