# Direct Cosine Matrix

Essay by 24 • July 13, 2010 • 11,176 Words (45 Pages) • 1,472 Views

**Page 1 of 45**

Direction Cosine Matrix IMU: Theory

William Premerlani and Paul Bizard This is the first of a pair of papers on the theory and implementation of a direction-cosine-matrix (DCM) based inertial measurement unit for application in model planes and helicopters. Actually, at this point, it is still a draft, there is still a lot more work to be done. Several reviewers, especially Louis LeGrand and UFO-man, have made good suggestions on additions and revisions that we should make and prepared some figures that we have not included yet. We will eventually incorporate their suggestions, but it may take a long time to get there. In the meantime, we think there is an audience who can benefit from what we have so far. The motivation for DCM was to take the next step in stabilization and control functions from an inherently stable aircraft with elevator and rudder control, to an aerobatic aircraft with ailerons and elevator. One of the authors (Premerlani) built a two axes board several years ago, and developed rudimentary firmware to provide stabilization and return-to-launch (RTL) functions for a Gentle Lady sailplane. The firmware worked well enough, and the author came to rely on the RTL feature, but it never seemed to work as well as the author would like. In particular, satisfactory solutions to the following two issues were never found: * Mixing. It was recognized that in a banked turn, there were two problems arising from the bank angle. First, the yaw rotation of the aircraft around the turn generated a nuisance signal in the pitch gyro, because of the banking. Second, in order to make a level turn, the elevator needed some "up" deflection. The amount of deflection depends on the bank angle, which could not be directly measured. Both issues were opposite sides of the same coin. Acceleration. An accelerometer measures gravity minus acceleration. The acceleration is equal to the total of all of the aerodynamic forces (lift, thrust, drag, etc.) on the plane, plus the gravity force, divided by the mass. Therefore, the accelerometer measures the negative of the total of all of the aerodynamic forces. The measurement of gravity is what is needed to level the plane but that is not what you get out of an accelerometer during accelerated motion. Acceleration is a confounding variable. In particular, when the aircraft pitches up or down, for a short while it accelerates in such a way that the output of an accelerometer does not change. There is a similar effect that the NASA astronauts experience when they are in training planes. A ballistic path can produce zero net forces and therefore fool accelerometers temporarily. The combination of this issue and the previous one prevented really tight

*

DCM

1

Draft: 5/17/2009

pitch control, and this issue prevented the use of pitch stabilization during a hand launch. It was realized that part of the problem was not having a six degree of freedom inertial measurement unit (IMU), so it was decided to design a new board. The UAV DevBoard from SparkFun was the result. Coincidentally, one of us (Premerlani) decided he wanted to step up to an aircraft with ailerons, and found that he just did not have the needed flying skills. He crashed 5 times in one summer, and had to completely replace his plane 3 times. So, he decided to use his new board for stabilization, shown below, attached to his Goldberg Endurance with Velcro.

The question was, how best to do that? Working together, we came to the same conclusion of Mahoney [1]. What is needed is a method that "fully respects the nonlinearity of the rotation group." Paul and I decided that we should represent the rotation with a direction cosine matrix, that we could maintain the elements of the matrix using gyro, accelerometer, and GPS information, and that we could use the matrix for control and navigation. At a high level, here is how DCM works: 1. The gyros are used as the primary source of orientation information. We integrate the nonlinear differential kinematic equation that relates the time rate of change in the orientation of the aircraft to its rotation rate, and its present orientation. This is done at a high rate, (40 to 50 Hz) often enough to give the servos fresh information for each and every PWM pulse that is sent to the servos. DCM 2 Draft: 5/17/2009

2. Recognizing that numerical errors in the integration will gradually violate the orthogonality constraints that the DCM must satisfy, we make regular, small adjustments to the elements of the matrix to satisfy the constraints. 3. Recognizing that numerical errors, gyro drift, and gyro offset will gradually accumulate errors in the DCM elements, we use reference vectors to detect the errors, and a proportional plus integral (PI) negative feedback controller between the detected errors and the gyro inputs used in step 1, to dissipate the errors faster than they can build up. GPS is used to detect yaw error, accelerometers are used to detect pitch and roll. The process is shown schematically in Figure 1.

[XYZGyros] Gyros DriftAdjustment

W

Rmatrix

[RMatrix] Orientation

Kinematics &Normalization

Rmatrix Adjustment Error Error Yaw Pitch Roll

[GPS] Course [Accelerometers] Gravity

PI Controller

Drift Detection

Figure 1 Block diagram of DCM No doubt you are wondering what a rotation group is, and why it should be respected. You also might be wondering how you can use DCM for control and navigation. You also might have the same questions that UFO-MAN asked on the subject after he read Mahoney's paper, so we will start with those questions: * * * * * * * What is a quaternion and why do we use that instead of vector notation? What is meant by a rotation group? What is a rotation matrix? What does it mean to maintain orthogonality of the rotation matrix? What is an anti symmetric matrix? Can you briefly explain kinematics in this rotation matrix context? Can you briefly explain dynamics in this rotation matrix context?

DCM

3

Draft: 5/17/2009

All of this is concerned with rotations. Physically, what we are trying to do is represent the orientation of our aircraft with respect

...

...

(2010, 07). Direct Cosine Matrix. *Essays24.com*. Retrieved 07, 2010, from https://www.essays24.com/essay/Direct-Cosine-Matrix/71.html

"Direct Cosine Matrix" __Essays24.com__. 07 2010. 2010. 07 2010 <https://www.essays24.com/essay/Direct-Cosine-Matrix/71.html>.

"Direct Cosine Matrix." *Essays24.com*. Essays24.com, 07 2010. Web. 07 2010. <https://www.essays24.com/essay/Direct-Cosine-Matrix/71.html>.

"Direct Cosine Matrix." Essays24.com. 07, 2010. Accessed 07, 2010. https://www.essays24.com/essay/Direct-Cosine-Matrix/71.html.