Loading Solo and Bolt in Pinocchio 2.6.4
stephane-caron opened this issue · 9 comments
From @Danfoa at #6 (comment):
STL: ASCII file is empty or invalid; no data loaded
Hint: the mesh directory may be wrong.
...
File ".../envs/robotics/lib/python3.7/site-packages/pinocchio/robot_wrapper.py", line 21, in initFromURDF
model, collision_model, visual_model = buildModelsFromUrdf(filename, package_dirs, root_joint, verbose, meshLoader)
File ".../envs/robotics/lib/python3.7/site-packages/pinocchio/shortcuts.py", line 45, in buildModelsFromUrdf
geom_model = pin.buildGeomFromUrdf(model, filename, geometry_type, package_dirs)
ValueError: Argument geometry_model should be a GeometryModel
Hmm I'm not sure what's going on as they load fine for me:
$ python examples/load_in_pinocchio.py solo
Robot successfully loaded as <pinocchio.robot_wrapper.RobotWrapper object at 0x7f6fc75ff070>
$ python examples/load_in_pinocchio.py bolt
Robot successfully loaded as <pinocchio.robot_wrapper.RobotWrapper object at 0x7f76dccd3070>
@Danfoa do you get the same exception from the load_in_pinocchio
example?
Follow-up from #15, maybe try again with Pinocchio 2.6.12?
So I cleared .cache, and checked that I was not using any previous clone of the robot_propeties_<bolt/solo> repositories, and I am still finding these issues:
- Pinocchio 2.6.4 (on Python 3.7.13): Both solo and bolt fail with similar error trace:
PS: For some reason, I don't have available version 2.6.12
on PyPi, even do I have a python 3.7 env. The only available versions to me are 2.6.0, 2.6.1, 2.6.3, and 2.6.4.
Caught: Could not load resource [...]/.cache/robot_descriptions/example-robot-data/robots/solo_description/meshes/stl/solo12/solo_12_base.stl
STL: ASCII file is empty or invalid; no data loaded
Hint: the mesh directory may be wrong.
Traceback (most recent call last):
File "examples/load_in_pinocchio.py", line 40, in <module>
robot = load_robot_description(args.name)
File "[...]/Projects/robot_descriptions.py/robot_descriptions/loaders/pinocchio.py", line 59, in load_robot_description
module = import_module(f"robot_descriptions.{description_name}")
File "[...]/anaconda3/envs/robotics/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'robot_descriptions.solo'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "examples/load_in_pinocchio.py", line 42, in <module>
robot = load_robot_description(f"{args.name}_description")
File "[...]/Projects/robot_descriptions.py/robot_descriptions/loaders/pinocchio.py", line 72, in load_robot_description
root_joint=root_joint,
File "[...]/anaconda3/envs/robotics/lib/python3.7/site-packages/pinocchio/robot_wrapper.py", line 17, in BuildFromURDF
robot.initFromURDF(filename, package_dirs, root_joint, verbose, meshLoader)
File "[...]/anaconda3/envs/robotics/lib/python3.7/site-packages/pinocchio/robot_wrapper.py", line 21, in initFromURDF
model, collision_model, visual_model = buildModelsFromUrdf(filename, package_dirs, root_joint, verbose, meshLoader)
File "[...]/anaconda3/envs/robotics/lib/python3.7/site-packages/pinocchio/shortcuts.py", line 45, in buildModelsFromUrdf
geom_model = pin.buildGeomFromUrdf(model, filename, geometry_type, package_dirs)
ValueError: Argument geometry_model should be a GeometryModel
Okay. Can you check that the file ~/.cache/robot_descriptions/example-robot-data/robots/solo_description/meshes/stl/solo12/solo_12_base.stl
exists and is not corrupted?
Its size should be about 268K and its md5sum:
$ md5sum solo_12_base.stl
9a3ed18f59f49101af22bac01470b118 solo_12_base.stl
Nevermind, I'm able to reproduce your issue in a python:3.7
Docker container. The file does exist but is not loaded properly.
I believe this is an issue related to Pinocchio version 2.6.4 in particular, that has been fixed in more recent versions. You can see it in the line pointed at by the ValueError: Argument geometry_model should be a GeometryModel
exception:
In Pinocchio 2.6.4:
geom_model = pin.buildGeomFromUrdf(model, filename, geometry_type, package_dirs)
In Pinocchio 2.6.12:
geom_model = pin.buildGeomFromUrdf(model, filename, geometry_type, package_dirs = package_dirs)
This fix avoids the argument type mismatch.
Even applying this fix, the error persists though:
ValueError: Could not load resource /root/.cache/robot_descriptions/example-robot-data/robots/solo_description/meshes/stl/solo12/solo_12_base.stl
STL: ASCII file is empty or invalid; no data loaded
Hint: the mesh directory may be wrong.
This error is raised by hpp-fcl, which Pinocchio uses to load its meshes. The STL files for Solo are binary rather than ASCII, perhaps that was the issue. At any rate, it seems it was fixed in more recent distributions of Pinocchio.
To feed back this issue into robot_descriptions
, I'll bump the minimum version of Pinocchio to 2.6.10 in optional/testing dependencies.
This issue was mentioned in unit tests :see_no_evil: and the corresponding descriptions (four of them, including Solo and Bolt) were skipped in Pinocchio tests. This issue was also previously noted to have been fixed in Pinocchio 2.6.9:
I've removed the test skips, so that the CI validates that Solo and Bolt now load successfully with pin >=2.6.10
.
@Danfoa Thanks for your report that prompted fixing this blind spot!
You are right the way to solve the issue is to update Pinocchio to 2.6.9, and since there are no releases of these version on Pypi for python 3.7, to update pin I had to switch to a newer version of python.
Then problem solved.
I found another problem while loading MiniCheetah, Pinocchio regonizes more joints than the real 12. I will make an issue soon.
OK :ok_hand: You can report the issue to:
- the mini_cheetah_urdf issue tracker if it comes from the URDF,
- the pinocchio issue tracker if the URDF is correct and Pinocchio is not interpreting it correctly,
or to this issue tracker otherwise 😄