matthew-brett / transforms3d

3 dimensional spatial transformations
http://matthew-brett.github.io/transforms3d/
Other
467 stars 83 forks source link

if Nq < _FLOAT_EPS: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() #36

Closed SarfarazHabib closed 4 years ago

SarfarazHabib commented 4 years ago

Hey Guys, Can anyone help me with this error. I am using transform3d to convert quaternions to eular and I got this error.

y_pred_deg = np.array([np.rad2deg(quat2euler(x)) for x in Ypred[:, 0:4]])

File "/home/deeplearner/anaconda3/envs/tf2.2/lib/python3.8/site-packages/transforms3d/euler.py", line 404, in quat2euler return mat2euler(quat2mat(quaternion), axes) File "/home/deeplearner/anaconda3/envs/tf2.2/lib/python3.8/site-packages/transforms3d/quaternions.py", line 135, in quat2mat if Nq < _FLOAT_EPS: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

matthew-brett commented 4 years ago

It looks like you are passing a 2D array to quat2euler - whereas it expects a 1D array ...

SarfarazHabib commented 4 years ago

Hey, you are right. Thanks for pointing it out. :+1: