HumanML3D icon indicating copy to clipboard operation
HumanML3D copied to clipboard

A bug in quaternion.py

Open kai-lan opened this issue 1 year ago • 1 comments
trafficstars

Hi,

I think there is a bug in Euler to Quaternion conversion (euler2quat function in quaternion.py) for ``zyx'' ordering. I have run the following test:

from scipy.spatial.transform import Rotation as R

order = 'zyx'
e = torch.tensor([0.1*torch.pi, 0.2*torch.pi, 0.5*torch.pi])

q = R.from_euler(order.upper(), e.numpy()).as_quat(scalar_first=True)

q1 = euler2quat(e, order, deg=False)

print(q)
print(q1.numpy())

Expected output:

[ 0.69840115 -0.11061587  0.32101977  0.6300368 ]
[ 0.69840115 -0.11061587  0.32101977  0.6300368 ]

Actual output:

[ 0.69840111  0.63003677  0.32101977 -0.11061588]
[ 0.69840115 -0.11061587  0.32101977  0.6300368 ]

kai-lan avatar Sep 22 '24 18:09 kai-lan