To allow the controllers to calculate the torque necessary to
track the desired attitude, a set of error metrics are defined that
quantify the magnitude and direction of the attitude and angular
velocity errors.
The attitude error is represented by a quaternion describing a
rotation from the estimated reference frame to the desired reference
frame, expressed in the vehicle reference frame coordinates. This
error metric _{ }
is calculated using the quaternion difference equation

_{}, 
(4.34) 
where _{ }is
the skew symmetric matrix defined in (4.11). The vector _{
}
points along the Eigen axis of rotation between the desired and
estimated reference frames with magnitude _{ }
where _{ }
is the magnitude of the angular error. The fact that _{ }
represents the most direct rotation to the desired attitude is one of
the reasons why the quaternion is desirable as a feedback error
metric. Note that _{ },
hence the goal of the controller is to drive _{ }
to zero.
The angular velocity error is represented by a vector describing the
velocity to be lost in order for the estimated velocity to match the
desired velocity, expressed in the current vehicle reference frame
coordinates. This error metric _{ }
is created by subtracting the desired and estimated angular
velocities,

_{}, 
(4.35) 
where _{ }
is the desired angular velocity expressed in the desired reference
frame, and _{ }
is the direction cosine matrix as a function of the quaternion as
defined in (4.16). Again, _{ }
and _{ },
so the goal of the controller is also to drive _{ }
to zero for tracking nonconstant _{ }.
Note that with these definitions of attitude and rate errors, the
kinematics of the error quaternion are identical to (4.9), i.e.
This fact is instrumental in the design of the tracking controllers
below.