def __init__(self, run_id, config, server_uri=None, pmon=None, is_core=False, remote_runner=None, is_child=False, is_rostest=False): """ @param run_id: /run_id for this launch. If the core is not running, this value will be used to initialize /run_id. If the core is already running, this value will be checked against the value stored on the core. L{ROSLaunchRunner} will fail during L{launch()} if they do not match. @type run_id: str @param config: roslauch instance to run @type config: L{ROSLaunchConfig} @param server_uri: XML-RPC URI of roslaunch server. @type server_uri: str @param pmon: optionally override the process monitor the runner uses for starting and tracking processes @type pmon: L{ProcessMonitor} @param is_core: if True, this runner is a roscore instance. This affects the error behavior if a master is already running -- aborts if is_core is True and a core is detected. @type is_core: bool @param remote_runner: remote roslaunch process runner @param is_rostest: if True, this runner is a rostest instance. This affects certain validation checks. @type is_rostest: bool """ if run_id is None: raise RLException("run_id is None") self.run_id = run_id # In the future we should can separate the notion of a core # config vs. the config being launched. In that way, we can # start to migrate to a model where a config is a parameter to # a launch() method, rather than a central thing to the # runner. self.config = config self.server_uri = server_uri self.is_child = is_child self.is_core = is_core self.is_rostest = is_rostest self.logger = logging.getLogger('roslaunch') self.pm = pmon or start_process_monitor() # wire in ProcessMonitor events to our listeners # aggregator. We similarly wire in the remote events when we # create the remote runner. self.listeners = _ROSLaunchListeners() if self.pm is None: raise RLException("unable to initialize roslaunch process monitor") if self.pm.is_shutdown: raise RLException("bad roslaunch process monitor initialization: process monitor is already dead") self.pm.add_process_listener(self.listeners) self.remote_runner = remote_runner
def __init__(self, run_id, server_uri=None, pmon=None, is_core=False, remote_runner=None): """ @param run_id: /run_id for this launch. If the core is not running, this value will be used to initialize /run_id. If the core is already running, this value will be checked against the value stored on the core. L{ROSLaunchRunner} will fail during L{launch()} if they do not match. @type run_id: str @param server_uri: XML-RPC URI of roslaunch server. @type server_uri: str @param pmon: optionally override the process monitor the runner uses for starting and tracking processes @type pmon: L{ProcessMonitor} @param is_core: if True, this runner is a roscore instance. This affects the error behavior if a master is already running -- aborts if is_core is True and a core is detected. @type is_core: bool @param remote_runner: remote roslaunch process runner """ if run_id is None: raise RLException("run_id is None") self.run_id = run_id self.server_uri = server_uri self.is_core = is_core self.logger = logging.getLogger('roslaunch') self.pm = pmon or start_process_monitor() # wire in ProcessMonitor events to our listeners # aggregator. We similarly wire in the remote events when we # create the remote runner. self.listeners = _ROSLaunchListeners() if self.pm is None: raise RLException("unable to initialize roslaunch process monitor") if self.pm.is_shutdown: raise RLException("bad roslaunch process monitor initialization: process monitor is already dead") self.pm.add_process_listener(self.listeners) self.remote_runner = remote_runner
def __init__(self, run_id, config, server_uri=None, pmon=None, is_core=False, remote_runner=None, is_child=False, is_rostest=False, num_workers=NUM_WORKERS, timeout=None, master_logger_level=False, sigint_timeout=DEFAULT_TIMEOUT_SIGINT, sigterm_timeout=DEFAULT_TIMEOUT_SIGTERM): """ @param run_id: /run_id for this launch. If the core is not running, this value will be used to initialize /run_id. If the core is already running, this value will be checked against the value stored on the core. L{ROSLaunchRunner} will fail during L{launch()} if they do not match. @type run_id: str @param config: roslauch instance to run @type config: L{ROSLaunchConfig} @param server_uri: XML-RPC URI of roslaunch server. @type server_uri: str @param pmon: optionally override the process monitor the runner uses for starting and tracking processes @type pmon: L{ProcessMonitor} @param is_core: if True, this runner is a roscore instance. This affects the error behavior if a master is already running -- aborts if is_core is True and a core is detected. @type is_core: bool @param remote_runner: remote roslaunch process runner @param is_rostest: if True, this runner is a rostest instance. This affects certain validation checks. @type is_rostest: bool @param num_workers: If this is the core, the number of worker-threads to use. @type num_workers: int @param timeout: If this is the core, the socket-timeout to use. @type timeout: Float or None @param master_logger_level: Specify roscore's rosmaster.master logger level, use default if it is False. @type master_logger_level: str or False @param sigint_timeout: The SIGINT timeout used when killing nodes (in seconds). @type sigint_timeout: float @param sigterm_timeout: The SIGTERM timeout used when killing nodes if SIGINT does not stop the node (in seconds). @type sigterm_timeout: float @raise RLException: If sigint_timeout or sigterm_timeout are nonpositive. """ if run_id is None: raise RLException("run_id is None") if sigint_timeout <= 0: raise RLException( "sigint_timeout must be a positive number, received %f" % sigint_timeout) if sigterm_timeout <= 0: raise RLException( "sigterm_timeout must be a positive number, received %f" % sigterm_timeout) self.run_id = run_id # In the future we should can separate the notion of a core # config vs. the config being launched. In that way, we can # start to migrate to a model where a config is a parameter to # a launch() method, rather than a central thing to the # runner. self.config = config self.server_uri = server_uri self.is_child = is_child self.is_core = is_core self.is_rostest = is_rostest self.num_workers = num_workers self.timeout = timeout self.master_logger_level = master_logger_level self.logger = logging.getLogger('roslaunch') self.pm = pmon or start_process_monitor() self.sigint_timeout = sigint_timeout self.sigterm_timeout = sigterm_timeout # wire in ProcessMonitor events to our listeners # aggregator. We similarly wire in the remote events when we # create the remote runner. self.listeners = _ROSLaunchListeners() if self.pm is None: raise RLException("unable to initialize roslaunch process monitor") if self.pm.is_shutdown: raise RLException( "bad roslaunch process monitor initialization: process monitor is already dead" ) self.pm.add_process_listener(self.listeners) self.remote_runner = remote_runner