[HN Gopher] Basis of the Kalman Filter [pdf]
       ___________________________________________________________________
        
       Basis of the Kalman Filter [pdf]
        
       Author : fzliu
       Score  : 127 points
       Date   : 2025-02-12 20:17 UTC (1 days ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | esafak wrote:
       | They also had nice tutorials on particle filters. I can't find
       | the one I wanted but these are close:
       | 
       | https://cecas.clemson.edu/~ahoover/ece854/refs/Djuric-Partic...
       | 
       | https://eprints.lancs.ac.uk/id/eprint/53537/1/Introduction_t...
       | 
       | https://ieeeoes.org/wp-content/uploads/2021/02/BPF_SPMag_07....
        
         | namibj wrote:
         | Thanks, I'll see about Box-PF when trying to get IMU-filtered
         | indoor-localization working (once I hopefully get that far with
         | the UWB firmware [0]). Accounting for clock drift across the
         | "satellites" is going to be "fun", but at least it's both
         | useful in practice and of manageable complexity/scope.
         | 
         | [0]: I'll happily talk about it at 39c3.
        
           | jhoydich wrote:
           | PF is a great tool for UWB. Even without IMU data and instead
           | adding uniform diffusion of the particles between updates
           | tracking worked well in a 2D environment. It sounds like
           | you're working on TDOA for UWB?
        
         | brcmthrowaway wrote:
         | its a pity there are no good software packages for particle
         | filters
        
           | esafak wrote:
           | I haven't used them yet but I know of pyro, pfjax, and pymc:
           | 
           | https://pyro.ai/examples/smcfilter.html
           | 
           | https://pfjax.readthedocs.io/
           | 
           | https://www.pymc.io/projects/examples/en/latest/samplers/SMC.
           | ..
        
           | jvanderbot wrote:
           | The problem with this idea is that deriving all the
           | propagation and measurement functions and associated
           | jacobians is 99% of the problem. Once that's done you can
           | implement literally any filter from them using Wikipedia.
        
       | JohnKemeny wrote:
       | See also
       | 
       | Kalman Filter Explained Simply (2024, 89 comments)
       | https://news.ycombinator.com/item?id=39343746
       | 
       | A non-mathematical introduction to Kalman filters for programmers
       | (2023, 97 comments) https://news.ycombinator.com/item?id=36971975
        
         | gradascent wrote:
         | I've found this "book" (series of jupyter notebooks) to be a
         | fantastic course on the Kalman filter from basics to advanced
         | topics. https://github.com/rlabbe/Kalman-and-Bayesian-Filters-
         | in-Pyt...
        
       | carabiner wrote:
       | Kalman filter is the "learn python in 24 hours" for HN.
        
         | zevv wrote:
         | And monads. But I've heard they're just like burritos, so how
         | hard can it be.
        
           | hansvm wrote:
           | That probably depends on how much you overcook the burrito.
        
         | rhet0rica wrote:
         | I love not knowing whether the "pdf" in the title (and URL)
         | refers to a probability density function or the portable
         | document format.
         | 
         | ...The answer will surprise you!
        
       | adamnemecek wrote:
       | The Kalman Filter is an instance of the Generalized Distributive
       | Law https://en.wikipedia.org/wiki/Generalized_distributive_law
       | 
       | So is the Fast Fourier transform, Viterbi algorithm, dynamic
       | programming, message passing and a trillion other things.
        
       | ckrapu wrote:
       | I've seen the Kalman filter presented from a few different angles
       | and the one that made the most sense to me was the one from a
       | Bayesian methods class that speaks only in terms of marginal and
       | conditional Gaussian distributions and discards a long of the
       | control theory terminology.
       | 
       | This was one of the books we used:
       | https://link.springer.com/chapter/10.1007/978-1-4757-9365-9_...
        
         | jbullock35 wrote:
         | I succeeded in understanding the Kalman filter only when I
         | found a text that took a similar approach. It was this
         | invaluable article, which presents the Kalman filter from a
         | Bayesian perspective:
         | 
         | Meinhold, Richard J., and Nozer D. Singpurwalla. 1983.
         | "Understanding the Kalman Filter." American Statistician 37
         | (May): 123-27.
        
       | chubs wrote:
       | As a developer I always found these maths-first approaches to
       | Kalman filters impenetrable (I guess that betrays my lack of
       | knowledge, I dare cast no aspersions on the quality of these
       | explanations!). However, if like me, it helps with the learning
       | curve to implement it first, here's a 1-dimensional version
       | simplified from my blog:                 function transpose(a) {
       | return a } // 1x1 matrix eg a single value.       function
       | invert(a) { return 1/a }            const qExternalNoiseVariance
       | = 0.1       const rMeasurementNoiseVariance = 0.1       const
       | fStateTransition = 1            let pStateError = 1       let
       | xCurrentState = rawDataArray[0]       for (const zMeasurement in
       | rawDataArray) {         const xPredicted = fStateTransition *
       | xCurrentState         const pPredicted = fStateTransition *
       | pStateError * transpose(fStateTransition) +
       | qExternalNoiseVariance         const kKalmanGain = pPredicted *
       | invert(pPredicted + rMeasurementNoiseVariance)
       | pStateError = pPredicted - kKalmanGain * pPredicted
       | xCurrentState = xPredicted + kKalmanGain * (zMeasurement -
       | xPredicted) // Output!       }
       | 
       | https://www.splinter.com.au/2023/12/14/the-kalman-filter-for...
        
       ___________________________________________________________________
       (page generated 2025-02-13 23:00 UTC)