Kalman Filtering

The main goal of the sensor fusion is to provide angles (relative to the earth frame) for controlling the quadcopter flight behavioral. There are a lot of fusion algorithms available on the internet. The most interesting one is the kalman filter, since the predictions are more precise compared to the complementary filter.

Figure 1: 

The kalman filter isn't very hard to understand for single signal estimation but more complex when matrix transformations are included. The following website provides an example: http://bilgin.esme.org/BitsBytes/KalmanFilterforDummies.aspx. As the signals processed by the 3d sensor depend on each other, basic knowledge of vector and quaternion transformation is required to design and understand a kalman filter for orientation estimation.

Depending on the application of the filter the sensor values of the accelerometer and the magnetometer might be fused together before used with the kalman filter. This includes all applications where the heading relative to the magnetic field is relevant. If one is only interested in the roll and pitch axis of the sensor position, its easier and cheaper to use a sensor without a magnetometer.

We have tested three different kalman filters for our quadcopter applications. As it turned out only the simplest filter worked very well, due too the electromagnetic field induced by the motor PWM signals. If your going to use a magnetometer you have to be careful with calibration. You have to make sure that the sensor position on your device does not change, since every ferroelectric material might distort the minimum and maximum values of the axis when moved relative to the sensor.

The filter presented in the IEEE Paper “An Extended Kalamn for Quaternion-Based Orientation Estimation Using MARG Sensors”: http://microsat.sm.bmstu.ru/e-library/Algorithms/AttDetermination/kalman... works like a charm, if the values of the magnetometer are precise enough and not distorted. Since the values of our magnetometer were very unstable, due too the ferroelectric materials on our quadcopter, we tried another kalman filter.

An existing kalman filter under GPL license can be found on following homepage: https://code.google.com/p/imumargalgorithm30042010sohm/. The filter is developed by Sebastian Madgwick as part of his Ph.D research at the University of Bristol. In comparison to the IEEE filter, a magnetic drift compensation is included. However we ran in the problem, that the high motor speeds also influenced the values of the magnetometer values. So we decided to use a kalman filter without yaw orientation.

Now we use the kalman filter developed by Kristian Lauszus found on following git homepage: https://github.com/TKJElectronics/KalmanFilter. The filter only calculates roll and pitch due too the lack of the magnetometer values, but is more precise.