swt2c / rpms / gazebo

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