Live data from Hacker News

Understanding the Kalman filter with a simple radar example

kalmanfilter.net

41–50 of 71 posts

Re: Understanding the Kalman filter with a simple radar example

#41

Kalman filters are very cool, but when applying them you've got to know that they're not magic. I struggled to apply Kalman Filters for a toy project about ten years ago, because the thing I didn't internalize is that Kalman filters excel at offsetting low-quality data by sampling at a higher rate. You can "retroactively" apply a Kalman filter to a dataset and see some improvement, but you'll only get amazing results…

Thats just a consequence of sample rate as a whole. The entire linear control space is intricately tied to frequency domain, so you have to sample at a rate at least twice higher than your highest frequency event for accurate capture, as per Nyquist theorem. All of that stuff is used in industry because a lot of regulation (for things like aircraft) basically requires your control laws to be linear so that you can pr…

True. I have often encountered motion controllers where the implementer failed to realize that calculating derived variables like acceleration from position and velocity using a direct derivative formula will violate the Nyquist condition, and therefore yields underperforming controllers or totally noisy signal inputs to them. You either need to adjust your sample or control loop rates, or run an appropriate estimator. Depending on the problem it can be something sophisticated like an LQR/KF, or even in some cases a simple alpha-beta-gamma filter (poor version of a predictor-corrector process) can be adequate.

Re: Understanding the Kalman filter with a simple radar example

#42
post #2

Author here. I recently updated the homepage of my Kalman Filter tutorial with a new example based on a simple radar tracking problem. The goal was to make the Kalman Filter understandable to anyone with basic knowledge of statistics and linear algebra, without requiring advanced mathematics. The example starts with a radar measuring the distance to a moving object and gradually builds intuition around noisy measurem…

I recently (~6 mo ago) made it a goal to understand and implement a useful Kalman filter, but I realized that they are very tightly coupled to their domain and application. I got about half as far as I wanted, and took a pause. I expect your work here will get me to the finish line, so I am psyched! Thank you!

Thanks for your feedback! Actually the KF concept is generic, but as mentioned above: "The state transition and measurement equations belong to the system model. They describe the physics of the system and can vary from one application to another."

So it is right to say that the implementation of the KF is tightly coupled to the system. Getting that part right is usually the hardest step.

Re: Understanding the Kalman filter with a simple radar example

#43
Spending few weeks trying to understand Kalman filterm, I figured out that I need to understand all if the following:

1. Model of system

2. Internal state

3. How is optimal estimation defined

4. Covariance (statistics)

Kalman filter is optimal estimation of internal state and covariance of system based on measurements so far.

Kalman process/filter is mathematical solution to this problem as the system is evolving based on input and observable measurements. Turns out that internal state that includes both estimated value and covariance is all that is needed to fully capture internal state for such model.

It is important to undrstand, that having different model for what is optimum, uncertenty or system model, compared to what Rudolf Kalman presented, gives just different mathematical solution for this problem. Examples of different optimal solutions for different estimation models are nonlinear Kalman filters and Wiener filter.

---

I think that book on this topic from author Alex Becker is great and possibly best introduction into this topic. It has lot of examples and builds requred intuition really well. All I was missing is little more emphasis into mathematical rigor and chapter about LQG regulator, but you can find both of this in original paper by Rudolf Kalman.

Re: Understanding the Kalman filter with a simple radar example

#44
post #2

Author here. I recently updated the homepage of my Kalman Filter tutorial with a new example based on a simple radar tracking problem. The goal was to make the Kalman Filter understandable to anyone with basic knowledge of statistics and linear algebra, without requiring advanced mathematics. The example starts with a radar measuring the distance to a moving object and gradually builds intuition around noisy measurem…

I read and enjoyed your book a few months ago when a friend recommened it to me. I've been interested in control theory for a few years, but I'm still definitely a beginner when it comes to designing good control systems and have never done it professionally.

I've been in the process of writing a tutorial on how PID filters work for a much younger audience. As a result, I've been looking back at the original tutorials that made stuff click for me. I had several engineers try to explain PID control to me over the course of about a year, but I don't think I really got it until I ended up watching Terry Davis (yeah, the TempleOS guy) show off how to use PID control in SimStructure using a hovering rocket as an example.

The way he built the concept up was to take each component and build on the control system until he had something that worked. He started off with a simple proportional controller that ended up having a steady state error with the rocket hovering beneath the target height. Once he had that and pointed out the steady state error, he implemented the integral term showed off how it resulted in overshoot. Once that was working, he implemented the derivative control to back the overshoot off until he had something that settled pretty quickly.

I'm not sure how you could do something similar for a Kalman Filter, but I did find it genuinely constructive to see the thought process behind adding each component of the equation.

Re: Understanding the Kalman filter with a simple radar example

#46
When learning the Kalman filter, it clicks in place much faster when there are two or more inputs with different noise profiles. That's why it exists and that's what was its original use-case.

Yet virtually all tutorials stick to single-input examples, which is really an edge case. This site is no exception.

Re: Understanding the Kalman filter with a simple radar example

#47
Kalman filters are great! For people interested of one used in practice, it's used by Sendspin to keep speakers in sync, even works in browsers on phones on 5G etc.

Open the Sendspin live demo in your browser: https://www.sendspin-audio.com/#live-demo

Some more info on Kalman implementation here https://github.com/Sendspin/time-filter/blob/main/docs%2Fthe...

Re: Understanding the Kalman filter with a simple radar example

#48
post #46

When learning the Kalman filter, it clicks in place much faster when there are two or more inputs with different noise profiles. That's why it exists and that's what was its original use-case. Yet virtually all tutorials stick to single-input examples, which is really an edge case. This site is no exception.

Kalman filters have always been about state estimation. What you consider an exception is the default in the vast majority of state estimation scenarios.

Before I got into control theory, I've read a lot of HN posts about kalman filters being the "sensor fusion" algorithm, which is the wrong mental model. You can do sensor fusion with state estimation, but you can't do state estimation with sensor fusion.

Re: Understanding the Kalman filter with a simple radar example

#49
post #33

Earlier quoted context omitted.

I feel like people overcomplicate even the "simple" explanations like the OPs and this one. Basically, a Kalman filter is part of a larger class of "estimators", which take the input data, and run additional processing on top of it to figure out the true measurement. The very basic estimator a low pass filter is also an "estimator" - it rejects high frequency noise, and gives you essentially a moving average. But is…

How does braking work in an aircraft?

When it lands. Auto brakes apply to the wheels to target a specific deceleration target. You don’t want to brake too hard and cause undue wear and you don’t want to under brake and miss your taxiway or go off the runway.

Re: Understanding the Kalman filter with a simple radar example

#50
post #33

Earlier quoted context omitted.

How does braking work in an aircraft?

When it lands. Auto brakes apply to the wheels to target a specific deceleration target. You don’t want to brake too hard and cause undue wear and you don’t want to under brake and miss your taxiway or go off the runway.

Gosh I should have thought of auto-braking. For some reason I kept thinking this was some fancy drone-braking system and couldn't figure out how you'd brake in the air... I never even considered the on-the-ground case. Thanks.
Post reply on HN