I have recently been to a conference where there was a common tool for everyone, the Kalman filter. The point is that I was a bit shocked when I saw that many people there see some of its steps as black magic.

I decided to write a (yet another) detailed guide about the Kalman filter. In particular, I have tried to be rigorous enough with the math but trying at the same time to explain with plain words what is going on at every single step. Therefore, after reading it, it should be easy (hopefully) to others to understand and implement a Kalman filter in its simplest version, the Discrete Linear one.

An example about how to calibrate the accelerometers or gyroscopes of an IMU is considered as an illustration throughout the guide. In fact, I have written a small Python script and generated some animations in order to be more illustrative. The aim of the example, together with the guide, is to understand why in the following figure, the states of position, velocity and accelerometer's bias converge around the true values.

You can find the guide in the following link from my blog http://dobratech.com/courses/kalman-filtering-for-drones/

Views: 2126

Comment by Global Innovator on October 9, 2016 at 11:42am


physics is pre-IT science

and physics looks to be your homeland

"Unfortunately, there is not any physical measurement (coming from our physical world) free of uncertainty. There is not perfect sensor, this is inherent in Nature (quantum mechanics)"

Voltage, Current meters worked always fine for me, not generating noisy data.

RPM meter or sensor works fine, not generating any noise (alike my analog clock).

So reading hundreds of reports on drone crash, controlled by Kalman filter, I was almost sure, 3DR collapsed due to

Kalman filter's implementation since under new legislation on drone registration by FAA, you risk too much in legalities and compensation claims, manufacturing personal drones which crash every day.

Exactly, stochastic modelling is pre-IT science.At Academy of Economics, Faculty of Statistics, I was one of the first to implement real life data processing to get real data on business, economics, finance.

I predicted London Metals Exchange crash (steel market managed by Martin) since  trade in steel contracts and options was exactly based on stochastic models and recommandations published by LME were not correct.

Collapse of Societe General, Barings Bank, Lehmans Brothers, collapse of real estate markets 2008 are exactly the examples of implementation of stochastic modelling developed in pre-IT times.

RPM, Voltage, Current can be measured, calculated at some level of certainty, not generating noisy values affecting drone's attitude post-processing.

For Kalman filter to work properly we need to build IT, AI based fuzzy-logic, feedback, SelfEgo to never collapse or crash due to bugs in post-processing data coming from many sensors, Kalman filtered.


Kalman's algorithm is a filter, since some input data are rejected and some input data are accepted for attitude postprocessing.


Believe or not but I can sense which business or project is to collapse due to badly management.

Large german manufacturer of solar panels didn't love small buyers and collapsed within 3 years loosing orders

Another italian manufacturer of solar panels collapsed on wrong expectations of high profit generated, based on EU policy on climate change, FIT

Large german manufacturer of solar collectors collapsed implementing old-time flat solar collector technology, replaced by China manufactured heat pipes

So please forget physics, philosophy and pre-IT times quantum mechanics.

Modern personal drones must be clocked as smartphone.

Selecting a correct phone number you are connected to the right person, one-2-one matching.

Reading 100+  Internet reports on personal drone fly-away, crash always always made me sick, why nobody showed any interest or respect, responsibility to start to build, design crash- proof fly-away - proof personal drone one day.

Physics is great science, philosophy is great science either but integrating SelfEGO into intelligent personal drone is safe and meets FAA standards and protects operator against compensation claims as a result of third party property damages due to drone's crash ( fly-away included).

My analog or digital clock is not generating noisy data and my computer keyboard is not generating noisy data either.

So personal drone can be discrete controlled to perform exactly as a computer keyboard, entering the correct characters 100% of time its on.

Building stochastic process based model is not necessary or required if you have 100% control of the system all the time.

Comment by Tom Pittenger on October 9, 2016 at 10:35pm

>>nobody showed any interest or respect, responsibility to start to build, design crash- proof fly-away - proof personal drone one day.
I look forward to subscribing to your pull-requests!

Comment by Hector Garcia de Marina on October 10, 2016 at 12:26am

@Tom Pittenger

yep, all the commits so far have been written with a dark-hidden intention. To have your drone crashed when I am watching and laughing at you in the distance....

Comment by Andy Little on October 10, 2016 at 2:08am

@Hector. This is great. Sign me up for the course!. Kalman filter as applied to IMU is something I am very intererested in so great as an example.  You are right about wikipedia. For some reason wikipedia math articles are written in a way more to obfuscate than enlighten or so it seems to me. Anyway that doesn't apply to your Blog. Now just got to find some time to digest it!

Comment by Pascal P. on October 10, 2016 at 2:46am

Hum... Darius Jack is back !

This time he has foreseen many stock exchange cracks and a few bankruptcies.

And also find out how you guys are implied in conspiracy to crash honest people's drones with your perfidious Kalman filter. Shame on you.

Comment by OlliW on October 10, 2016 at 3:00am

maybe this argument makes the "filter" in the KF a bit more transparent: When the various matrices are constant with time, then the KF reduces to a complementary filter. For instance with an accelerometer and gyro, the output becomes the weighted combination of the low-pass-filtered accelerometer data and the high-pass-filtered gyro data. So, some filtering is indeed going on.


Comment by Hector Garcia de Marina on October 10, 2016 at 6:06am


Sure, feel free to post at the course whatever question or doubt in order to improve the guide.


Yep, CF and KF can be compared in the sense that both are fusing different sources about the same information. Right now I am not sure whether CF and KF are equivalent for some special cases...

Comment by David Boulanger on October 10, 2016 at 1:20pm

Ya.  I think Global Innovator is Darius Jack.  He's back on the fuzzy logic


Comment by David Boulanger on October 10, 2016 at 1:25pm

After reading it again I am very sure of it.


Comment by Hector Garcia de Marina on October 10, 2016 at 1:28pm

haha David, and you have not seen the other posts from him that I had to delete (first time ever I remove posts from smb)


You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service