- Home: Kalman filtering (for drones).
- Lesson 0: Modelling the system (noisy variables).
- Lesson 0.5: Modelling the system (dynamics).
- Lesson 1: Discrete Kalman filter.
toThe most important step in a Kalman filter is to model your system. No matter how fancy your NewAwesome Kalman filter is, it will not do miracles if you do not use the appropriate model for your actual system. One of the secrets for a good performance of the filter is to have a solid and realistic model. Note that I have not said complex, some people confuse realistic with complexity by adding infinite series of parameters and terms. To model a system consists of two steps. Firstly, we describe in a mathematical way the states of interest. Secondly, we determine how these states evolve over time, i.e. their dynamics. In this lesson we are going to focus on the first step.
During this lesson we will consider a typical Inertial Measurement Unit (IMU) as a system. In particular, we will see how to model it in order to calibrate its accelerometers. For example, we describe the states of our system by a vector consisting of the IMU’s position, IMU’s velocity and the bias of the IMU’s accelerometer
We will only focus our attention on one of the three axes XYZ, e.g. the ‘x-axis’, since the following reasoning is identical for the three of them by symmetry arguments. Therefore we have that and . The main objective in this example is to model the system such that it allows us to calibrate the bias of the acceleromers in an autonomous way by employing the Kalman filter.
In order to be realistic, we will consider that our state variables are stochastic, i.e. they are random but some values are more likely to happen than others. In fact, we will assign a probability to each value of and (for the sake of clarity we drop the subindex ) in the set of the real numbers. One of the most popular models for assigning such probabilities is the called normal or Gaussian distribution, namely
where is the most probable value where the position is about (also called the mean), and determines how distributed is the probability about the mean (also called the standard deviation). Therefore, the best guess for a variable described with (3) is to give both, the mean and its standard deviation . It does not make sense to say the position is at 3m, but to say, the position is around 3m 0.5m with a confidence of .
We also call the probability density function. What does it mean? since we have a noisy system, what is the probability of having the IMU at the exact position ? the answer is exactly zero. We have uncertainty in our system, so it is not possible to give a perfect accurate guess for the position of the IMU. This is how mathematically we write the probability of finding the IMU between the positions and
therefore the probability of finding precisely the IMU between and is zero. Note that with (3) the probability of finding your IMU between Alpha Centauri and the Sun is not precisely , but very close to :P. By employing (3), the probability is if and only if and . Maybe this sounds weird, but we should remind that this is just a model and function (3) is not the only way of how to describe a random variable.
It is very convenient to deal with Gaussian state variables. For example, the multiplication of two Gaussian distributions and as in (3) gives us again another Gaussian distribution, namely
where and .
This is the key property for the low computational cost of the Kalman filter with Gaussian variables. For example, if says: the probability of finding the IMU between m and m is and says: the probability of finding the IMU between m and m is , what is the probability of having both and right? . Here, if you have not noticed it, we have introduced a notion of sensor fusion, this is what we have done in (5). This is the meaning of and , we have fused the information from and , e.g. from two different GPS. Computationally and mathematically speaking, it is very easy to fuse Gaussian information from different sources! In general for other kind of distributions different from (3), this is not the case!
How to model the IMU’s accelerometer?
We already have enough material for modeling our accelerometer. We consider that the readings from the accelerometer can be modeled as a Gaussian variable
where are the reading value and the actual value of the acceleration respectively, and has as the bias, since it determines how much shifted is from zero and determines how noisy is the sensor, since it determines the shape of . Note that if the IMU is at rest on the table, then but in general. The values for the standard deviation and the bias of the accelerometer can be found in the corresponding datasheet, usually at the last pages of the document. The bias and the standard deviation usually depends heavily on the temperature of the sensor.
Now that we know how to model our state variables, let us proceed to the next lesson, where we will show how to model the dynamics of the states and how to employ the Kalman filter by understanding the physics/maths behind.
- Next lesson: Modelling the system (dynamics).