Skip to content

Commit

Permalink
Merge pull request #11 from MOLAorg/10-bad-first-icp-re-starting-from…
Browse files Browse the repository at this point in the history
…-scratch-with-a-new-local-map

Fix NaN pointcloud radius in doInitializeEstimatedMaxSensorRange()
  • Loading branch information
jlblancoc authored Jan 11, 2025
2 parents 8b21ea1 + feb422f commit 8cc4efd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion module/src/LidarOdometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,13 @@ void LidarOdometry::doInitializeEstimatedMaxSensorRange(const mrpt::obs::CObserv
const auto bb = pts->boundingBox();
double radius = std::max(bb.max.norm(), bb.min.norm());

mrpt::keep_max(radius, params_.absolute_minimum_sensor_range);
// check for NaN: See: https://github.com/MOLAorg/mola_lidar_odometry/issues/10
if (radius != radius) {
MRPT_LOG_WARN_STREAM("NaN bounding box for sensor point cloud. Using default sensor range.");
radius = params_.absolute_minimum_sensor_range;
} else {
mrpt::keep_max(radius, params_.absolute_minimum_sensor_range);
}

maxRange = radius;

Expand Down

0 comments on commit 8cc4efd

Please sign in to comment.