# IMU alignment code progress

Brian is busy making it talk to the Arduino board. Meanwhile, I have been working on the alignment code. The alignment proccess uses the IMU's sensors to determine its orientation (roll, pitch, and heading) while stationary. I spent the last few days writing code based upon this document. Sorry, it's not free. Based upon the equations given in the paper, I wrote a Kalman filter that iteratively converges to the true orientation while the IMU is stationary. I wrote the Kalman code in Matlab and created a Simulink model to provide the sensor inputs. But that is as far as I got. Apparently, the student version of Simulink has a limit of 300 blocks.

So I spent all that time and was so excited to see this thing run, and I got nothing. I wanted to pitch my laptop off the balcony.

So now I need to do a bunch of work to turn complicated sets of Simulink blocks into a single Matlab block just to get the number of blocks below 300. I have also asked for a quote to upgrade to a new version of Matlab/Simulink, but I already know that is out of my budget.

I hope to upload some simulation results as soon as I get the code running.

Tom

Views: 811

Comment by Pat on April 13, 2009 at 10:50am
Tom,
If you already wrote the Kalman filter in Matlab, you could implement it in Simulink in an S-function block. You should be able to do the whole thing with very few blocks if you do most of the work in the S-function. You could also write it in C for the S-function, which should hopefully make it more portable for the Arduino.
Pat
Comment by Tom Yochum on April 13, 2009 at 12:23pm
Pat,

Thanks for the reply. I did write the Kalman as an S-block. The 300 blocks is coming from the 6-DOF, environmental data, etc that are all implemented as Simulink blocks. I'm going to have to convert some of those to S-functions, and I am not looking forward to that!
Comment by Pat on April 13, 2009 at 12:33pm
The good news is that the equations of motion and environmental data are really good candidates for S-functions, since one they are tested, you can treat them as block boxes that don't require all the flexibility you get with Simulink blocks. Good luck!

Comment

Join DIY Drones

1

2

3

4

5

6

7

8

9

10

## Groups

1036 members

47 members

234 members

1442 members

• ### ArduCopter User Group

3124 members

Season Two of the Trust Time Trial (T3) Contest
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here