Go to the documentation of this file.00001
00002
00003 import rospy
00004 import fnmatch
00005
00006 topics_glob = []
00007 services_glob = []
00008 params_glob = []
00009
00010
00011 def get_globs():
00012
00013 global topics_glob
00014 global services_glob
00015 global params_glob
00016
00017 def get_param(param_name):
00018 param = rospy.get_param(param_name, '')
00019
00020 return [
00021 element.strip().strip("'")
00022 for element in param.strip('[').strip(']').split(',')
00023 if len(element.strip().strip("'")) > 0]
00024
00025 topics_glob = get_param('~topics_glob')
00026 services_glob = get_param('~services_glob')
00027 params_glob = get_param('~params_glob')
00028
00029
00030 def filter_globs(globs, full_list):
00031
00032 if globs is not None and len(globs) > 0:
00033 return filter(lambda x: any_match(x, globs), full_list)
00034 else:
00035 return full_list
00036
00037
00038 def any_match(query, globs):
00039 return globs is None or len(globs) == 0 or any(fnmatch.fnmatch(str(query), glob) for glob in globs)
00040