Page **7** of **7**

### Re: QuadCopters

Posted: **Thu Dec 22, 2011 11:17 am**

by **RBBM**

Dear Moises,

concerning the covariance matrix: In my case the matrix Q is diagonal as the noise on the roll/pitch angle and the gyro data is independent from each other. The observation noise of our roll/pitch angles is also assumed to be linear with the integration time. So the overall parameters for the Kalman filter reduce to 3 values. We simply performed an educated guess to find starting values for the Kalman and applied these. Then we iteratively found values for a good filter performance by playing around.

In case you want to measure the errors you can mount the IMU onto some sort of testbench. Then you can apply known positions and record the measured values. Afterwards you can fit a gaussian function and gain the error width which you need for the matrices. This is very simple for the acc values but the gyros are much harder to measure.

This also leads to your last question. We calculate the roll/pitch angles from the three acc values and correct them with the according gyro data. this means we have one Kalman for roll and pitch. You can also add another for yaw, but we do not need this information for our current project.

Greetings,

Michael

### Re: QuadCopters

Posted: **Thu Dec 22, 2011 2:37 pm**

by **moisdc**

Dear Michael and colleagues,

Today, we have made some experiments. Currently, I am rebuilding reference signal (position/time) of our mobile robot.

I have 9 data, according to Spatial device. I have some question from your email:

1. Noise of our roll/pitch/yaw angles = 4º drift/minute/signal. Is this correct? So that, Q matrix is [[4 0 0][0 4 0][0 0 4]], isn't it?

2. What are the 3 overall values for the Kalman filter?

3. You are right: We have mounted the IMU onto some sort of testbench and we have a reference signal and 9 data (3/3/3) recorded. Gyros data weren't measured, just position/time. Michael, to be honest, I don't understand how to do this KF yet. Could you give me some idea?

Thank you for your generosity. Greetings:

- Moisés

### Re: QuadCopters

Posted: **Fri Dec 23, 2011 2:23 pm**

by **RBBM**

Dear Moises,

For me it seems that you are using one Kalman for all axes. We use one Kalman for each axis. As an example, we measure the roll angle via the acc data. So we get an angle that can also be measured by integrating the roll rate over the measuring time. Now you can apply the predict and update formulas from the Wikipedia link I gave you. This leads to a two-dimensional problem with a 2x2 Q matrix. This matrix is diagonal and keeps the estimated acc and gyro noise. The measure R is a measure for the roll error from the calculation and thus our third variable we have to find.

To get a grip on the subject you could search Tom Pycke's Website for his Kalman tester source ode.

Greetings

Michael

### Re: QuadCopters

Posted: **Sat Dec 24, 2011 5:13 am**

by **moisdc**

Ok Michael,

KF is clearer now, thanks for your explanation.

I'll tell you what I'm getting with Spatial 3/3/3

Merry Xmast for all phidget-addicts

- Moisés Díaz Cabrera

### Re: QuadCopters

Posted: **Thu Jan 05, 2012 12:53 pm**

by **danielaaroe**

Michael: Sorry if the code did not work. As I earlier wore, it was written to the arduino and for that purpose it works great. I might have altered the code afterwards, but I dont think so.

If you managed to get a KF working on the phidget, cant you post the code for it ?

Another question before i start recoding it for java; did you use the matrices and some sort of function to multiply them in the program, or do you multiply the matrices manually and code the finished equations ?

Moisès: Its quite difficult to get a hold of how the KF works, but reading around on Tom Pyckes blog and trying to find the proper matrix dimensions and code it really helps with the understanding. I'm not sure how experienced you are with matrix multiplications, but if you think its hard to wrap your head around what gets multiplied with what, I really reccomend you to try and multiply the matrices in

www.wolframalpha.com. There, it is very easy to see what gets multiplied with what(if you dont want to do it manually of course), but the biggest advantage is that it can multiply algebraic matrices, so you dont have to use actual numbers(you can use Q1, q2, q3 aso. for the covariance). There are probaly multiple programs that can do this, but this is easy accessible and easy to use.

Michael(again): it would be nice to see your progress in the shape of a new video

Best regards,

Daniel

### Re: QuadCopters

Posted: **Thu Jan 12, 2012 11:23 am**

by **RBBM**

Hi all,

As I told you I fiddled around with Tom Pyckes demonstrator code and transferred it to Java after trying to understand it. Then I wrote a little test programme to compare the outcomes with or without the filter.

The filter itself is an explicit implementation of the matrices given in the Wikipedia article. I do not use any functions or methods as everything is calculated manually and so we use the final results. They reduce to a few dedicated equations as the Observation matrix only contains one non-null element. The best would be to extract the code yourselves as I do not want to copy Mr Pyckes work.

Maybe we will release a small video to demonstrate the outcome soon.

Greetings

Michael

### Re: QuadCopters

Posted: **Thu Jan 12, 2012 11:35 am**

by **moisdc**

Hi colleagues,

Currently I have stopped to work with Kalman Filter. I have saturated and I decided to work with them later. However I am keen on understanding how to use KF with our Spatial 3/3/3 some day.

Thank you very much to everybody has helped me by this forum.

Best regards

- Moises

### Re: QuadCopters

Posted: **Thu Jun 28, 2012 1:20 pm**

by **RBBM**

Hi,

just to inform you, there is a small side project at

www.robobuam.de called "Hugo". It is basically a new vehicle based upon the Raspberry Pi. It can be steered via a Desktop application as well as a html5 Webapp.

Greetings

Michael

### Re: QuadCopters

Posted: **Mon Feb 18, 2013 2:21 pm**

by **danielaaroe**

Hi guys,

Since the kalman filter have been widely discussed in this thread, I want to share something i found today. Many people seems to be using the kalman filter to use intertial measurements for apps(in android and whatnot) so the infomation on the subject online have exploded.

Here is a open source kalman filter implemented in java. I have not yet had a thurough look at it, but anyways, a search for android kalman filter sure gives a loot of hits on google.

http://sourceforge.net/projects/jkalman/Have you had any progress on your quad RBBM ?

Anyone used the phidgetspatial precision for quad yet? does it have enough bandwidth for 50hz on five axis ?

Daniel