TauLabs/TauLabs — pull request #632 by kubark42 (2013-06-12 11:18:44+00:00)
Title: Correct rotation and add yaw orientation calibration

For some reason, we were not using Tait-Bryan rotations from Inertial-->Body-->Board, but instead were using them Inertial-->Body<---Board. This PR corrects this (very easy, it only requires inverting all the rotations, but we need to take care I got them all, and didn't include any ones I shouldn't have). Mathematically this doesn't change anything as the rotation matrix still stays the same, but because we're now computing it as Rot(roll)*Rot(pitch)*Rot(yaw) instead of Rot(yaw)*Rot(pitch)*Rot(roll) the Euler angles values themselves change. For most people the change won't be noticeable, only people who mount the board in unusual positions (such as on its side in an airplane) will see more than a few 10ths of degrees of difference.

With the rotation order changed, the math becomes a little simpler to solve for yaw orientation. This is a nice feature for airplanes in which the board is mounted in vertical positions. The user is requested to pitch the vehicle forward with a minimum of roll and then press start.

![screen shot 2013-06-12 at 12 59 35 pm](https://f.cloud.github.com/assets/1118185/642153/35939e46-d34f-11e2-9b85-00c24445691a.png)

This has been tested in normal and unusual attitudes on FlyingF3. It needs to be tested on CopterControl.