mmatl / urdfpy

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

ValueError: string is not a file: #18

Open Simontho001 opened 3 years ago

Simontho001 commented 3 years ago

im trying to load in a urdf file into some simple code which is from urdfpy import URDF robot= URDF.load("C:/Users/(put computer name here)/Desktop/python code/v2 robot arm - Copy/urdf/v2 robot arm - Copy.urdf")

but when i run it i get this error

ValueError: string is not a file: C:/Users/(put computer name here)/Desktop/python code/v2 robot arm - Copy/urdf\package://v2 robot arm - Copy/meshes/base_link.STL how do i fix this?

RitchieQi commented 2 years ago

It means the directory of models provided in the .urdf doesn't exist. Check the directory of your mesh files.

RayYoh commented 2 years ago

i have the same error.

RitchieQi commented 2 years ago

i have the same error.

You could either modify the directory in your .urdf file or change the directory of your robot models.

cedriclmenard commented 2 years ago

@RitchieQi this issue seems to arise from using the package:// prefix, which is actually valid URDF description (see: http://wiki.ros.org/urdf/XML/link). Since urdfpy doesn't seem to support the package scheme, removing said prefix from the file path and thus using a relative path could be a possible workaround in urdfpy.

As a side note, see PR #2 for an implemented fix.