Suppose you have a spaceship that wishes to land on a small landing pad. To achieve a precise landing, you need to know the exact position and velocity of the spacecraft at all times.
However, your sensors provide noisy measurements, and they don't update as frequently as you need.
This is where the Kalman filter becomes invaluable.
The Kalman Filter is the mathematically optimal way to fuse measurements and dynamic model to achieve precise knowledge of the system's state. Whether you want to monitor vital signs or guide an autonomous vehicle through city streets, the Kalman Filter provides the optimal solution.
In this tutorial, we'll explore these concepts using a simple pendulum as our example system.
Challenge: What real-world things could be tracked or monitored using a Kalman filter?
A simple pendulum is a fundamental physical system consisting of a mass attached to a lightweight rod. When the pendulum moves, it performs a periodic motion under the influence of gravity.
The pendulum serves as an excellent example of a dynamic system where we can apply Kalman filtering for tracking and prediction.
The motion of a simple pendulum is described by a second-order differential equation:
Where:
For small angles, we can approximate the equation to:
By defining the state vector \(x = \begin{bmatrix}\theta \\ \dot{\theta}\end{bmatrix}\), we convert the second‑order differential equation into two first‑order equations:
This system can then be written in matrix form as:
This matrix \(A_c\) is called the system matrix, and it represents how the state evolves over time according to our physical model. In the next section, we'll see how this model is used in the Kalman filter prediction step.
Adjust the various parameters and see how they affect the pendulum's motion:
To understand the Kalman Filter algorithm, we'll start by understanding the system state, or the "State Vector".
One can think of the State Vector as the current estimation of the true state.
In case of the pendulum, it can be described by a two-component vector:
At each point it time, we would want our state vector to reflect the reality as accurately as possible.
In the following sections, we will see that the Kalman Filter aims to make sure that the State Vector is as accurate as can be - By using a physical model and measurements.