Fix quaternions to roll, pitch, yaw angles #45
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
series_quat2euler
function computes wrong roll and pitch angles. This has been fixed by replacing thetransforms3d.taitbryan.quat2euler
function with the more generaltransforms3d.euler.quat2euler
function called withaxes='sxyz'
option (1-2-3 extrinsic convention).Note that the
transforms3d.taitbryan.quat2euler
function is equivalent to thetransforms3d.euler.quat2euler
function called withaxes='szyx'
option (3-2-1 extrinsic convention), which is not the used convention in PX4 (3-2-1 intrinsic convention).Finally, an extrinsic convention (fixed ground axes) is equivalent to an intrinsic convention (moving body axes) but with rotations performed in reversed order (and vis versa), so that the proposed correction (1-2-3 extrinsic convention) is equivalent to the PX4 convention (3-2-1 intrinsic convention) without even the need to swap the order of outputs.
To validate this correction: do some pure roll motion, then some pure pitch, then perform a 90 degrees pure yaw rotation and finally, from that new yaw orientation, do again some pure roll and pure pitch motions. You will see that the roll and pitch angles before this correction are wrong, while they are correct after.