Skip to content

General conversion from quaternion to Euler angles #16

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

Open
evbernardes opened this issue Oct 20, 2023 · 0 comments
Open

General conversion from quaternion to Euler angles #16

evbernardes opened this issue Oct 20, 2023 · 0 comments

Comments

@evbernardes
Copy link

Hello there eRCaGuy, coming here from Wikipedia! Probably easier that way.

If you're interested, in this repo of mine you can find the first implementation I had done for the general conversion issue, meaning it works for all possible 12 axes sequences, symmetric or asymmetric (ZYZ, ZYX, etc) but also intrinsic or extrinsic: https://github.com/evbernardes/quaternion_to_euler

This algorithm was further improved and implemented on Scipy, replacing the original one.

To clarify a bit on the arctan2 or acos thing, there are two advantages: First, if you only use arctan2, it's possible to have equations that give you correct angles even when the quaternion is not properly normalized, meaning that, for some non-zero number A, both quat2euler(q) and quat2euler(A * q) will return the same angle. This is reason number 1 why this is safer numerically!

Reason number 2, that I discovered while doing the PR to Scipy, is that acos and asin implementations are also not super well behaved at the limits of their regions of definition, while arctan2 does not have that problem. This was hinted by the Scipy guy who helped me improve it before accepting it, and I was also possible to show that using arctan2 even let up to lower numerical errors! Which is one of the reasons my algorithm was accepted, since the former one also relied on a call to acos.

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

No branches or pull requests

1 participant