Hi,
When calling SO3.AxisAngle in Python 3.11 with numpy 2.4, I get the error:
Python3.11.11|packagedbyconda-forge| (main, Dec52024, 08:47:03) [Clang18.1.8 ] ondarwinType"help", "copyright", "credits"or"license"formoreinformation.
>>>importnumpyasnp>>>np.__version__'2.4.0'>>>fromspatialmathimportSO3>>>SO3.AngVec(theta=0, v=[0, 0, 1])
Traceback (mostrecentcalllast):
File"<stdin>", line1, in<module>File"/opt/homebrew/Caskroom/miniconda/base/envs/vp_311/lib/python3.11/site-packages/spatialmath/pose3d.py", line825, inAngVecreturncls(smb.angvec2r(theta, v, unit=unit), check=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File"/opt/homebrew/Caskroom/miniconda/base/envs/vp_311/lib/python3.11/site-packages/spatialmath/base/transforms3d.py", line760, inangvec2rR=np.eye(3) +math.sin(θ) *sk+ (1.0-math.cos(θ)) *sk @ sk^^^^^^^^^^^TypeError: only0-dimensionalarrayscanbeconvertedtoPythonscalars>>>
However, with numpy 2.2, I get the expected behavior:
Python3.11.11|packagedbyconda-forge| (main, Dec52024, 08:47:03) [Clang18.1.8 ] ondarwinType"help", "copyright", "credits"or"license"formoreinformation.
>>>importnumpyasnp>>>np.__version__'2.2.6'>>>fromspatialmathimportSO3>>>SO3.AngVec(theta=0, v=[0, 0, 1])
SO3(array([[1., 0., 0.],
[0., 1., 0.],
[0., 0., 1.]]))
The error seems to stem from getunit, which when given a scalar now returns a 1-dimensional array instead of a 0-dimensional array. That then gets fed to math.cos, not np.cos, in angvec2r and the error occurs.
Thank you for all your work on this library,
JF
Hi,
When calling SO3.AxisAngle in Python 3.11 with numpy 2.4, I get the error:
However, with numpy 2.2, I get the expected behavior:
The error seems to stem from
getunit, which when given a scalar now returns a 1-dimensional array instead of a 0-dimensional array. That then gets fed tomath.cos, notnp.cos, inangvec2rand the error occurs.Thank you for all your work on this library,
JF