This commit is contained in:
Wim Meeussen 2011-06-16 09:35:39 -07:00
commit 95b279f6df
3 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,31 @@
import roslib; roslib.load_manifest('resource_retriever2')
import rospy
import subprocess
import urlgrabber, string
PACKAGE_PREFIX = 'package://'
def rospack_find(package):
process = subprocess.Popen(['rospack', 'find', package], shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdout, stderr) = process.communicate()
if len(stderr) > 0:
raise Exception(stderr)
else:
return string.strip(stdout)
def get(url):
mod_url = url
if url.find(PACKAGE_PREFIX) == 0:
mod_url = url[len(PACKAGE_PREFIX):]
pos = mod_url.find('/')
if pos == -1:
raise Exception("Could not parse package:// format into file:// format for "+url)
package = mod_url[0:pos]
mod_url = mod_url[pos:]
package_path = rospack_find(package)
mod_url = "file://" + package_path + mod_url;
return urlgrabber.urlopen(mod_url)

View File

@ -6,7 +6,7 @@
is <a href="http://ros.org/wiki/urdf">urdf</a>, which parses URDF files, and constructs an
object model (C++) of the robot.
</description>
<author>Maintained by Wim Meeussen, wim@willowgarage.com</author>
<author>Wim Meeussen, John Hsu, David Lu</author>
<license>GPL,BSD,MIT</license>
<review status="Doc reviewed" notes="2009-10-02"/>
<url>http://ros.org/wiki/robot_model</url>