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).


You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • Hey everyone. A few have asked me to post my MatLab SIMULINK DCM algorithm, so here it is:

    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


  • The only difference I can see is that one is using a global coordinate system, and one local.
  • T3
    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,
  • btw.. here is a higher resolution pic:
  • 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
This reply was deleted.


DIY Robocars via Twitter
RT @SmallpixelCar: Test my algorithm on real car https://t.co/idWRxcrmuK
2 hours ago
DIY Robocars via Twitter
RT @breadcentric: Evo is coming to town. If you have an #AWS #DeepRacer, you can purchase an extension pack! https://t.co/w60JwI98Hp #Machi…
8 hours ago
DIY Robocars via Twitter
DIY Drones via Twitter
RT @chr1sa: My talk on PX4 and FAA certification is coming up at 1:45 PST today on the PX4 Dev Summit livestream. Includes some cool new st…
Jul 7
DIY Drones via Twitter
RT @seesharp: I'm tuned into the PX4 / Dronecode free live conference. Great stuff. Microsoft AirSim talk in 10 minutes. https://t.co/0zbZ2…
Jul 6
DIY Robocars via Twitter
RT @masato_ka: 距離センサを3つとESP32を付けたラジコンカーをDonkeyCarライクにNNで自動走行。3層FC極小モデルをTensorFlow Lite for microcontrollerで動かしてる。機体は借り物でRumiCarって言います。Tenso…
Jul 5
DIY Robocars via Twitter
RT @SmallpixelCar: My car was able to go all the way autonomously until the crosswalk. It was only 100 yards from the target. What should b…
Jul 4
Liam left a comment on Agricultural UAVs
I'm Liam from T-MOTOR. I would like to reach out to see if there is any possibility for us to work together.
We are a propulsion system manufacturer who offers motors, propellers and ESCs for all kinds of drone applications which vary from secur…"
Jun 30
DIY Robocars via Twitter
RT @SmallpixelCar: Smart move. The car used the shadow to guide it through the bridge. This was never in the training samples. But it learn…
Jun 30
DIY Robocars via Twitter
RT @SmallpixelCar: Getting closer to the target. Single camera. Untrained road. https://t.co/Wsr7RwDamj
Jun 29
Richard Cox left a comment on Australia
"Anyone in the DIYDRONES Australian subgroup based in Alice Springs, NT?
I am experimenting with Ardupilot (standard Arduplane), Pixhawk 4 FC in a 4-ch
RC "AXN Floater Jet" foamy plane..."
Jun 29
Omar Sykes left a comment on Australia
"Hi everyone, I am looking for someone who is good at drone building, repair and software in Adelaide. Please give me a call on 0477 319 219."
Jun 29
DIY Robocars via Twitter
RT @RoboticMasters: #donkeycar https://t.co/czuLoVRcA4
Jun 29
DIY Robocars via Twitter
Jun 29
DIY Robocars via Twitter
RT @RoboticMasters: Donkey car, car car car car car car; Donkey car, car car car car car car; Donkey Car. Anyone like our tiny tiny donkey…
Jun 29
DIY Robocars via Twitter
RT @SmallpixelCar: After improving DBSCAN speed, I can get 11 frame per second on @NVIDIAEmbedded Jerson Xavier MAXN mode and the autonomou…
Jun 26