diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2015-02-25 17:48:55 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2015-02-25 17:50:16 +0100 |
commit | 59e623a2ebe28139dfed2a3df4a63f1999c50b1a (patch) | |
tree | a44ccafa60cd716aa5945f1fe387865f1017d152 /src/lib/mathlib/math | |
parent | 9a3ea6156903a9d4f9883088a0f55145240dc077 (diff) | |
download | px4-firmware-59e623a2ebe28139dfed2a3df4a63f1999c50b1a.tar.gz px4-firmware-59e623a2ebe28139dfed2a3df4a63f1999c50b1a.tar.bz2 px4-firmware-59e623a2ebe28139dfed2a3df4a63f1999c50b1a.zip |
quaternion from dcm: comment and reference
Diffstat (limited to 'src/lib/mathlib/math')
-rw-r--r-- | src/lib/mathlib/math/Quaternion.hpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/mathlib/math/Quaternion.hpp b/src/lib/mathlib/math/Quaternion.hpp index 6ea4cf557..38400beef 100644 --- a/src/lib/mathlib/math/Quaternion.hpp +++ b/src/lib/mathlib/math/Quaternion.hpp @@ -135,6 +135,10 @@ public: data[3] = static_cast<float>(cosPhi_2 * cosTheta_2 * sinPsi_2 - sinPhi_2 * sinTheta_2 * cosPsi_2); } + /** + * set quaternion to rotation by DCM + * Reference: Shoemake, Quaternions, http://www.cs.ucr.edu/~vbz/resources/quatut.pdf + */ void from_dcm(const Matrix<3, 3> &dcm) { float tr = dcm.data[0][0] + dcm.data[1][1] + dcm.data[2][2]; if (tr > 0.0f) { |