mmatl / urdfpy

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

Trying to access the `meshes` attribute of `Cylinder` throws an error. #20

Open manuelli opened 3 years ago

manuelli commented 3 years ago

If g = Cylinder(1.0, 2.0) and you try to access the g.meshes field then it throws the following error

File "/usr/local/lib/python3.6/dist-packages/urdfpy/urdf.py", line 398, in meshes
    if len(self._meshes) == 0:
TypeError: object of type 'NoneType' has no len()

This is because self._meshes got initialize to self._meshes = None on this line instead of self._meshes = [] like in the other primitive types, e.g. Box. Should be a simple fix to just set self._meshes = [] in the Cylinder constructor.

miker2 commented 1 year ago

This appears to be fixed on the tip of master. @mmatl Any chance we can bump the version and push a new package to pypi so this is fixed in the versions installed via pip or conda?

traversaro commented 1 year ago

@miker2 for what regard the conda-forge build, if you have any idea of what is the commit that fixed the issue we can try to backport it on the top of the latest release, as we did for another issue (https://github.com/mmatl/urdfpy/issues/27) in https://github.com/conda-forge/urdfpy-feedstock/pull/3/files .

adamconkey commented 1 year ago

@traversaro I believe it's this commit that resolves the problem: https://github.com/mmatl/urdfpy/commit/5466842899b33bd549e8f9e2a9a987bd5e37373b

I verified that installing from source from the master branch resolved the problem for me.

traversaro commented 1 year ago

@traversaro I believe it's this commit that resolves the problem: 5466842

I verified that installing from source from the master branch resolved the problem for me.

Ok, I opened a PR to backport the fix in the conda-forge released version in https://github.com/conda-forge/urdfpy-feedstock/pull/5, thanks!