dfki-ric / pytransform3d

3D transformations for Python.
https://dfki-ric.github.io/pytransform3d/
Other
632 stars 68 forks source link

Bug in `axis_angle_from_matrix` #189

Closed AlexanderFabisch closed 2 years ago

AlexanderFabisch commented 2 years ago
/home/dfki.uni-bremen.de/afabisch/anaconda3/envs/robot/lib/python3.8/site-packages/pytransform3d/rotations/_conversions.py:1597: RuntimeWarning: invalid value encountered in sqrt
  a[:3] = np.sqrt(0.5 * (np.diag(R) + 1.0)) * np.sign(axis_unnormalized)
[ 0.81725001  0.19145    -0.00549102         nan         nan         nan]

workaround:

a[:3] = np.sqrt(0.5 * np.abs(np.diag(R) + 1.0)) * np.sign(axis_unnormalized)

Pickled test data in cloud, load with

import pickle
R = pickle.load(open("data.pickle", "rb"))
pr.compact_axis_angle_from_matrix(R)

Fixed in #188

AlexanderFabisch commented 2 years ago

Fixed in https://github.com/rock-learning/pytransform3d/pull/188