From d3705e9ead7efa2ab9b419f63d1566d5d79176de Mon Sep 17 00:00:00 2001 From: Wim Meeussen Date: Thu, 16 Jun 2011 09:35:29 -0700 Subject: [PATCH] add David to author list --- .../src/resource_retriever/__init__.py | 0 .../src/resource_retriever/retriever.py | 31 +++++++++++++++++++ stack.xml | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 resource_retriever/src/resource_retriever/__init__.py create mode 100644 resource_retriever/src/resource_retriever/retriever.py diff --git a/resource_retriever/src/resource_retriever/__init__.py b/resource_retriever/src/resource_retriever/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/resource_retriever/src/resource_retriever/retriever.py b/resource_retriever/src/resource_retriever/retriever.py new file mode 100644 index 0000000..f6edbac --- /dev/null +++ b/resource_retriever/src/resource_retriever/retriever.py @@ -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) + diff --git a/stack.xml b/stack.xml index 1be1022..76b1e65 100644 --- a/stack.xml +++ b/stack.xml @@ -6,7 +6,7 @@ is urdf, which parses URDF files, and constructs an object model (C++) of the robot. - Maintained by Wim Meeussen, wim@willowgarage.com + Wim Meeussen, John Hsu, David Lu GPL,BSD,MIT http://ros.org/wiki/robot_model