pinocchio icon indicating copy to clipboard operation
pinocchio copied to clipboard

module 'pinocchio.pinocchio_pywrap_default' has no attribute 'buildModelFromSdf'

Open jameswzhu opened this issue 2 years ago • 12 comments

Greetings,

I am trying to load a SDF model using the Pinocchio 3 Python bindings: model, collision_model, visual_model = pin.buildModelsFromSdf(sdf_model_path)

However, I receive the following exception: Exception has occurred: AttributeError module 'pinocchio.pinocchio_pywrap_default' has no attribute 'buildModelFromSdf' File "/usr/local/lib/python3/dist-packages/pinocchio/shortcuts.py", line 76, in buildModelsFromSdf model, constraint_models = pin.buildModelFromSdf(filename) File "/home/james/catkin_ws/src/quad-sdk/ilqr/microtaur.py", line 29, in <module> model, collision_model, visual_model = pin.buildModelsFromSdf(sdf_model_path) AttributeError: module 'pinocchio.pinocchio_pywrap_default' has no attribute 'buildModelFromSdf'

Did I miss installing a dependency or something similar? Help would be immensely appreciated. Thank you.

jameswzhu avatar Jan 20 '23 23:01 jameswzhu

Hey @jameswzhu , It seems you're not building Pinocchio with SDF support . Make sure to be on the pinocchio3-preview branch and enable the cmake option BUILD_WITH_SDF_SUPPORT. I hope this helps

fabinsch avatar Jan 21 '23 08:01 fabinsch

Thank you for the help! Yes I needed to turn on the SDF support. But now, I am seeing this error when I attempt to load a model:

Exception has occurred: MemoryError exception: no description File "/usr/local/lib/python3/dist-packages/pinocchio/shortcuts.py", line 78, in buildModelsFromSdf model, constraint_models = pin.buildModelFromSdf(filename, root_joint) File "/home/james/catkin_ws/src/quad-sdk/ilqr/microtaur.py", line 29, in <module> model, collision_model, visual_model = pin.buildModelsFromSdf(sdf_model_path, root_joint=pin.JointModelFreeFlyer()) MemoryError:

Any thoughts on this? Though this may be something with my personal setup that I will try to debug. Thanks!

jameswzhu avatar Jan 22 '23 00:01 jameswzhu

Hi @jameswzhu,

Could you share your robot model? Best,

Justin

jcarpent avatar Jan 22 '23 07:01 jcarpent

Sure, the robot model I want to load is for the Ghost Robotics Spirit. But also for debugging, I've have tried just a simple box model. But the error occurs for both models. I've attached the files below, hope this helps! models.zip

jameswzhu avatar Jan 22 '23 17:01 jameswzhu

@jameswzhu from your previous message, it seems you are mixing two strategies to install Pinocchio. One uses catkin, and the other one uses dist-package. Could you start from a fresh environment (e.g., docker or conda)?

jcarpent avatar Jan 23 '23 09:01 jcarpent

Thanks for the recommendation! I will try that and follow up with you on if that solved the issue.

jameswzhu avatar Jan 23 '23 20:01 jameswzhu

Sorry for the delay in response, but I think I'm still struggling with the installation. When I install pinocchio from source, should it not be found in the python3/dist-packages folder? Also wanted to mention that loading models from URDF works fine, but not from SDF.

jameswzhu avatar Feb 10 '23 17:02 jameswzhu

I wanted to follow up with some more information. Does it matter which libsdformat release I am using? I currently have libsdformat6. on Ubuntu 20.04, with C++14.

jameswzhu avatar Feb 12 '23 20:02 jameswzhu