class ROSLaunchRunner(object):
Constructor: ROSLaunchRunner(run_id, config, server_uri, pmon, ...)
Runs a roslaunch. The normal sequence of API calls is L{launch()} followed by L{spin()}. An external thread can call L{stop()}; otherwise the runner will block until an exit signal. Another usage is to call L{launch()} followed by repeated calls to L{spin_once()}. This usage allows the main thread to continue to do work while processes are monitored.
Method | __init__ |
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. |
Method | add |
Add listener to list of listeners. Not threadsafe. Must be called before processes started. @param l: listener @type l: L{ProcessListener} |
Method | is |
Check for running node process. @param node Node: node object to check @return bool: True if process associated with node is running (launched && !dead) |
Method | launch |
Run the launch. Depending on usage, caller should call spin_once or spin as appropriate after launch(). @return ([str], [str]): tuple containing list of nodes that |
Method | launch |
Launch a single node locally. Remote launching is handled separately by the remote module. If node name is not assigned, one will be created for it. |
Method | run |
Run the test node. Blocks until completion or timeout. @param test: test node to run @type test: Test @raise RLTestTimeoutException: if test fails to launch or test times out |
Method | spin |
spin() must be run from the main thread. spin() is very important for roslaunch as it picks up jobs that the process monitor need to be run in the main thread. |
Method | spin |
Same as spin() but only does one cycle. must be run from the main thread. |
Method | stop |
Stop the launch and all associated processes. not thread-safe. |
Instance Variable | config |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | is |
Undocumented |
Instance Variable | listeners |
Undocumented |
Instance Variable | logger |
Undocumented |
Instance Variable | master |
Undocumented |
Instance Variable | num |
Undocumented |
Instance Variable | pm |
Undocumented |
Instance Variable | remote |
Undocumented |
Instance Variable | run |
Undocumented |
Instance Variable | server |
Undocumented |
Instance Variable | sigint |
Undocumented |
Instance Variable | sigterm |
Undocumented |
Instance Variable | timeout |
Undocumented |
Method | _check |
Initialize self.run_id to existing value or setup parameter server with /run_id set to default_run_id @param default_run_id: run_id to use if value is not set @type default_run_id: str @param param_server: parameter server proxy @type param_server: xmlrpclib... |
Method | _launch |
launch any core services that are not already running. master must be already running @raise RLException: if core launches fail |
Method | _launch |
Launch a single L{Executable} object. Blocks until executable finishes. @param e: Executable @type e: L{Executable} @raise RLException: if executable fails. Failure includes non-zero exit code. |
Method | _launch |
Launches master if requested. @return: True if a master was launched, False if a master was already running. @rtype: bool @raise RLException: if master launch fails |
Method | _launch |
Launch all the declared nodes/master @return: two lists of node names where the first is the nodes that successfully launched and the second is the nodes that failed to launch. @rtype: [[str], [str]] |
Method | _launch |
@raise RLException: if executable fails. Failure includes non-zero exit code. |
Method | _load |
Load parameters onto the parameter server |
Method | _setup |
Setup the state of the ROS network, including the parameter server state and core services |
- @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.
Add listener to list of listeners. Not threadsafe. Must be called before processes started. @param l: listener @type l: L{ProcessListener}
Check for running node process. @param node Node: node object to check @return bool: True if process associated with node is running (launched && !dead)
Run the launch. Depending on usage, caller should call spin_once or spin as appropriate after launch(). @return ([str], [str]): tuple containing list of nodes that
successfully launches and list of nodes that failed to launch
@rtype: ([str], [str]) @raise RLException: if launch fails (e.g. run_id parameter does not match ID on parameter server)
Launch a single node locally. Remote launching is handled separately by the remote module. If node name is not assigned, one will be created for it.
@param node Node: node to launch @param core bool: if True, core node @return obj, bool: Process handle, successful launch. If success, return actual Process instance. Otherwise return name.
Run the test node. Blocks until completion or timeout. @param test: test node to run @type test: Test @raise RLTestTimeoutException: if test fails to launch or test times out
spin() must be run from the main thread. spin() is very important for roslaunch as it picks up jobs that the process monitor need to be run in the main thread.
Initialize self.run_id to existing value or setup parameter server with /run_id set to default_run_id @param default_run_id: run_id to use if value is not set @type default_run_id: str @param param_server: parameter server proxy @type param_server: xmlrpclib.ServerProxy
launch any core services that are not already running. master must be already running @raise RLException: if core launches fail
Launch a single L{Executable} object. Blocks until executable finishes. @param e: Executable @type e: L{Executable} @raise RLException: if executable fails. Failure includes non-zero exit code.
Launches master if requested. @return: True if a master was launched, False if a master was already running. @rtype: bool @raise RLException: if master launch fails
Launch all the declared nodes/master @return: two lists of node names where the first is the nodes that successfully launched and the second is the nodes that failed to launch. @rtype: [[str], [str]]