From afab63ec2f8acaf68cecf54dd45bbbb175998ef0 Mon Sep 17 00:00:00 2001 From: Roger Labbe Date: Sun, 28 Aug 2016 12:23:33 -0700 Subject: [PATCH] Issue #103. Completed unfinished section. The first section of the README was incomplete. --- README.md | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8275364..73dfcfd 100644 --- a/README.md +++ b/README.md @@ -18,18 +18,29 @@ Start reading online now by clicking the binder badge below: What are Kalman and Bayesian Filters? ----- -We measure things in the world with sensors. For example, thermometers measure temperature, anemometers measure wind speed, scales measure weights. We measure distances with things like sonar, lasers, and calipers. +We measure things in the world with sensors. For example, thermometers measure temperature, anemometers measure wind speed, scales measure weights. We measure distances with sonar, lasers, and calipers. Unfortunately, no sensor is perfect. For example, a thermometer might only be accurate to within 2 degrees. A laser rangefinder might be accurate to a meter. A bathroom scale might be accurate to 1 kilogram, whereas a kitchen scale might be accurate to a gram or less. -Furthermore, a sensor might not present all of the information we would like. Suppose we want to know the map coordinates of a structure that we are surveying. A laser rangefinder tells us the distance to an object, but it does not tell us where in the world that object is. The measurement is *relative* to the position of the rangefinder. If the rangefinder does not provide an angle (bearing) to the measured object we can only state that the object lies somewhere within a donut shaped circle around the rangefinder. If we do know the location of the rangefinder and the angle then we can compute the coordinates of the structure. But how do we know the rangefinder's position? With sensors. How do we measure the angle? With sensors. And sensors are inaccurate, so both of those measurements have a degree of error in them. +Furthermore, a sensor might not present all of the information we would like. A laser rangefinder tells us the distance to an object, but it does not tell us where it is. The measurement is *relative* to the position of the rangefinder. If the rangefinder does not provide an angle (bearing) to the measured object we can only state that the object lies somewhere within a donut shaped circle around the rangefinder. If we do know the location of the rangefinder and the angle then we can compute the coordinates of the structure. But how do we know the rangefinder's position? With sensors. How do we measure the angle? With sensors. And sensors are inaccurate, so both of those measurements have a degree of error in them. + +Is there a way to reduce the amount of error in the measurements? We often have another important source of knowledge. Assume we are tracking an aircraft with radar and the aircraft is flying North at roughly 300 kph. The next measurement implies that the aircraft is flying South at 900 kph. We know aircraft cannot change directions and speed instantly, so we can conclude that this measurement is very inaccurate. On the other hand, if the measurement closely matches what we predict the aircraft is doing then we can conclude that the measurement is not noisy. + +We model the behavior of a system using a *process model*. The process model is also noisy. Aircraft are buffeted by winds, and the pilot can change the velocity of the aircraft. + +We are now confronted with a problem where both our measurements and process models are noisy. The problem may appear intractable. However, both are based on the behavior of a real, physical object. Bayesian filters models the noise of both probabilistically. We are measuring a physical object, so they must be *correlated* with the behavior of that object. We can use that knowledge to form better predictions of the object's behavior than if we just used the measurements. + +This book covers many common ways of performing that computation. The *Kalman filter* is the best known example of this type of filter. Rudolf Kálmán published a mathematically elegant solution to this problem in 1960 which used the assumption that all of the errors are Gaussian-distributed. + +I will explain what that means later. The important results are that the Kalman filter can be computed very efficiently with a computer, and that the output is mathematically optimal in a certain sense if the assumptions are true. Shortly after publishing his original paper Dr. Kálmán visited NASA Ames Research Center. Engineers at Ames were struggling with how to compute the trajectory of the Apollo mission, and Stanley F. Schmidt recognized the applicability of the Kalman filter to the problem. The Apollo navigation filter is the first known practical use of the Kalman filter. + +Kalman filters are now used everywhere. They are used for aircraft navigation, missile guidance, and robotics. A form called the *ensemble Kalman filter* is used in weather prediction. Wall street uses them in trading models. Drones use them in the flight computer. I've even received an email from somebody that uses them to track the milk production of cows! If your application uses sensors and accuracy is important to you, you need to understand Kalman filters. -Is there a way to reduce the amount of error in the measurements? You may have some ideas already. What if you were to take ten measurements and average them? For many kinds of sensor errors this does improve our estimate. You might imagine Motivation ----- -This is a book for programmers that have a need or interest in Kalman filtering. The motivation for this book came out of my desire for a gentle introduction to Kalman filtering. I'm a software engineer that spent almost two decades in the avionics field, and so I have always been 'bumping elbows' with the Kalman filter, but never implemented one myself. As I moved into solving tracking problems with computer vision the need became urgent. There are classic textbooks in the field, such as Grewal and Andrew's excellent *Kalman Filtering*. But sitting down and trying to read many of these books is a dismal experience if you do not have the required background. Typically the first few chapters fly through several years of undergraduate math, blithely referring you to textbooks on topics such as Itō calculus, and present an entire semester's worth of statistics in a few brief paragraphs. They are good texts for an upper undergraduate course, and an invaluable reference to researchers and professionals, but the going is truly difficult for the more casual reader. Symbology is introduced without explanation, different texts use different terms and variables for the same concept, and the books are almost devoid of examples or worked problems. I often found myself able to parse the words and comprehend the mathematics of a definition, but had no idea as to what real world phenomena they describe. "But what does that *mean?*" was my repeated thought. +The motivation for this book came out of my desire for a gentle introduction to Kalman filtering. I'm a software engineer that spent almost two decades in the avionics field, and so I have always been 'bumping elbows' with the Kalman filter, but never implemented one myself. As I moved into solving tracking problems with computer vision the need became urgent. There are classic textbooks in the field, such as Grewal and Andrew's excellent *Kalman Filtering*. But sitting down and trying to read many of these books is a dismal experience if you do not have the required background. Typically the first few chapters fly through several years of undergraduate math, blithely referring you to textbooks on topics such as Itō calculus, and present an entire semester's worth of statistics in a few brief paragraphs. They are good texts for an upper undergraduate course, and an invaluable reference to researchers and professionals, but the going is truly difficult for the more casual reader. Symbology is introduced without explanation, different texts use different terms and variables for the same concept, and the books are almost devoid of examples or worked problems. I often found myself able to parse the words and comprehend the mathematics of a definition, but had no idea as to what real world phenomena they describe. "But what does that *mean?*" was my repeated thought. However, as I began to finally understand the Kalman filter I realized the underlying concepts are quite straightforward. A few simple probability rules, some intuition about how we integrate disparate knowledge to explain events in our everyday life and the core concepts of the Kalman filter are accessible. Kalman filters have a reputation for difficulty, but shorn of much of the formal terminology the beauty of the subject and of their math became clear to me, and I fell in love with the topic.