robust estimator of the direction cosine matrix

If you downloaded MatrixNav from this page before 4/29/2009, you should be aware that there is a newer version of the firmware, MatrixNavRv2, that reduces the GPS latency, and will perform much better than the first version.I have been working with Paul Bizard on something we call the "Premerlani-Bizard robust direction cosine matrix estimator". It is based on the work of Mahony et al. The idea is to continuously update the 3X3 matrix that defines the relative orientation of the plane and ground reference frames, using GPS and 3 gyros and accelerometers. The basic idea is to use gyro information as the primary link between the two reference frames, and to use GPS and accelerometer information to compensate for gyro drift. We are working on the theory together. Paul is performing simulations. I am testing ideas in my UAV DevBoard. We have made a great deal of progress. There are demos available, and control and navigation firmware is available. The steps of the algorithm are:1. Use the gyro information to integrate the nonlinear differential equations for the time rate of change of the direction cosines.2. Renormalize the matrix to guarantee the orthogonality conditions for a direction cosine matrix.3. Use speed and gyro information to adjust accelerometer information for centrifugal effects.4. Use accelerometer information to cancel roll-pitch drift.5. Use GPS information to cancel yaw drift.By the way, the algorithm should work in any GPS, gyro, accelerometer nav system on a plane. Without magnetometer information, it will not work on a helicopter.This discussion will provide progress reports from time to time. At this point we have completed all steps. Firmware and documentation for various demos and flight firmware are available on the UAV DevBoard main page.Firmware and documentation of a roll-pitch-yaw demo program are available. There is also a first draft of an explanation of the algorithm.If you have a UAV DevBoard, I highly recommend that you try the demo program, it is very easy to use, and runs without a GPS. During its development, I found that the gyro drift was much less than I thought it would be. After I added the drift compensation, the resulting roll-pitch peformance is nothing less than astounding.Flight testing of "MatrixNav" is also complete. Firmware and documentation are available on the UAV DevBoard main page for stabilization and return-to-launch functions for inherently stable aircraft that are controlled by elevator and rudder. MatrixNav is implemented with a direction cosine matrix, and supercedes GentleNav. Anyone who has GentleNav should replace it with MatrixNav. Pitch stabilization is excellent under all conditions. Return to launch performance is excellent under calm conditions, and good under windy conditions. If you have the UAV DevBoard and an inherently stable plane, you will definitely want to try out MatrixNav.Finally, AileronAssist, for the stabilization and RTL aircraft that have ailerons, is available.What Paul and I are going to tackle next is altitude control.Bill Premerlani

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

Join diydrones

Email me when people reply –


        • new diagram


        • new draft

      • Dear

        Thanks very much for your elaborate answer.

        I can understand it now.


    • Additions:

      for example. the x-axis has the whole Centrigual acceleration(Vector C). the Gravity works in z-axis (Vector G)

      under this condition. the Accelerometer will output the result  Vetor  A = C + G

      so if we want to get the G, we need A-C,but the Eqn.26 shows G= A+C

      may I know the reason?

      • sorry for the stupid question .

        I have known it . 

        the sign is negative if exchange the cross product of them

  • Dear  Bill


    the bottom row of the direction cosine matrix should be aligned with the vector produced by the accelerometers

    May I know the reason why these two vectors should be aligned ?under what condition?

    because,from the earth frame. the plane also can own an acceleration other than the Z-axis(earch reference). it is a normal case i think.

    so i am confused why we know it is a gyro drift when there two vectors are not aligned

    maybe gyro has no drift ,and currently the plane is accelerating in some direction .therefore 

    the accelerateometer's output is also not aligned to earth Z-axis


  • Dear Bill 

    I'm reading your perfect paper(DcmDraft2)

    please let me ask a problem if I may.

    in the paper, we got "a convenient matrix form" in Eqn 17

    we know the new "DCM“ is not a definite  DCM for its magnitude is not 1 ,and each vector member is not orthogonality.so the next step is "Renormalization"

    In my understand ,although we get a new definite DCM after renormalization,but it is still an approximate one  to the  true accurate dcm. anyway this renormalized DCM is acceptable in such a little time slice(eg: 0.02s)

    However, I wonder  that there will be an apparent error(or deviation) after a long time 's calculation.

    (we assume that the gyro output is very accurate)

    I mean every renormalization process will create deviation,and these deviation will accumulate into a "big" DCM error.

    Is it possible? 

    sorry for my poor english.


  • Hi Bill

    I have been trying to write a matlab code using the dcm imu theory. i had one question though. Is yaw angle and heading of the aircraft same? As in isnt it possible for and aircraft to point in one direction and have an overall heading in another... if so is there anyway to find the heading from the pitch, roll and yaw?



  • Hi,

    In the DCM, the accelerometers used for the pitch-roll compensator, and the GPS used for the roll compensator. Does anyone know why the GPS did not use for the pitch-roll compensator?

    Best regards,


  • I’m confused with the effectiveness and accuracy of the proposed direction cosine matrix method.

    Without doubt, if the UAV is not aclinic(level), the forward acceleration is measured by accelerometer, together with the gravity component. Unless the UAV is stationary, The horizontal attitude angle determined by the output of accelerometer is not believable. Of course, the azimuth angle obtained by GPS is also not believable. You known, the frequency of GPS signal is low, the azimuth will be vibrated, and the accuracy is too low to use.

    I guess the core of this method is using the attitude reference to compute the gyro errors. So, I think it is better to equip a magnetometer.

    The IMU computed attitude is limited by IMU errors(Gyro errors bias and Accelerometer bias errors). During motion, these errors can be estimated and compensated by EKF. I’d like to know the accuracy of the proposed method with attitude reference obtained by GPS and accelerometer. Of course, the accuracy equipped a magnetometer.

This reply was deleted.