Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quaternions to roll, pitch, yaw angles #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FabienFellay
Copy link

The series_quat2euler function computes wrong roll and pitch angles. This has been fixed by replacing the transforms3d.taitbryan.quat2euler function with the more general transforms3d.euler.quat2euler function called with axes='sxyz' option (1-2-3 extrinsic convention).

Note that the transforms3d.taitbryan.quat2euler function is equivalent to the transforms3d.euler.quat2euler function called with axes='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.

The series_quat2euler function computes wrong roll and pitch angles. This has been fixed by replacing the transforms3d.taitbryan.quat2euler function with the transforms3d.euler.quat2euler function called with axes='sxyz' option (1-2-3 extrinsic convention).

Note that the transforms3d.taitbryan.quat2euler function is equivalent to the transforms3d.euler.quat2euler function called with axes='szyx' option (3-2-1 extrinsic convention), which is not the used convention in PX4 (3-2-1 intrinsic convention).

Finally, an extrinsic convention is equivalent to an intrinsic convention 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant