Notes 


Standard_Real gamma = 90.0 / 180.0 * M_PI;
using 90° in Eulerian angles sounds like a bad idea to me.
Are you sure that you did not hit a Gimbal lock? 



When working with robots it is quite usual to use 90° in Euler angles.
But I have changed the values in the given code to 10°, 20° and 30°. It is the same: the computed values differ from the actual rotation angles.
Another case:
If I set
alpha = 0°
beta = 0°
gamma = 10°,
I get
computed alpha = 10°
computed beta = 0°
computed gamma = 0°.
Such things (same values but other order) happen normally, when using wrong Euler sequences. According to my understanding, I am using the correct sequence for YPR rotations (Z, Y', X''). If I was right, the OCC computation would be wrong  probably not wrong at all, but somehow using the wrong Euler sequence...



(0040615)

git

20150506 13:40


Branch CR25574 has been created by abv.
SHA1: 8f92b6612f59e0e615bb12c911a70d910da7121a
Detailed log of new commits:
Author: abv
Date: Wed May 6 11:26:03 2015 +0300
0025574: gp_YawPitchRoll Euler Angle computation gives wrong results
DRAW command CR25574 added for testing Euler angles sequences in gp_Quaternion



(0040618)

abv

20150506 13:47


I confirm that, according to my testing, Euler sequences are not correctly applied in gp_Quaternion, alas. Have a look at DRAW command OCC25574 in the branch CR25574. It implements two checks:
 For each Euler sequence, convert some quaternion (currently taken from description of 0025946) to Euler angles and back, then check that resulting transformation is the same. This check seems to pass.
 For each Euler sequence, check that rotation by each single angle does not affect vector located on corresponding axis. This check fails for most sequences, however gp_YawPitchRoll (gp_Intrinsic_ZYX) is among the few looking fine...
This is to be further investigated, any comments are welcome.
Note that patch on 0025946 proposed by shoogen does not help. 



Since this issue has been open for half a year now, I would like to share my workaround with you. Orocos KDL (http://www.orocos.org/kdl [^]) also has an implementation of Euler ZYX and Euler ZYZ rotations which are the most important ones when using robots. Since I have been using Orocos KDL anyway, I have switched to their implementation which works correctly.
So for me it is not necessary anymore that this bug is fixed in OCC. Still I would very much appreciate if at least the functionality was removed. Then there is no danger anymore that anyone spends as much time as I did trying to use buggy methods. 


(0042103)

abv

20150611 11:06


Benjamin, we will address the issue and correct OCCT code as soon as we have time. Note that you can contribute the fix if you know how this should be corrected. 


(0046687)

git

20151013 10:34


Branch CR25574_1 has been created by akz.
SHA1: 9f11ec99741a0ad5d6a7dea9936969d8aefcfcda
Detailed log of new commits:
Author: akz
Date: Tue Oct 13 10:30:52 2015 +0300
0025574: gp_YawPitchRoll Euler Angle computation gives wrong results
Fixes incorrect parametrization for Quaterion <> Euler angles conversion.
Cause we use 3x3 rotation matrix as a middle step of conversion, we operate
with fixed coordinate system, so all Intrinsic rotation should be converted
to Extrinsic rotations.



(0046688)

akz

20151013 10:36


Branch CR25574_1 is ready to review.
Also, this fix resolves 0025946 bug.



(0046695)

abv

20151013 12:20


Anton, please add a test for Euler angles to ensure that calculations are correct (you can use command I pushed to branch CR25574 some time ago as starting point) 


(0046709)

git

20151013 17:02


Branch CR25574_2 has been created by akz.
SHA1: 825aeb2639bc79f056baf76599895a61eddb281b
Detailed log of new commits:
Author: akz
Date: Tue Oct 13 10:30:52 2015 +0300
0025574: gp_YawPitchRoll Euler Angle computation gives wrong results
Fixes incorrect parametrization for Quaterion <> Euler angles conversion.
Cause we use 3x3 rotation matrix as a middle step of conversion, we operate
with fixed coordinate system, so all Intrinsic rotation should be converted
to Extrinsic rotations.



(0046710)

akz

20151013 17:04


Andrey, I've added tests in QA command OCC25574. Please review branch CR25574_2.



(0050048)

git

20160122 13:06


Branch CR25574_4 has been created by abv.
SHA1: bd7cee22d738e30f579c4fc6836ae7837254b5a3
Detailed log of new commits:
Author: akz
Date: Tue Oct 13 10:30:52 2015 +0300
0025574: gp_YawPitchRoll Euler Angle computation gives wrong results
Conversion of gp_Quaternion to and from intrinsic TaitBryan angles (including gp_YawPitchRoll) is fixed.
Before that fix the sequence of rotation axes was opposite to intended; e.g. gp_YawPitchRoll (equivalent to gp_Intrinsic_ZYX) actually was defining intrinsic rotations around X, then Y, then Z.
Now this is fixed, and rotations are made in correct order.
Comments to gp_EulerSequence enumeration are restored (lost due to CDL extraction).
Test bugs fclasses bug25574 is added to check correctness of Euler sequences, including cases from 0025574 and 0025946.



(0050050)

abv

20160122 13:45


Fix reviewed and completed (added more details in description, note in upgrade documentation, test case, restored comments to gp_EulerSequence enum).
Please check compilation and new test case (bugs fclasses bug25574). Note that overall testing is not needed, since gp_Quaternion is not (yet) used in other OCCT components. 


(0050105)

mkv

20160125 17:55


Dear BugMaster,
Branch CR25574_4 from occt gitrepository (and master from products gitrepository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA1: bd7cee22d738e30f579c4fc6836ae7837254b5a3
Number of compiler warnings:
occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 1 (1 on master)
products component :
Linux: 36 (36 on master)
Windows: 0 (0 on master)
Regressions/Differences/Improvements:
No regressions/differences
Testing cases:
http://occttests/CR255744masterocct64/Debian7064/bugs/fclasses/bug25574.html [^]
http://occttests/CR255744masterocct64/Windows64VC10/bugs/fclasses/bug25574.html [^]
bugs fclasses bug25574: OK
Testing on Linux:
occt component :
Total MEMORY difference: 89634546 / 89612607 [+0.02%]
Total CPU difference: 19100.99999999999 / 19155.6700000001 [0.29%]
products component :
Total MEMORY difference: 25648679 / 25586674 [+0.24%]
Total CPU difference: 8391.089999999984 / 8527.089999999978 [1.59%]
Testing on Windows:
occt component :
Total MEMORY difference: 57244699 / 57250493 [0.01%]
Total CPU difference: 17808.294154998952 / 18418.882068999024 [3.32%]
products component :
Total MEMORY difference: 17257139 / 17270013 [0.07%]
Total CPU difference: 5751.959671299985 / 6201.835355099963 [7.25%]
There are no differences in images found by testdiff. 


(0050106)

mkv

20160125 17:56


Dear BugMaster,
Branch CR25574_4 is TESTED. 


(0052829)

git

20160417 13:18


Branch CR25574 has been deleted by kgv.
SHA1: 8f92b6612f59e0e615bb12c911a70d910da7121a 


(0052830)

git

20160417 13:18


Branch CR25574_1 has been deleted by kgv.
SHA1: 9f11ec99741a0ad5d6a7dea9936969d8aefcfcda 


(0052831)

git

20160417 13:18


Branch CR25574_2 has been deleted by kgv.
SHA1: 825aeb2639bc79f056baf76599895a61eddb281b 


(0052832)

git

20160417 13:18


Branch CR25574_4 has been deleted by kgv.
SHA1: bd7cee22d738e30f579c4fc6836ae7837254b5a3 
