Ask Your Question

Bug: Mesh file path in URDF. Cannot locate resource file://

asked 2012-07-18 01:08:28 -0500

dbworth gravatar image

updated 2014-01-28 17:13:04 -0500

ngrennan gravatar image

I've saved a SolidWorks file as an ASCII .STL, opened it in MeshLab and re-saved as a Binary .STL

When I try to test it using the file:// descriptor in a URDF file I'm getting some errors:

XML code is: <mesh filename="file://home/username/path/path/filename.stl"/>

[ERROR] [1342609158.212504927]: Error retrieving file [file://home/username/path/path/filename.stl]: Couldn't open file /username/path/path/filename.stl
[ERROR] [1342609158.213501127]: Could not load model 'file://home/username/path/path/filename.stl' for link 'Mounting_link': OGRE EXCEPTION(6:FileNotFoundException): Cannot locate resource file://home/username/path/path/filename.stl in resource group Autodetect or any other group. in ResourceGroupManager::openResource at /tmp/buildd/ros-fuerte-visualization-common-1.8.4/debian/ros-fuerte-visualization-common/opt/ros/fuerte/stacks/visualization_common/ogre/build/ogre_src_v1-7-3/OgreMain/src/OgreResourceGroupManager.cpp (line 753)

** Notice that in the error it looks like it may be truncating the word 'home' and trying to load "/username/path/path/filename.stl".

When I change the path to:
<mesh filename="file://home/home/username/path/path/filename.stl"/>
the mesh loads correctly.


edit retag flag offensive close merge delete


So what exactly is your question? For bug reports, it's best to file a ticket at the corresponding trac:

Lorenz gravatar image Lorenz  ( 2012-07-18 02:22:09 -0500 )edit

Ok, will do that. Originally this was a question, then I edited it when I found a solution :-)

dbworth gravatar image dbworth  ( 2012-07-18 04:30:52 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2012-08-08 16:22:34 -0500

tfoote gravatar image

When you're looking for a file using file:// like http:// usually you need 3 slashes to tell it that it's a absolute url. try "file:///home/username/path/path/filename.stl" if you don't the first argument after the slashes is considered the hostname.

Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> urllib.urlopen('file:///tmp/foo')
<addinfourl at 17115976 whose fp = <open file '/tmp/foo', mode 'rb' at 0x7f449c12aae0>>
>>> urllib.urlopen('file://tmp/foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/", line 86, in urlopen
  File "/usr/lib/python2.6/", line 205, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.6/", line 465, in open_file
    return self.open_ftp(url)
  File "/usr/lib/python2.6/", line 522, in open_ftp
    host = socket.gethostbyname(host)
IOError: [Errno socket error] [Errno -2] Name or service not known
edit flag offensive delete link more


This syntax worked better for me "file:///$(find package_name)/path/to/file". This will likely work for different machines.

curi_ROS gravatar image curi_ROS  ( 2018-10-10 01:39:32 -0500 )edit

answered 2012-07-18 02:30:27 -0500

David Lu gravatar image

You should use the Resource_retriever syntax which is more platform independent.

edit flag offensive delete link more


@David Lu: Sorry my post above had a copy-paste error. I've edited it now.

file:// is part of resource_retriever (

dbworth gravatar image dbworth  ( 2012-07-24 02:36:29 -0500 )edit

What @David Lu probably means is that you should use 'package://name of your package/path/to/file' instead of putting absolute paths that work only on your machine.

Lorenz gravatar image Lorenz  ( 2012-08-09 05:43:38 -0500 )edit

I use package:// instead of file, however still fail. the files were exported from sw_urdf_exporter

shawnysh gravatar image shawnysh  ( 2017-01-10 07:06:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2012-07-18 01:08:28 -0500

Seen: 6,165 times

Last updated: Aug 08 '12