Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The real use of Kalman filter is model-data fusion. But to do model-data fusion, you need a model. In this blog post, they use

μₖ = μₖ₋₁

as the model. If your model assumes that the process just stays constant, then all you are left with is filtering the noise.

https://en.wikipedia.org/wiki/Kalman_filter



Author here. A unitary model is still a model; I chose it mainly just to minimize the mental overhead for the reader. But even if you use a different model, the Kalman filter will still converge to a frequency-domain filter as long as the dynamics are not time-dependent (ie, constant measurement noise).


Feels kind of disingenuous though. The article makes it seem like you’re suggesting you can measure angle with simply a gyroscope + a low pass filter. But in reality, that method does not work at all (hence the famous NASA problem that Kalman filter solved). You need multiple input state space model to see the magic of Kalman filters.


Hmm, I'm not trying to make that suggestion at all. How did I make that impression? I'd like to correct it.

My goal with this article is only to help readers who have wondered how time-domain approaches like Kalman filtering relate to frequency-domain approaches like low-pass filtering, and to connect those dots. It's not a comprehensive article about the magic of Kalman filters.


(I do not have a PhD in control systems or specialize in it so take my input with a grain of salt) I think it's because Kalman filters and low pass filter are trying to achieve similar but different end goals. Kalman filter is trying to get a measurement and lower it's uncertainty. A low pass filter is trying to remove high fluctuations assuming those fluctuations is noise. As mentioned before, a low pass filter cannot achieve what a Kalman filter can. The example you show works because the noise is set to the high fluctuations. I think explaining a multiple input system is extremely critical to Kalman filters. Without it, it makes it a bit deceiving. For instance, if you do the same exercise in the article but measuring angle, you quickly see how a gyroscope + lowpass filter never reaches the level of measurement compared to gyroscope + accelerometer. Even funner, you can increase the noise in the gyroscope + accelerometer while keeping the gyroscope + lowpass filter noise the same, the gyroscope + accelerometer with a Kalman filter would always perform better.


Control theory person here. In the linear case resulting "system" is a linear time-invariant system. That's the standard state space system that you can convert and obtain a transfer function. But from a higher order transfer function, through partial fraction decomposition you can always write it as a sum of simple lead-lag and second order filters. So the distinction in the post and also discussion here is kind of orthogonal semantics. What NASA did was to "extend" the kalman filter for nonlinear cases (actually their extension was also not so big but if it works it works). In short every linear system can be written as a sum of trivial components such as low pass/notches/anti-notches etc. This is in fact how you implement higher order controllers real time.

The MIMO distinction is also not super important. Since you can also have MIMO low pass filters. The real difficulty is obtaining the coefficients of these filters and hopefully find the best ones. That's where you start getting into the optimality and the real contribution of these tools. But as a side-effect you must assume that the noise is Gaussian otherwise you lose much of the niceties of the theoretical guarantees. This is basically the biggest control theoretical disadvantage of kalman filters and the reason why other domains keep rediscovering it while in control it is "kinda, sorta" falling out of grace.


Thanks, and I broadly agree with what you say. It's only under specific conditions (system dynamics, process covariance, measurement matrices, and measurement covariance are all static) that the Kalman filter converges to the Wiener filter, as Kálmán says in his paper.

I would contest that the reason a frequency filter doesn't work on a gyroscope is not because it's a MIMO system (which frequency domain techniques can generalize to; you just end up with n x m transfer functions) but because the system is not static, so it doesn't satisfy the conditions that would cause the Kalman filter to converge to a fixed-coefficient filter.


The title is probably the issue. People read it and go in expecting you to make that case. In seeking brevity it seems you lost sufficient context and nuance.


Good point, thanks. When I get home I'll update the article title to "Is the Kalman filter a low-pass filter? Sometimes!"


Betteridge's law of headlines should make people suspicious.


even as a static model, it is not a low pass filter.

in fact, in the static case, a kalman filter is exactly the same as the recursive least squares estimator, which is provably the optimal unbiased estimator


In the static case, the Kalman filter converges to a fixed (frequency domain) filter after running for a while. The type of frequency behaviour depends on the system properties. The filter it converges to is the Wiener filter for that system.


FWIW, in the context of robotics, where there are real inputs you set, the motion model ends up being extremely useful and behaves much differently than just a frequency-domain filter.

But the overall subject of comparison to just a low pass filter is very interesting


Absolutely! And thank you for saying so. (To be clear, the answer to the question posed in the title was never intended to be yes. The answer was intended to be sometimes.)

In one of my other articles where I applied the Kalman filter to a more complex system, a frequency-domain filter would have failed. But in this article I tried to stick to the simplest possible system, so that the math wouldn't get in the way of illustrating the way in which Kalman and Wiener filters relate to each other, since it's an interesting connection that doesn't get much attention.


Not a robotics expert. But my understanding of the effect of input/motion models on the state estimation of Kalman filters is that it conditions the error covariance of the state estimate.

So, when the quality of measurements is very high (almost no noise), then the motion model provides very little benefit. And when the measurement quality is very low, the motion model reduces the error ellipse around the real state of the system.

So, even when there are inputs and a motion model you could imagine the Kalman Filter as a frequency-domain filter (E.G. IIR/FIR filter), where the tap weights are being updated based on some known function.

If the quality of the measurements are high enough, and the sampling frequency is high enough. Then the Kalman filter should be able to converge to a very good estimate of state, even with no motion model right? In which case it would have the exact same characteristics as an adaptive, slowly time-varying frequency-domain filter.


> If the quality of the measurements are high enough, and the sampling frequency is high enough. Then the Kalman filter should be able to converge to a very good estimate of state, even with no motion model right?

No. Consider this discrete-time linear system with 2-dimensional state [x1, x2] and one output y:

    x1' = 2 * x1
    x2' = x2
    y = x1 + x2
Suppose we see the output sequence 1, 2, 4, 8, ... If we know the motion model, then we know that the initial state must have been [1, 0]. (In technical terms, the pair (A, C) is observable.) But if we don't have the motion model -- all we know is that y = x1 + x2 -- there's no hope of ever getting a state estimate, even if our y measurement has zero noise.


for whatever it's worth, as a reader I thought the simple model was very helpful in giving me a bit of intuition as to what's going on.


Totally agreed, some people just gloss over the state space model aspect of control systems which is pretty much the foundation of all these type of filters


Hey there's all the interactive multiple model fancy, where you can run (and make compete or merge) several models together, and for some kinds of tracking activities, the 'the thing doesn't move and is just fixed and noisy' is part of the constellation of competing models.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: