TauLabs/TauLabs — pull request #465 by peabody124 (2013-04-21 18:31:58+00:00)
Title: Stabilization: make sure yaw attitude always takes shortest path

There was a subtle bug in the wraparound logic for yaw control. Both
desired and actual are specified from -180 to 180. In the case of
desired being say -100 and actual being 100 then the error would be
-200. After adding 180 it would be -20. Normally modulus is defined
as being the possitive remainder, but fmodf preserves the sign of the
input so in this case instead of producing 340 it produces -20.

To correct this we just add another 360 before the modulus (which will
be removed). This ensures all combinations of actual and desired will
result in the appropriate sign.

Fixes #464

Also remove an unused macro with the same error. If this is merged I'll cherry-pick the yaw fix to next and master.