4KalmanFilter<T>::KalmanFilter(T processNoise, T sensorNoise, T errorCovariance) {
5 this->processNoise = processNoise;
6 this->sensorNoise = sensorNoise;
8 this->errorCovariance = errorCovariance;
12T KalmanFilter<T>::Filter(T value) {
14 errorCovariance += processNoise;
17 T kalmanGain = errorCovariance / (errorCovariance + sensorNoise);
18 estimation += kalmanGain * (value - estimation);
19 errorCovariance *= T(1) - kalmanGain;