# DCM Algorithm vs Direct Integration

Hi Everyone.
I am new to this forum... long time reader, first time poster. I hope to contribute to the community.

My question is regarding the DCM algorithm:
I have simulated Bill's DCM algorithm in MatLAB/Simulink, and it seems, that direct integration always meets or exceeds the DCM integration/multiplication. See results below:

It seems while simply integrating the said non-linear differentials, I find the results to be of better accuracy and MUCH LESS processing power!! So why even use the DCM orientation integration? What are the advantages?

Please note: In this simulation, I have intentionally not yet taken into account the PI drift correction (because, no matter what pre-algorithm you use, in the long run, post PI correction will always give you the correct orientation).

Thanks
-Hassan

Views: 3035

### Replies to This Discussion

Could you please describe in mathematical form, what "direct integration" means?

Consider the following gyro input:
90 times (dx:1 degree, dy:0, dz:0) (I mean it turns 90 degree on the x axis in 90 steps)
90 times (dx:0, dy:1,dz:0)
90 times (dx:-1, dy:0,dz:0)
90 times (dx:0,dy:-1,dz:0)
What is the final orientation? :-)

regards, Jozsef
Hi mmormota

What I mean by "direct integration", is just a discrete integral (also represented as SIGMA in mathematics).
So since, the gyro outputs in [deg/s], if you integrate the gyro, you will get [deg], aka the orientation.

(90-90,90-90,0) = (0,0,0) [deg]

:D
btw.. here is a higher resolution pic:
http://i26.tinypic.com/2h3dhs7.png
Hi Hassan,

Welcome aboard!!

If you push direct integration, you will eventually discover what the problem is with it.

At the heart of it, the problem with direct integration is that finite rotations are not commutative. That is just a fancy way of saying that the order of rotations is important. That is what Jozsef was saying.

For example, lets consider the combination of a 90 degree pitch upward, and a 90 degree roll to the right, as seen by the gyros, which are measuring the rotation rates in the plane frame of reference.

Suppose the pitch is first done first, followed by the roll. In that case, the plane will be pointing straight up.

Then, suppose that the roll is done first, followed by the pitch upward in the plane frame of reference. In that case, the plane will be pointing level, with one wing up, and one wing down.

Those are two entirely different situations.

The bottom line is that for finite rotations, the direct integration method gradually accumulates large errors in attitude estimation.

Best regards,
Bill
Hi Bill,
I see I see... very very interesting.

Thanks guys,
-Hassan
Hi Hassan,

If you do some research, you will find that direct integration does not work. It is a well known fact.

There is a test case that might help you see it. Perform the following rotations, starting with the plane flying north, wings level. Keep in mind that each rotation is described and measured in the frame of reference of the plane:

1. Do a quick yaw clockwise of 90 degrees.

2. Do a quick roll of 180 degrees.

3. Do a quick yaw clockwise of 90 degrees.

The actual result is that the plane will be flying north, upside down. This is what the DCM algorithm will compute.

However, direct integration will conclude that the plane is flying south.

Best regards,
Bill
Ok. (I was not sure and suspect a more fancy algorithm)

As Bill replied, that's just not correct.
Worth to make a small experiment with a box or something, no computer, no integration just turn it in your hands. Turn it according to the data, and check the final orientation. Absolutely not 0,0,0. :-)
You were right! It really shocked me (as I am an Electrical Engineer and not mechanical)
Check out my results here: http://www.youtube.com/watch?v=E7XVvv8XHgI

I am in the progress of redesigning my control algorithm for my quadrotor, and will surly be implementing this method. I will post the flow-charts/Simulink algorithm once its close to done.

Best Regards,
-Hassan
The only difference I can see is that one is using a global coordinate system, and one local.
Hey everyone. A few have asked me to post my MatLab SIMULINK DCM algorithm, so here it is:
http://hotfile.com/dl/68887555/5c0b5a7/DCM_Integration.mdl

This was created in Matlab r2009b.
I will plan to do more indept post for you guy within a few months, so in the meantime if you have any questions post back here.

Best Regards
Attachments:

Hey , do you still have this file?

It sounds very useful to have a Matlab implementation with graphical output.

and Paul's "Matlab/Simulink/AVL simulator" forum discussion

1

2

3

4

5

6

7

8

## Groups

45 members

1472 members

282 members

470 members

• ### 3D Models

57 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