AngleAxis and getunit error with Numpy 2.4
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 50/100
Línea de trabajo
Reproduce the SO3.AngVec(theta=0, v=[0, 0, 1]) failure with NumPy 2.4, then inspect spatialmath/pose3d.py and spatialmath/base/transforms3d.py, including getunit and angvec2r. Done means the call no longer raises a TypeError under NumPy 2.4 and retains the expected identity rotation behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi,
When calling SO3.AxisAngle in Python 3.11 with numpy 2.4, I get the error:
Python 3.11.11 | packaged by conda-forge | (main, Dec 5 2024, 08:47:03) [Clang 18.1.8 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'2.4.0'
>>> from spatialmath import SO3
>>> SO3.AngVec(theta=0, v=[0, 0, 1])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/homebrew/Caskroom/miniconda/base/envs/vp_311/lib/python3.11/site-packages/spatialmath/pose3d.py", line 825, in AngVec
return cls(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", line 760, in angvec2r
R = np.eye(3) + math.sin(θ) * sk + (1.0 - math.cos(θ)) * sk @ sk
^^^^^^^^^^^
TypeError: only 0-dimensional arrays can be converted to Python scalars
>>>
However, with numpy 2.2, I get the expected behavior:
Python 3.11.11 | packaged by conda-forge | (main, Dec 5 2024, 08:47:03) [Clang 18.1.8 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.__version__
'2.2.6'
>>> from spatialmath import SO3
>>> 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
- Lenguaje dominante
- Python
- Estrellas
- 641
- Forks
- 102
- Merge medio
- 1 d 18 h
- PR fusionados (30 d)
- 4
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rai-opensource/spatialmath-python
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
rai-opensource/spatialmath-python#32 · 4 comentarios ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
-
bug
rai-opensource/spatialmath-python#165 · 2 comentarios · 1 asignado ·
-
Type-check spatialmath Abierto
rai-opensource/spatialmath-python#143 · 8 comentarios · 1 asignado ·
-
under investigation
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
rai-opensource/spatialmath-python#78 · 2 comentarios ·
Todos los issues de rai-opensource/spatialmath-python
Issues similares
-
link-check link-check:sphinx-theme
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
OpenHands/extensions#626 · 1 comentario ·
-
Change observation tooltip text Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
CSCfi/sd-search-api#39 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100