Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug where getunit converts a scalar argument to a 0d numpy array #151

Closed
wants to merge 2 commits into from

Conversation

petercorke
Copy link
Collaborator

The problem in #144 is actually in getunit which returns a numpy array when passed a scalar. This is a more general problem that was picked up here.

The fix is simple. Tested by turning warnings on

% python -Wd
Python 3.10.16 (main, Dec 11 2024, 10:22:29) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from spatialmath.base import angvec2r
>>> angvec2r(0.3, [1, 0, 0])
array([[ 1.        ,  0.        ,  0.        ],
       [ 0.        ,  0.95533649, -0.29552021],
       [ 0.        ,  0.29552021,  0.95533649]])
>>> 

@petercorke
Copy link
Collaborator Author

this needs more thought, this deprecation warning is everywhere in the code base...

@petercorke petercorke closed this Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant