def get_start_cfg(self, name, opt_launch='', loglevel='', logformat='', masteruri='', reload_global_param=False): ''' Returns start configuration for a node. :param str name: full name of the ros node exists in the launch file. :param str opt_binary: the full path of the binary. Used in case of multiple binaries in the same package. :param str opt_launch: full name of the launch file to use. Used in case the node with same name exists in more then one loaded launch file. :param str loglevel: log level :raise exceptions.StartException: on start errors :raise exceptions.BinarySelectionRequest: on multiple binaries :raise exceptions.LaunchSelectionRequest: on multiple launch files ''' response = self.lm_stub.GetStartCfg(lmsg.Node(name=name, opt_binary='', opt_launch=opt_launch, loglevel=loglevel, logformat=logformat, masteruri=masteruri, reload_global_param=reload_global_param), timeout=settings.GRPC_TIMEOUT) startcfg = None if response.status.code == 0: startcfg = StartConfig.from_msg(response.startcfg) elif response.status.code == ERROR: raise exceptions.StartException(response.status.error_msg) elif response.status.code == NODE_NOT_FOUND: raise exceptions.StartException(response.status.error_msg) elif response.status.code == MULTIPLE_LAUNCHES: raise exceptions.LaunchSelectionRequest([path for path in response.launch], response.status.error_msg) elif response.status.code == CONNECTION_ERROR: raise exceptions.ConnectionException(response.name, response.status.error_msg) return startcfg
def _gen_node_list(self, nodes): for name, opt_binary, opt_launch, loglevel, logformat, masteruri, reload_global_param, cmd_prefix in nodes: yield lmsg.Node(name=name, opt_binary=opt_binary, opt_launch=opt_launch, loglevel=loglevel, logformat=logformat, masteruri=masteruri, reload_global_param=reload_global_param, cmd_prefix=cmd_prefix)