39 from roslaunch
import RLException
50 Load parameters onto the parameter server. 52 Copied from ROSLaunchRunner. 54 @type config: roslaunch.config.ROSLaunchConfig 59 param_server = config.master.get()
67 param_server_multi = config.master.get_multi()
71 for param
in roslaunch.launch._unify_clear_params(config.clear_params):
72 if param_server.hasParam(caller_id, param)[2]:
73 param_server_multi.deleteParam(caller_id, param)
74 r = param_server_multi()
75 for code, msg, _
in r:
77 raise RLException(
"Failed to clear parameter {}: ".format(msg))
80 except Exception
as e:
81 rospy.logerr(
"load_parameters: unable to set params " +
82 "(last param was [{}]): {}".format(param, e))
87 param_server_multi = config.master.get_multi()
88 for param
in config.params.values():
91 param_server_multi.setParam(caller_id, param.key, param.value)
92 r = param_server_multi()
93 for code, msg, _
in r:
95 raise RLException(
"Failed to set parameter: %s" % (msg))
98 except Exception
as e:
99 print(
"load_parameters: unable to set params (last param was " +
100 "[%s]): %s" % (param, e))
102 rospy.logdebug(
"... load_parameters complete")
107 Iterator for packages that contain the given subdir. 109 This method is generalizing rosmsg.iterate_packages. 111 @param subdir: eg. 'launch', 'msg', 'srv', 'action' 115 if subdir ==
None or subdir ==
'':
116 raise ValueError(
'Invalid package subdir = {}'.format(subdir))
118 rospack = rospkg.RosPack()
120 pkgs = rospack.list()
121 rospy.logdebug(
'pkgs={}'.format(pkgs))
123 d = os.path.join(rospack.get_path(p), subdir)
124 rospy.logdebug(
'rospack dir={}'.format(d))
131 #TODO: Come up with better name of the method. 134 Lists files contained in the specified package 136 @param package: package name, ``str`` 137 @param file_extension: Defaults to '.launch', ``str`` 138 :returns: list of msgs/srv in package, ``[str]`` 140 if subdir ==
None or subdir ==
'':
141 raise ValueError(
'Invalid package subdir = {}'.format(subdir))
143 rospack = rospkg.RosPack()
145 path = os.path.join(rospack.get_path(package), subdir)
147 return [genmsg.resource_name(package, t)
for t
in RqtRoscommUtil._list_types(path, file_extension)]
154 List all messages in the specified package 155 :param package str: name of package to search 156 :param include_depends bool: if True, will also list messages in 157 package dependencies. 158 :returns [str]: message type names 160 types = RqtRoscommUtil._list_resources(path,
161 RqtRoscommUtil._msg_filter(ext))
163 result = [x
for x
in types]
172 Taken from rosmsg._list_resources 174 List resources in a package directory within a particular 175 subdirectory. This is useful for listing messages, services, etc... 176 :param rfilter: resource filter function that returns true if filename 177 is the desired resource type, ``fn(filename)->bool`` 180 if os.path.isdir(path):
182 in os.listdir(path)
if rfilter(os.path.join(path, f))]
190 Taken from rosmsg._msg_filter 194 Predicate for filtering directory list. matches message files 195 :param f: filename, ``str`` 197 return os.path.isfile(f)
and f.endswith(ext)
207 rostopic.get_topic_class(
'/rosout')
209 except rostopic.ROSTopicIOException
as e:
def list_files(package, subdir, file_extension='.launch')
def load_parameters(config, caller_id)
def _list_resources(path, rfilter=os.path.isfile)
def iterate_packages(subdir)
def _list_types(path, ext)