Pinocchio: RobotWrapper.BuildFromURDF(URDF), ValueError: Mesh file could not be found.

Created on 28 Jul 2021  路  6Comments  路  Source: stack-of-tasks/pinocchio

System: Ubuntu 18.04
ROS: Melodic
Pinocchio: robotpkg-py36-pinocchio

I am learning Pinocchio tutorials: https://gepettoweb.laas.fr/doc/stack-of-tasks/pinocchio/master/doxygen-html/md_doc_d-practical-exercises_1-directgeom.html

I have cloned package "example-robot-data" from https://github.com/Gepetto/example-robot-data in my ROS catkin workspace and build successed. But when I want to use URDF file in ROS package "example-robot-data" with my python scripts, an error occered:
ValueError: Mesh package://example-robot-data/robots/solo_description/meshes/obj/with_foot/solo_body.obj could not be found.

My scripts is :

from pinocchio.robot_wrapper import RobotWrapper

URDF = '/home/niu/catkin_ws/src/example-robot-data/robots/ur_description/urdf/ur5_robot.urdf'
robot = RobotWrapper.BuildFromURDF(URDF)
for name, function in robot.model.__class__.__dict__.items():
    print(' **** %s: %s' % (name, function.__doc__))

I have sourced: devel/setup.bash and ROS_PACKAGE_PATH is OK.
My ~/.bashrc file is:

export PATH=/opt/openrobots/bin:$PATH
export PKG_CONFIG_PATH=/opt/openrobots/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/opt/openrobots/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/opt/openrobots/lib/python3.6/site-packages:$PYTHONPATH # Adapt your desired python version here
export CMAKE_PREFIX_PATH=/opt/openrobots:$CMAKE_PREFIX_PATH
source /opt/ros/melodic/setup.bash
source /home/niu/catkin_ws/devel/setup.bash

ROS_PACKAGE_PATH:
ROS_PACKAGE_PATH=/home/niu/catkin_ws/src/example-robot-data:/opt/ros/melodic/share

All 6 comments

When I use
model = pin.buildModelFromUrdf(URDF)
there is no error.

@proyan Could you help on this?

I think ROS_PACKAGE_PATH=/home/niu/catkin_ws/src should make the job.

Hi @beta1scat,

The point of example robot data is to allow an easy

from example_robot_data import load
robot = load('ur5')

Wouldn't this suit your needs ?

You can also precise the package dirs as follows:

robot = RobotWrapper.BuildFromURDF(URDF,package_dirs=['/home/niu/catkin_ws/src'])

I will close as the problem will be solved from mines or @nim65s' suggestions

Thank you very much! @jcarpent @nim65s
All your methods are OK!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ddliu365 picture ddliu365  路  8Comments

cmastalli picture cmastalli  路  5Comments

jcarpent picture jcarpent  路  8Comments

nim65s picture nim65s  路  8Comments

gsutanto picture gsutanto  路  6Comments