robotics-toolbox-python icon indicating copy to clipboard operation
robotics-toolbox-python copied to clipboard

Could not use the spatialmath-python module

Open liuyang-664 opened this issue 3 years ago • 1 comments

When I run the tests/test_mobile.py file, there is an Error saying " model 'spatialmath' has no attribute 'base' ". I used 'pip3 install roboticstoolbox-python' to install the module, and successfully installed spatialmath-python-1.0.5.

Does anyone know how to solve this? Appreciate your answer very much.

Error Information

Traceback (most recent call last): File "tests/test_mobile.py", line 7, in import roboticstoolbox as rtb File "/home/jeremy/.local/lib/python3.6/site-packages/roboticstoolbox/init.py", line 1, in from roboticstoolbox.tools import * File "/home/jeremy/.local/lib/python3.6/site-packages/roboticstoolbox/tools/init.py", line 2, in from roboticstoolbox.tools.p_servo import p_servo, angle_axis File "/home/jeremy/.local/lib/python3.6/site-packages/roboticstoolbox/tools/p_servo.py", line 4, in from spatialmath import SE3, base File "/home/jeremy/.local/lib/python3.6/site-packages/spatialmath/init.py", line 1, in from spatialmath.pose2d import SO2, SE2 File "/home/jeremy/.local/lib/python3.6/site-packages/spatialmath/pose2d.py", line 26, in from spatialmath.base import argcheck File "/home/jeremy/.local/lib/python3.6/site-packages/spatialmath/base/init.py", line 7, in from spatialmath.base.transforms2d import * # lgtm [py/polluting-import] File "/home/jeremy/.local/lib/python3.6/site-packages/spatialmath/base/transforms2d.py", line 20, in import spatialmath.base as smb AttributeError: module 'spatialmath' has no attribute 'base'

Install Information

Successfully installed ansitable-0.9.7 colored-1.4.4 cycler-0.11.0 kiwisolver-1.3.1 matplotlib-3.3.4 numpy-1.19.5 pgraph-python-0.6.2 pillow-8.4.0 progress-1.6 pyparsing-3.0.9 python-dateutil-2.8.2 roboticstoolbox-python-1.0.2 rtb-data-1.0.0 scipy-1.5.4 six-1.16.0 spatialgeometry-1.0.1 spatialmath-python-1.0.5 swift-sim-1.0.0 websockets-9.1

liuyang-664 avatar Feb 22 '23 09:02 liuyang-664

I fixed this problem by replacing "import spatialmath.base as smb" with "from spatialmath import base as smb" in the file 'transforms2d.py'.

liuyang-664 avatar Feb 23 '23 11:02 liuyang-664