Jump to content

Talk:Conversion between quaternions and Euler angles

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by ERCaGuy (talk | contribs) at 03:55, 12 October 2023 (Changed the quaternion to Euler angles conversion formula). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
WikiProject iconMathematics Start‑class Low‑priority
WikiProject iconThis article is within the scope of WikiProject Mathematics, a collaborative effort to improve the coverage of mathematics on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
StartThis article has been rated as Start-class on Wikipedia's content assessment scale.
LowThis article has been rated as Low-priority on the project's priority scale.

Needs to be explicit that this rotates a body

I was looking for the euler 123 to quaternion conversion that will rotate from one frame to another. The euler to quaternion conversion shown on the page does not line up with the SpinCalc euler 123 conversion from Matlab Central. Maybe the equation on the page rotates the points in a body while keeping the reference frame the same?

From SpinCalc.m with scalar at 4th position

Q=[s1.*c2.*c3+c1.*s2.*s3,   c1.*s2.*c3-s1.*c2.*s3,   c1.*c2.*s3+s1.*s2.*c3,   c1.*c2.*c3-s1.*s2.*s3];  —Preceding unsigned comment added by 128.157.160.13 (talk) 22:42, 3 September 2009 (UTC)[reply] 


Are the "Euler angles" in this article really Tait-Bryan_angles?

Canonical form of quaternion?

The equation presented for conversion from Euler angles to Quaternion has several discontinuities that are not necessarily present in the Quaternions themselves.

For instance, for the Euler angles (0,0,-180) and (0,0,180), the conversion would produce the quaternions (0,0,0,1) and (0,0,0,-1). These refer to the same attitude, but linear interpolation or slerp between them would not work well.

It appears that the proper way to handle this is to compute the cosine of the angle between the quaternions (via the dot product) and if this is less than zero to negate one of the quaternions.

Which definition of the Euler angles is being employed in this page?

Absolutely no mention is given as to which (of the 12 possible) definitions of the Euler angles are being employed in this discussion.

Order of angles specified?

Does the order of rotation (described as "in the order yaw, pitch, roll" in first section) match the matrix given in "Rotation matrices" section? That matrix corresponding to rotation with Euler angles can be given by (Rz (Ry Rx)). Isn't that in the order x,y,z instead? — Preceding unsigned comment added by 144.212.114.62 (talk) 22:25, 2 December 2006 (UTC)[reply]

Matrix convention

It should be stated what the convention being used for the rotation matrices is. Is it supposed to be pre-multiplied by a row vector or post-multiplied by a column vector? Icalanise (talk) 23:18, 21 October 2008 (UTC)[reply]

someone seems to be confused. "The orthogonal matrix (post-multiplying a column vector) corresponding to a clockwise/left-handed rotation by the unit quaternion q=q_0+iq_1+jq_2+kq_3 is given by the inhomogeneous expression"
If you are using a column vector then the matrix is on the left of the vector and that would appear to be pre-multiplying, not post-multiplying.Eregli bob (talk) 12:17, 28 October 2012 (UTC)[reply]

Euler Conversion

Is the displayed formula correct? The link in the singularity section (http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/) displays a different formula ... —Preceding unsigned comment added by 83.171.153.247 (talk) 18:07, 1 March 2009 (UTC)[reply]

Could this be because the article uses a left-handed rotation (as specified on the paragraph giving the matrix for x-y-z convention rotation) ? I'mt not sure, but I think there are a LOT of different ways to convert quaternions to euler angles. See http://www.cgafaq.info/wiki/Euler_angles_from_matrix for example.
Basically, if someone knowledgeable enough could rewrite the part on conversion to discuss the various possibilities, that would be very nice. 81.63.104.6 (talk) 20:22, 8 May 2012 (UTC)[reply]

The final matrix in the "Rotation Matrices" section corresonds to "ZYX" ordering, as per page A-11 of the NASA memo in the references; I've verified that the expression for the quaternion conforms to the same convention. — Preceding unsigned comment added by 50.76.20.17 (talk) 22:12, 14 January 2014 (UTC)[reply]

The 'source code' for the quaternion-to-Euler angle conversion doesn’t match the vector representation immediately above it. SimonJWright (talk) 16:32, 6 December 2016 (UTC)[reply]

Error in Quaternion to Euler Angles Conversion

The Quaternion to Euler Angles Conversion when used with a Quaternion created with Euler Angles to Quaternion Conversion does not provide back the same Euler angles originally used for input. Take for example inputs for creating the quaternion of roll = 180, pitch = 90, yaw = 45, if you create a quaternion using the ToQuaternion() function and then use the result as input for ToEulerAngles() the result is roll = 180, pitch = 90, yaw = 26.565. This is likely due to multiple sets of Euler angles satisfying any quaternion, but the page should make that more clear. Drankinatty (talk) 04:27, 11 February 2020 (UTC)[reply]

The C++ code got the pitch computation wrong it should be:
double sinp = std::sqrt(1 + 2 * (q.w * q.y - q.x * q.z))
double cosp = std::sqrt(1 - 2 * (q.w * q.y - q.x * q.z))
Rather than:
double sinp = std::sqrt(1 + 2 * (q.w * q.x - q.y * q.z));
double cosp = std::sqrt(1 - 2 * (q.w * q.x - q.y * q.z)); Rfspadaro (talk) 18:20, 5 January 2023 (UTC)[reply]

Matrices and handedness

The matrices given are for left-handed systems, whereas the drawing uses a right-handed convention. There is no way a beginner in the field can make sense of what is explained. Sam Hocevar (talk) 11:21, 30 April 2012 (UTC)[reply]


== This should be updated because normally the diagrams are supporting the conversation and instead they are directly opposite of what the article is discussing. Would be better if this article was written in right handed notation since that is the most common and the pictures kept.

The reference does not exist anymore!

As above — Preceding unsigned comment added by 128.2.176.70 (talk) 16:16, 11 June 2013 (UTC)[reply]

If someone needs a quaternion-to-Euler method that actually seems to work,...

...then check this out.

http://bediyap.com/programming/convert-quaternion-to-euler-rotations/ [dead] --> https://web.archive.org/web/20210410215436/http://bediyap.com/programming/convert-quaternion-to-euler-rotations/

I haven't checked if it works, and I don't know the usage rights or licenses that apply to it (if any), but it accounts for multiple sets of Euler angles and it actually tells you which math goes with which set, so it's already better than this article by a mile. 108.3.188.161 (talk) 01:48, 22 July 2014 (UTC)[reply]

Sign of pitch angle

In the second figure, showing the Tait-Bryant angles for an aircraft, the upwards pitch is labelled in the figure as negative theta. This pitch angle would be positive, it is counter-clockwise if you were remotely located on the aircraft's Y axis sticking out of its right wing direction.Lathamibird (talk) 07:10, 2 June 2015 (UTC)[reply]

Euler Magic Squares

It says in the introduction Euler used quaternions for Magic squares. This seems unlikely as the math is completely unrelated. Can somebody figure out if there is some way this is true and maybe fix the link?

This page says it deals with JPL quaternions, and I think it's not quite right

At the beginning of the section Definition, it's written "For the rest of this article, the "passive" JPL quaternion convention shall be used." There are two problems with this:

1) I don't think this is right, both the rotation matrix and the quaternion product formulas seem to be consistent with Hamilton matrices instead.

2) The page Quaternions and spatial rotation makes very valid points on why Hamilton quaternions should be favored, so using only Hamilton quaternions here should be preferred. Ebernardes (talk) 14:31, 18 December 2022 (UTC)[reply]

Changed the quaternion to Euler angles conversion formula

This new one has no numerical problems for the pitch. For anyone interested, I'll leave here a simple Python snippet that test both expressions to show they are equivalent:

import numpy as np
from itertools import product

for w, x, y, z in product([-1, 0, 1], repeat=4):
    n = np.sqrt(w**2 + x**2 + y**2 + z**2)
    if n > 10e-7:
        w /= n
        x /= n
        y /= n
        z /= n

        sinp = np.sqrt(1 + 2 * (w * x - y * z));
        cosp = np.sqrt(1 - 2 * (w * x - y * z));
        pitch1 = 2 * np.arctan2(sinp, cosp) - np.pi / 2;

        pitch2 = np.arcsin(2 * (w * x - y * z))

        assert (pitch1 - pitch2) < 10e-7

Ebernardes (talk) 16:41, 18 December 2022 (UTC)[reply]

---

@Ebernardes:, I think you mean this revision you made, right?: https://en.wikipedia.org/w/index.php?title=Conversion_between_quaternions_and_Euler_angles&diff=1128143523&oldid=1128124788

And I think in your code above, pitch1 is the new code, and pitch2 was the old calculation, right? What are the problems with pitch2? Why is using pitch1 better? Also, you have a typo I believe: it should be pitch2 = np.arcsin(2*(w*y - z*x)). You have w*x mistakenly where w*y goes. --ERCaGuy (talk) 03:55, 12 October 2023 (UTC)[reply]