From 8453db02a26bb267e1eae88ff08a78d8175e6332 Mon Sep 17 00:00:00 2001 From: Martin Pecka Date: Thu, 3 Jun 2021 12:13:00 +0200 Subject: [PATCH 1/2] Remove clamping from lidar noise Signed-off-by: Martin Pecka --- src/Lidar.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Lidar.cc b/src/Lidar.cc index c065084c..e9dceab7 100644 --- a/src/Lidar.cc +++ b/src/Lidar.cc @@ -211,8 +211,6 @@ void Lidar::ApplyNoise() int index = j * this->RayCount() + i; double range = this->laserBuffer[index*3]; range = this->dataPtr->noises[LIDAR_NOISE]->Apply(range); - range = ignition::math::clamp(range, - this->RangeMin(), this->RangeMax()); this->laserBuffer[index*3] = range; } } From 45a13fe39867fc3da772396ef7cb95817d96a66d Mon Sep 17 00:00:00 2001 From: Martin Pecka Date: Fri, 4 Jun 2021 00:42:16 +0200 Subject: [PATCH 2/2] Clamp finite values Signed-off-by: Martin Pecka --- src/Lidar.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Lidar.cc b/src/Lidar.cc index e9dceab7..c88a0083 100644 --- a/src/Lidar.cc +++ b/src/Lidar.cc @@ -211,6 +211,11 @@ void Lidar::ApplyNoise() int index = j * this->RayCount() + i; double range = this->laserBuffer[index*3]; range = this->dataPtr->noises[LIDAR_NOISE]->Apply(range); + if (std::isfinite(range)) + { + range = ignition::math::clamp(range, + this->RangeMin(), this->RangeMax()); + } this->laserBuffer[index*3] = range; } }