Re: The different results given by scipy and https://quaternions.online/ when converting Euler angles to Quaternion representation.

Guillaume Gay <[email protected]> Wed, 28 Oct 2020 09:27:47 +0100
Newsgroups gmane.comp.python.scientific.user
Message-ID <[email protected]>
Hi, Hongyi,


This seems to have to do first with extrinsic vs intrinsic order, (the 
website seems to assume intrinsic angles). Thus with "XYZ" as first 
argument, the result are still different but that difference is 
consistent (which is not the case for e.g. `r = R.from_euler('xyz', [30, 
45, 30], degrees=True)` which gives different values all together on 
your website / with scipy.


r = R.from_euler('XYZ', [90, 45, 30], degrees=True)

r.as_quat()

array([0.70105738, 0.09229596, 0.43045933, 0.56098553])

the result is now a permutation away from what the website says.


I'd test with 'obvious' cases to get to the bottom of that, but I mostly 
think one should trust scipy to do "the right thing" as it has had more 
scrutiny than the website.


Hope this helps


Le 27/10/2020 à 14:19, Hongyi Zhao a écrit :
> Hi,
>
> I try to convert between Euler angle and Quaternion representations.
> But I obtained different results when using scipy and the online
> converter (https://quaternions.online/). See following for detailed
> info:
>
> The results obtained from scipy:
>
> In [14]: from scipy.spatial.transform import Rotation as R
>
> In [15]: r = R.from_euler('xyz', [90, 45, 30], degrees=True)
> In [17]: r.as_quat()
> Out[17]: array([ 0.56098553,  0.43045933, -0.09229596,  0.70105738])
>
> The results given by the online converter (https://quaternions.online/):
>
>   w: 0.561
>   x: 0.701
>   y: 0.092
>   z: 0.430
>
> Any hints for this problem will be highly appreciated?
>
> Regards,
> HY
_______________________________________________
SciPy-User mailing list
[email protected]
https://mail.python.org/mailman/listinfo/scipy-user