swt2c / rpms / gazebo

Forked from rpms/gazebo 4 years ago
Clone

Blame gazebo-gaussian-noise-model-with-0-bias-stddev.patch

176b11b
diff -r a2410ee85ccb gazebo/sensors/GaussianNoiseModel.cc
176b11b
--- a/gazebo/sensors/GaussianNoiseModel.cc	Sat Feb 10 18:55:41 2018 +0000
176b11b
+++ b/gazebo/sensors/GaussianNoiseModel.cc	Thu Jun 28 13:07:08 2018 +0200
176b11b
@@ -114,7 +114,12 @@
176b11b
     biasMean = _sdf->Get<double>("bias_mean");
176b11b
   if (_sdf->HasElement("bias_stddev"))
176b11b
     biasStdDev = _sdf->Get<double>("bias_stddev");
176b11b
-  this->bias = ignition::math::Rand::DblNormal(biasMean, biasStdDev);
176b11b
+  if (biasStdDev > 0) {
176b11b
+    this->bias = ignition::math::Rand::DblNormal(biasMean, biasStdDev);
176b11b
+  } else {
176b11b
+    // StdDev == 0, not a proper normal distribution. Use the mean instead.
176b11b
+    this->bias = biasMean;
176b11b
+  }
176b11b
   // With equal probability, we pick a negative bias (by convention,
176b11b
   // rateBiasMean should be positive, though it would work fine if
176b11b
   // negative).