randybeard / mavsim_public

Repository for the textbook: Small Unmanned Aircraft: Theory and Practice, by Randy Beard and Tim McLain
GNU General Public License v3.0
425 stars 129 forks source link

uavbook quaternion conversion missing sign assignment #7

Open qtweng opened 5 months ago

qtweng commented 5 months ago

In appendex B.5 in the uavbook.pdf, it references a method of converting Rotation Matrices to Quaternions from: S. Sarabandi and F. Thomas, “Accurate computation of quaternions from rotation matrices,” in Advances in Robot Kinematics (J. Lenar- cic and V. Parenti-Castelli, eds.), pp. 39–46, Springer, 2019. However, it is missing details on inserting the signs for the quaternions as described in "Accurate Computation of Quaternions from Rotation Matrices" on page 5: "Due to the presence of square roots, the signs of qi, i = 1, . . . , 4 are undefined. As in other methods where these signs are undefined [2], if we assume that q1 is positive, then, according to (12), (13), and (14), we have to assign the signs of r32−r23, r13−r31, and r21−r12, to q2, q3, and q4, respectively."