clemense / yourdfpy

Python parser for URDFs
MIT License
122 stars 13 forks source link

KeyError while loading PR2 description #40

Closed stephane-caron closed 8 months ago

stephane-caron commented 1 year ago

A KeyError pops out when trying to open the pr2_simplified.urdf description from Drake:

$ yourdfpy examples/pr2/models/pr2_description/urdf/pr2_simplified.urdf                                                                                           ✔ 
Traceback (most recent call last):
  File "~/.local/bin/yourdfpy", line 8, in <module>
    sys.exit(run())
  File "~/.local/lib/python3.8/site-packages/yourdfpy/viz.py", line 198, in run
    main(sys.argv[1:])
  File "~/.local/lib/python3.8/site-packages/yourdfpy/viz.py", line 187, in main
    urdf_model.show(
  File "~/.local/lib/python3.8/site-packages/yourdfpy/urdf.py", line 859, in show
    elif len(self._scene.bounds_corners) < 1:
  File "~/.local/lib/python3.8/site-packages/trimesh/caching.py", line 109, in get_cached
    value = function(*args, **kwargs)
  File "~/.local/lib/python3.8/site-packages/trimesh/scene/scene.py", line 330, in bounds_corners
    transform, geometry_name = self.graph[node_name]
  File "~/.local/lib/python3.8/site-packages/trimesh/scene/transforms.py", line 471, in __getitem__
    return self.get(key)
  File "~/.local/lib/python3.8/site-packages/trimesh/scene/transforms.py", line 145, in get
    matrices = [edge_data[(u, v)]['matrix'] for u, v in
  File "~/.local/lib/python3.8/site-packages/trimesh/scene/transforms.py", line 145, in <listcomp>
    matrices = [edge_data[(u, v)]['matrix'] for u, v in
KeyError: 'matrix'

(The model from the git repository tries to load .obj meshes, while they are in fact .stl. This error remains even after replacing all occurrences of .obj by .stl in the file.)

clemense commented 8 months ago

Can't reproduce it with the current version of yourdfpy. After replacing all occurrences of .obj with .stl it works:

Screenshot from 2023-12-17 14-21-19

Will close this issue, let me know if that error still occurs.