merge
This commit is contained in:
commit
95b279f6df
|
@ -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)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
is <a href="http://ros.org/wiki/urdf">urdf</a>, which parses URDF files, and constructs an
|
is <a href="http://ros.org/wiki/urdf">urdf</a>, which parses URDF files, and constructs an
|
||||||
object model (C++) of the robot.
|
object model (C++) of the robot.
|
||||||
</description>
|
</description>
|
||||||
<author>Maintained by Wim Meeussen, wim@willowgarage.com</author>
|
<author>Wim Meeussen, John Hsu, David Lu</author>
|
||||||
<license>GPL,BSD,MIT</license>
|
<license>GPL,BSD,MIT</license>
|
||||||
<review status="Doc reviewed" notes="2009-10-02"/>
|
<review status="Doc reviewed" notes="2009-10-02"/>
|
||||||
<url>http://ros.org/wiki/robot_model</url>
|
<url>http://ros.org/wiki/robot_model</url>
|
||||||
|
|
Loading…
Reference in New Issue