mesh filename in urdf messing up the URDF.load() for urdfpy library

asked 2021-03-14 05:58:29 -0500

singhakash1703 gravatar image

I have to find and replace the joint descriptions after performing calibration on my robot. So I planned on making a python script making use of urdfpy library for the same. But the filename for mesh has been defined in the urdf file as <mesh filename="package://rcve/src/rcve_description/meshes/RCVE_stl.STL" /> which is interfering with the URDF.load(filename) function when called.

My code which loads the file :

from urdfpy import URDF 
import os

dirname = os.path.abspath(os.curdir)
robot = URDF.load(os.path.join(dirname, 'rcve_description/urdf/RCVE_stl_cal.urdf'))

And the last few lines of error that I get :

File "/home/akash/.local/lib/python3.8/site-packages/urdfpy/", line 581, in _from_xml
    meshes = load_meshes(fn)
  File "/home/akash/.local/lib/python3.8/site-packages/urdfpy/", line 225, in load_meshes
    meshes = trimesh.load(filename)
  File "/home/akash/.local/lib/python3.8/site-packages/trimesh/exchange/", line 108, in load
    ) = parse_file_args(file_obj=file_obj,
  File "/home/akash/.local/lib/python3.8/site-packages/trimesh/exchange/", line 587, in parse_file_args
    raise ValueError('string is not a file: {}'.format(file_obj))
ValueError: string is not a file: /home/akash/Documents/rcve/catkin_ws1/src/rcv_autonomous/rcve/src/rcve_description/urdf/package://rcve/src/rcve_description/meshes/RCVE_stl.STL

Any suggestions are appreciated to help me successfully load the urdf file or any other feedback about my approach.

edit retag flag offensive close merge delete