Commit d9ea0c9
Fix UKF negative variance by adding diagonal regularization
The standard UKF covariance update P = P - K*S*K' is numerically
unstable and can produce negative eigenvalues due to floating-point
rounding errors, causing the health monitor to fail with "Negative
variance on diagonal" errors.
This fix adds gentle diagonal regularization (eps = 1e-9) after the
covariance update to prevent negative eigenvalues without drastically
affecting filter behavior. The approach uses symmetrize() followed by
small diagonal additions, which is more stable than aggressive
eigenvalue flooring that can cause filter divergence.
Fixes #133
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent c27fa87 commit d9ea0c9
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
304 | 310 | | |
305 | 311 | | |
306 | 312 | | |
| |||
0 commit comments