Ask Your Question
0

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

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

dbworth gravatar image

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

ngrennan gravatar image

Hi
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.

Thanks.

edit retag flag offensive close merge delete

Comments

So what exactly is your question? For bug reports, it's best to file a ticket at the corresponding trac: https://kforge.ros.org/robotmodel/Trac

Lorenz gravatar imageLorenz ( 2012-07-18 02:22:09 -0600 )edit

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

dbworth gravatar imagedbworth ( 2012-07-18 04:30:52 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
2

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

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/urllib.py", line 86, in urlopen
    return opener.open(url)
  File "/usr/lib/python2.6/urllib.py", line 205, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.6/urllib.py", line 465, in open_file
    return self.open_ftp(url)
  File "/usr/lib/python2.6/urllib.py", 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

Comments

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

curi_ROS gravatar imagecuri_ROS ( 2018-10-10 01:39:32 -0600 )edit
2

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

David Lu gravatar image

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

edit flag offensive delete link more

Comments

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

file:// is part of resource_retriever (http://www.ros.org/wiki/resource_retriever)

dbworth gravatar imagedbworth ( 2012-07-24 02:36:29 -0600 )edit
1

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 imageLorenz ( 2012-08-09 05:43:38 -0600 )edit

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

shawnysh gravatar imageshawnysh ( 2017-01-10 07:06:37 -0600 )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

Stats

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

Seen: 5,354 times

Last updated: Aug 08 '12