TRIAD Algorithm For Attitude Determination
The TRIAD or Tri-Axial Attitude Determination algorithm is used for attitude determination given two body-frame vectors ($b_1$ and $b_2$) and two corresponding inertial or “reference” frame vectors ($r_1$ and $r_2$). The attitude is determined as an “Attitude matrix”, $\mathbf{A}$, which is the DCM that rotates the vectors from the reference frame to the body frame.
The first vector is assumed to have more accurate measurement and so the algorithm is set up such that the estimate satisfies $\mathbf{A} r_1 = b_1$, exactly and $\mathbf{A} r_2 = b_2$ only approximately.
Algorithm
The TRIAD algorithm forms the orthogonal triads, {$v_1$, $v_2$, $v_3$} from $r_1$ and $r_2$ and {$w_1$, $w_2$, $w_3$} from $b_1$ and $b_2$, respectively.
The estimate of A is given by: $$ \mathbf{A} = w_1 v_1^\intercal + w_3 v_3^\intercal + w_2 v_2^\intercal $$