mmatl / urdfpy

Python parser for URDFs
http://urdfpy.readthedocs.io/
MIT License
224 stars 81 forks source link

Failure to display urdf visualization #14

Open victorozoh opened 3 years ago

victorozoh commented 3 years ago

Hi,

Thanks for the effort you guys put into making urdfpy. I am getting errors for the following code sample executing on Python 3. I installed urdfpy into my python3 environment.


from urdfpy import URDF
robot = URDF.load('ur5/ur5.urdf')

robot.show(cfg={'shoulder_lift_joint':-2.0, 'elbow_joint':2.0})

Error: urdf_test_error

I made certain that the 'robot' variable gets a value from the URDF.load() function. I'd greatly appreciate your thoughts on how to fix this.

qiuwch commented 3 years ago

This seems to be an issue caused by trimesh. If I use pip install trimesh==3.7.13 it works fine. But 3.7.14 fails.

bearpaw commented 2 years ago

Install pyrender from the source https://github.com/mmatl/pyrender.git resolves this issue.

im44pos commented 1 year ago

I have trimesh 3.16.4, pyrender 0.1.45 in a python 3.8 jupyter notebook on windows10 and get: IndexError: index 0 is out of bounds for axis 0 with size 0


IndexError Traceback (most recent call last) Cell In [13], line 1 ----> 1 robot.show( cfg = { 2 'shoulder_lift_joint': -2.0, 3 'elbow_joint': 2.0 4 })

File C:\ProgramFiles\Anaconda\envs\robot_urdf\lib\site-packages\urdfpy\urdf.py:3570, in URDF.show(self, cfg, use_collision) 3568 for tm in fk: 3569 pose = fk[tm] -> 3570 mesh = pyrender.Mesh.from_trimesh(tm, smooth=False) 3571 scene.add(mesh, pose=pose) 3572 pyrender.Viewer(scene, use_raymond_lighting=True)

File C:\ProgramFiles\Anaconda\envs\robot_urdf\lib\site-packages\pyrender\mesh.py:209, in Mesh.from_trimesh(mesh, material, is_visible, poses, wireframe, smooth) 206 normals = np.repeat(m.face_normals, 3, axis=0) 208 # Compute colors, texture coords, and material properties --> 209 color_0, texcoord_0, primitive_material = Mesh._get_trimesh_props(m, smooth=smooth, material=material) 211 # Override if material is given. 212 if material is not None: 213 #primitive_material = copy.copy(material)

File C:\ProgramFiles\Anaconda\envs\robot_urdf\lib\site-packages\pyrender\mesh.py:291, in Mesh._get_trimesh_props(mesh, smooth, material) 289 texcoords = uv 290 else: --> 291 texcoords = uv[mesh.faces].reshape( 292 (3 * len(mesh.faces), uv.shape[1]) 293 ) 295 if material is None: 296 # Configure mesh material 297 mat = mesh.visual.material

IndexError: index 0 is out of bounds for axis 0 with size 0