Go to the documentation of this file.00001
00002
00003 import rospkg
00004 import rospy
00005
00006 def resolveResource(filename):
00007 if filename.startswith('package://'):
00008 rest = filename[10:]
00009 package_name = rest[:rest.find('/')]
00010 package_relative_file = rest[rest.find('/')+1:]
00011 if package_name == rest:
00012 rospy.logfatal("Unable to parse resource %s" %filename)
00013 return None
00014 rp = rospkg.RosPack()
00015 try:
00016 package_path = rp.get_path(package_name)
00017 except:
00018 rospy.logfatal("Requested resource: " + filename + ". Unable to find package " + package_name)
00019 return None
00020 filename = package_path + '/' + package_relative_file
00021 return filename
00022