AngleAxis and getunit error with Numpy 2.4
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 50/100
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 641
- フォーク
- 102
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 4
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rai-opensource/spatialmath-python のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
rai-opensource/spatialmath-python#32 · コメント 4 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
-
bug
rai-opensource/spatialmath-python#165 · コメント 2 件 · 担当者 1 名 ·
-
rai-opensource/spatialmath-python#143 · コメント 8 件 · 担当者 1 名 ·
-
under investigation
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
rai-opensource/spatialmath-python#78 · コメント 2 件 ·
rai-opensource/spatialmath-python の issue をすべて見る
似ている issue
-
link-check link-check:sphinx-theme
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100