rlabbe / filterpy

Python Kalman filtering and optimal estimation library. Implements Kalman filter, particle filter, Extended Kalman filter, Unscented Kalman filter, g-h (alpha-beta), least squares, H Infinity, smoothers, and more. Has companion book 'Kalman and Bayesian Filters in Python'.
MIT License
3.31k stars 617 forks source link

Why is not possible to set the UKF.R covariance matrix to zero? #214

Closed muttistefano closed 3 years ago

muttistefano commented 3 years ago

Hi, when i set the R covarance matrix to all zeros in the ufk implementation, i get this error:

File "/usr/local/lib/python2.7/dist-packages/filterpy/kalman/sigma_points.py", line 168, in sigma_points U = self.sqrt((lambda_ + n)*P) File "/usr/local/lib/python2.7/dist-packages/scipy/linalg/decomp_cholesky.py", line 91, in cholesky check_finite=check_finite) File "/usr/local/lib/python2.7/dist-packages/scipy/linalg/decomp_cholesky.py", line 40, in _cholesky "definite" % info) numpy.linalg.linalg.LinAlgError: 18-th leading minor of the array is not positive definite

Is there a way to use a zero R matrix? Thanks

rlabbe commented 3 years ago

Why would you want a zero R matrix? That's a statement that the measurement has no error; if there is no error you don't need a filter as the measurement is exactly correct. In any case the answer is no, the built in assumption of the filters is that there are errors/noise both in measurements and the process model.

rlabbe commented 3 years ago

Closing due to lack of response.