Jump to content

User:Snietfeld/TRIAD Algorithm

From Wikipedia, the free encyclopedia

The following is a brief description of the TRIAD algorithm and how it is used to generate a 3-axis attitude solution from vector observations. The TRIAD algorithm is a well-known method of attitude determination, and is actively used in the aerospace industry. In practice, the TRIAD algorithm is used to determine the orientation of satellites or other craft from a set of sensor observations. While historically the problem of attitude determination has been relegated almost exclusively to military or aerospace endeavors, it has recently found relevance to 3-D gaming systems such as the Nintendo Wii. The example presented here will demonstrate how the TRIAD algorithm can be used to determine the orientation of a device using sensors that are widely available.

Terminology

[edit]

Throughout this paper we will be using the terms “reference frame”, “reference vector” and “rotation matrix”. These have very specialized meanings in the context of attitude determination and deserve some explanation.

Reference Frame - A coordinate system defined by three orthogonal axes orientated in a particular direction and located at a specific point in space. More simply, a reference frame is a particular point and orientation from which observations can be made. An example of a commonly-used reference frame is the Earth-Centered, Earth-Fixed (ECEF) reference frame depicted below:

In the example presented in the following pages, we will demonstrate how the TRIAD algorithm can be used to convert a vector in an arbitrary device reference frame, D, to its equivalent in the less arbitrary (and thus more useful) ECEF reference frame, E. This is equivalent to finding an attitude solution for the device.

Reference Vector – A 3x1 vector which describes the direction of something measured in a given reference frame. Examples of commonly-used reference vectors include:

  • The magnetic field of the Earth, as measured by a magnetometer.
  • The acceleration of the Earth's gravity, as measured by an accelerometer.
  • The direction of the Sun, as measured by a camera, solar sensor, or array of solar panels.

It should be noted that the above sources for reference vectors vary widely in their accuracy, and the best combination (the TRIAD algorithm only requires two) is largely dependent on the conditions in which they are to be used. For example, a satellite in orbit around the earth would measure no acceleration from the Earth's gravity in its own frame, rendering an accelerometer useless for attitude determination. In this example, we will be using the magnetic field of the Earth and a gravity vector.

Rotation Matrix - A 3x3 matrix which can be used to convert an arbitrary vector from one frame into its equivalent in another. They exhibit the following property:

Where and are corresponding vectors in reference frames D and S, respectively, and is a rotation matrix that translates vectors from the reference frame D to reference frame S. Obtaining a rotation matrix from one frame to another is equivalent to obtaining an attitude solution and is the goal of the TRIAD algorithm.

The TRIAD Algorithm

[edit]

The TRIAD algorithm takes as its input two pairs of reference vectors. Each pair of reference vectors represents some measured direction in both reference frames. For example, the first pair of reference vectors might be the measured direction of the sun in both the device frame of reference and the ECEF reference frame.

We will be creating three rotation matrices. Using the reference vectors measured in the device frame, we will create a rotation matrix, , that rotates vectors from the device frame into the intermediate frame. We will then create a second rotation matrix, , that rotates vectors from the ECEF frame into the intermediate frame. Finally, we will use these two intermediate rotation matrices to create a third rotation matrix, , that converts vectors from the device frame directly into the ECEF frame.

The TRIAD algorithm itself is relatively straightforward and will be divided into three steps:

  1. Obtain the reference vectors.
  2. Create the intermediate reference frame.
  3. Solve for a full attitude solution.

Obtain the Reference Vectors

[edit]

Before we can begin, we must obtain two pairs of corresponding reference vectors. For each reference frame, we will use the measured magnetic field of the earth, , and the measured gravity vector, . For the device reference frame, these will be denoted and , respectively, with the corresponding ECEF equivalents denoted by and .


Create the Intermediate Reference Frame

[edit]

Once both pairs of reference vectors are obtained, we will use them to create an intermediate reference frame that is common to both the device and ECEF reference frames. We will use the reference vectors in each frame to create a rotation matrix into this intermediate frame, I. This intermediate reference frame will be created using the relative orientations of the reference vectors. Because these relative orientations are the same in every reference frame, the intermediate frame will be the same regardless of which reference frame we create it from.

To define the intermediate frame, we must create three orthonormal axes (, , and ) from the reference vectors in both the device and ECEF frames:


NOTE: The choice of as was arbitrary here, but for reasons that are beyond the scope of this paper, the more accurate reference vector should always be chosen as .

We then combine these three basis vectors to create our intermediate rotation matrices:

Solving for a Full Attitude Solution

[edit]

We now have two rotation matrices, and , that rotate from each reference frame into the intermediate frame. To complete the algorithm and find a full attitude solution, we must define a sequence of rotations that takes us from the device frame to the intermediate frame and then finally to the ECEF frame. The first half of this sequence is accomplished by , but the second rotation matrix, , is the inverse of what we want.

To obtain , we can simply take the transpose:

Because the matrices and represent rotations, we can combine them in sequence by multiplying them together:

This final rotation matrix represents the full attitude solution. We can now freely convert vector observations made in the device frame to the standard ECEF frame and back again:



The TRIAD algorithm is a method of attitude determination that uses two pairs of corresponding vector observations to find a rotation matrix between two reference frames. For each frame, a rotation matrix to a common intermediate frame is created using the relative orientations of the reference vectors in that frame. Once these intermediate rotation matrices are found, they can be combined to create a single rotation matrix between the original two reference frames. The TRIAD algorithm is one of the simplest forms of attitude determination and is still in heavy use today.