Live data from Hacker News

Understanding the Kalman filter with a simple radar example

kalmanfilter.net

61–70 of 71 posts

Re: Understanding the Kalman filter with a simple radar example

#61
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 think that this was a great intro into Kalman filtering. The one important point that I think warrants a small paragraph near the end is that the example you gave is a way of doing forecasting (estimating the future state) and nowcasting (estimating the current state), but Kalman filters can also be used retrospectively to do retrocasting (using the present data to get a better estimate of the past). Nowcasting and…

Thanks a lot for this comment, Ted! This probably deserves its own example, not just a brief mention. I will definitely do that.

Re: Understanding the Kalman filter with a simple radar example

#62
post #30

Earlier quoted context omitted.

It is always a good idea to include outliers treatment in KF algorithm to filter out weird measurements.

Ah but then you just move the error case to outlier detection.

True. It's about managing the risk rather than eliminating it. If you remove an outlier, you get a missing measurement and, as a result, higher uncertainty (error). But it is still better than keeping the outlier.

Re: Understanding the Kalman filter with a simple radar example

#63
post #25

Here's my (hopefully) intuitive guide: 1. understand weighted least squares and how you can update an initial estimate (prior mean and variance) with a new measurement and its uncertainty (i.e. inverse variance weighted least squares) 2. this works because the true mean hasn't changed between measurements. What if it did? 3. KF uses a model of how the mean changes to predict what it should be now based on the past, i…

[dead]

Re: Understanding the Kalman filter with a simple radar example

#64
I recently built a drone from the ground up - learned how to build PCB's with the ESP32, wrote all of the flight firmware, etc. and built a controller iOS app.

Extended Kalman Filters are even more interesting because they let you do sensor fusion and such

Re: Understanding the Kalman filter with a simple radar example

#66
post #53

Could the Kalman Filter idea be applied to human witnesses to an event, where you model the person as a faulty sensor?

Kalman filter is about combining uncertain measurements, and human observations could be viewed as noisy sensors. On the other hand, the standard KF assumes unbiased sensors with Gaussian noise, and I don't know if those assumptions hold for human witnesses.

That's an interesting wrinkle. How would you model the potential bias in order to neutralize it though? Or would enough measurements simply cancel out any bias (or be very likely to)?

Re: Understanding the Kalman filter with a simple radar example

#67
I have worked with Kalman Filters for years, and gave this quick read. I saw the comments on Process Noise, so I focus there for now. I might get back to other sections tomorrow.

My simple head space (as I was taught and re-learned thru experience, and have passed on)

1. Kalman Gain close to 1 or 0 is a warning sign that careful consideration is needed.

This fact can be brought up immediately in example #5 and continued

2a. K close to 1.0 can be bad because..., however for some applications (dynamic models) it can be acceptable since...

2b. K close to 0.0 can be bad because... however for some applications (dynamic models) it can be acceptable since...

3. To solve the problem from step 2, As a first step, for those applications where K close to zero or one is bad... a fudge factor term (called Q for reasons discussed later) can be added to the Kalman Gain computation

3a. Choosing the correct fudge factor for the application is often very difficult and may require lots of simulation runs (a parameter study) with different measurement sequences (including some expected off-nominals) and various values for the process noise.

Remember we are designing a filter, likely for a new application (or a non-trivial extension of an existing application)... so all the elements of an engineering design are needed. Make solution hypothesis, test them, refine them, test them some more with greater realism and eventually real-world data, continue to refine the solution.

4. For easy case of a simple application and only a few unknown states, the process noise can be guesstimated from experience. For more complex applications (perhaps there are dozens of unknown states to estimate) a more rigorous approach to select the correct mathematical description of Process Noise is needed.

-- End of Fudge Factor discussion --

5. Here you can introduce the notion that the state dynamics cannot model everything and that unmodeled part can be approximated by Process Noise. For example an unmodeled constant acceleration, gives dt^4

Here are some sentences I think are wrong or misleading

"As you can see, the Kalman Gain gradually decreases; therefore, the KF converges." However, the Kalman Filter may converge to garbage. This garbage could be a "lag", or just plain wrong.

"The process noise produces estimation errors." A well chosen process noise is important to reduce estimation errors over an ensemble of conditions, by accommodating a range of unmodeled state dynamics. A poorly chosen process may not improve anything.

Re: Understanding the Kalman filter with a simple radar example

#68
I have worked with Kalman Filters for years, and gave this quick read. I saw the comments on Process Noise, so I focus there for now. I might get back to other sections tomorrow.

My simple head space (as I was taught and re-learned thru experience, and have passed on)

1. Kalman Gain close to 1 or 0 is a warning sign that careful consideration is needed.

This fact can be brought up immediately in example #5 and continued

2a. K close to 1.0 can be bad because..., however for some applications (dynamic models) it can be acceptable since...

2b. K close to 0.0 can be bad because... however for some applications (dynamic models) it can be acceptable since...

3. To solve the problem from step 2, As a first step, for those applications where K close to zero or one is bad... a fudge factor term (called Q for reasons discussed later) can be added to the Kalman Gain computation

3a. Choosing the correct fudge factor for the application is often very difficult and may require lots of simulation runs (a parameter study) with different measurement sequences (including some expected off-nominals) and various values for the process noise.

Remember we are designing a filter, likely for a new application (or a non-trivial extension of an existing application)... so all the elements of an engineering design are needed. Make solution hypothesis, test them, refine them, test them some more with greater realism and eventually real-world data, continue to refine the solution.

4. For easy case of a simple application and only a few unknown states, the process noise can be guesstimated from experience. For more complex applications (perhaps there are dozens of unknown states to estimate) a more rigorous approach to select the correct mathematical description of Process Noise is needed.

-- End of Fudge Factor discussion --

{I think you covered this section well} Then you can introduce the notion that the state dynamics cannot model everything and that unmodeled part can be approximated by Process Noise. For example an unmodeled constant acceleration, gives a process noise of ....

Here are some sentences I think are wrong or misleading

"As you can see, the Kalman Gain gradually decreases; therefore, the KF converges." However, the Kalman Filter may converge to garbage. This garbage could be a "lag", or just plain wrong.

"The process noise produces estimation errors." A well chosen process noise is important to reduce estimation errors over an ensemble of conditions, by accommodating a range of unmodeled state dynamics. A poorly chosen process may not improve anything.

Re: Understanding the Kalman filter with a simple radar example

#69

I have worked with Kalman Filters for years, and gave this quick read. I saw the comments on Process Noise, so I focus there for now. I might get back to other sections tomorrow. My simple head space (as I was taught and re-learned thru experience, and have passed on) 1. Kalman Gain close to 1 or 0 is a warning sign that careful consideration is needed. This fact can be brought up immediately in example #5 and contin…

Thanks a lot for your detailed and valuable comments. I will definitely include them in the tutorial. If you have additional comments, I would be happy to hear them.

Re: Understanding the Kalman filter with a simple radar example

#70
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 tutorial…

I personally found this video on PID really good

https://youtu.be/Y3MgFS-9l3s

Post reply on HN