gazebosim/gz-sensors

[GaussianNoiseModel] Crash if initialized with zero bias standard deviation

oysstu opened this issue · 0 comments

oysstu commented

The bias state is sampled when loading sdf::Noise. If the bias standard deviation is set to zero, the program exits. I can see legitimate use for a deterministic bias state (or disabling the bias state altogether).

biasMean = _sdf.BiasMean();
biasStdDev = _sdf.BiasStdDev();
this->dataPtr->bias = math::Rand::DblNormal(biasMean, biasStdDev);

The program also crashes when sampling the distribution if the state standard deviation is zero. Usually that would indicate wrong parameters being passed, but I suppose a legitimate use case could be to disable noise altogether.

double whiteNoise = math::Rand::DblNormal(
this->dataPtr->mean, this->dataPtr->stdDev);