Just last week I needed to smooth out a display reading on an oven controller. The RTD was being read way too fast so I'd get a lot of flicker between values due to ADC resolution. In the back of my head I remembered one word: Kalman. This line of code fixed it right up: static float display_temp = 0; display_temp += 0.04 * (adc_temp - display_temp);
Well, I guess, but, I mean, really… that's a first-order low-pass filter.
Rudolf Kálmán Has Died
11–20 of 74 posts
Re: Rudolf Kálmán Has Died
#12Kalman filters are really neat. I wrote one when learning C a while ago and it is just cool what some matrix math can do with practical data. https://github.com/lacker/ikalman Although I guess I should have been calling it a "Kálmán filter" this whole time.
Interesting. I don't see generic Kalman filter implementations too often. Thanks for sharing. I've always found that determining where to put outputs from disparate sensors as opposed to just filtering a single observation like the GPS output in your example is challenging. Have you tried extending this to include input from other sensors (e.g. accelerometer, gyroscope, magnetometer, etc.)?
Re: Rudolf Kálmán Has Died
#13Re: Rudolf Kálmán Has Died
#14Just last week I needed to smooth out a display reading on an oven controller. The RTD was being read way too fast so I'd get a lot of flicker between values due to ADC resolution. In the back of my head I remembered one word: Kalman. This line of code fixed it right up: static float display_temp = 0; display_temp += 0.04 * (adc_temp - display_temp);
Re: Rudolf Kálmán Has Died
#15As someone linked previously, here is a historical perspective [2], and a link to the actual state vector update computations [3].
The AGC maintained the state vectors for the KF. Ground control would run batch mode least squares solutions, and pass it on to the LM, where the updates to the state vector would be applied by hand. The variables of the state vector were a 6x6 matrix of position and velocity in X, Y, and Z or a 9x9 matrix when including radar/landmark bias.
I have great admiration for Mr. Kalman. Controls engineering has greatly benefited from his work.
[0] http://en.wikipedia.org/wiki/Apollo_Guidance_Computer
[1] https://news.ycombinator.com/item?id=8063192
[2] http://www.ieeecss.org/CSM/library/2010/june10/11-Historical...
[3] http://www.ibiblio.org/apollo/listings/Comanche055/MEASUREME...
Re: Rudolf Kálmán Has Died
#16https://news.ycombinator.com/item?id=11561770
I also like this interactive tutorial: http://home.wlu.edu/~levys/kalman_tutorial/
Re: Rudolf Kálmán Has Died
#17Just last week I needed to smooth out a display reading on an oven controller. The RTD was being read way too fast so I'd get a lot of flicker between values due to ADC resolution. In the back of my head I remembered one word: Kalman. This line of code fixed it right up: static float display_temp = 0; display_temp += 0.04 * (adc_temp - display_temp);
A classic example is a fuel gauge where you want to reject low frequency sloshing but have a rapid startup without knowing in advance what the level really is.
Re: Rudolf Kálmán Has Died
#18I made a Kalman Filter visualization[1] last year to learn more about them. It's amazing to see how good a result you can get from very poor sensor data.
In the visualization, a lawnmower (green dot) is tracked (blue circle) using triangulation. The distance sensors have very low accuracy (grey regions). When the mower reaches the edge of the yard, its position and velocity are randomized, but the filter is not told, so it has to reacquire.
Re: Rudolf Kálmán Has Died
#19Re: Rudolf Kálmán Has Died
#20Kalman filters are really neat. I wrote one when learning C a while ago and it is just cool what some matrix math can do with practical data. https://github.com/lacker/ikalman Although I guess I should have been calling it a "Kálmán filter" this whole time.
Interesting. I don't see generic Kalman filter implementations too often. Thanks for sharing. I've always found that determining where to put outputs from disparate sensors as opposed to just filtering a single observation like the GPS output in your example is challenging. Have you tried extending this to include input from other sensors (e.g. accelerometer, gyroscope, magnetometer, etc.)?