Package roslaunch :: Module launch :: Class ROSLaunchRunner
[frames] | no frames]

Class ROSLaunchRunner

source code

object --+
         |
        ROSLaunchRunner

Runs a roslaunch. The normal sequence of API calls is launch() followed by spin(). An external thread can call stop(); otherwise the runner will block until an exit signal. Another usage is to call launch() followed by repeated calls to spin_once(). This usage allows the main thread to continue to do work while processes are monitored.

Instance Methods
 
__init__(self, run_id, config, server_uri=None, pmon=None, is_core=False, remote_runner=None, is_child=False, is_rostest=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
add_process_listener(self, l)
Add listener to list of listeners.
source code
 
launch_node(self, node, core=False)
Launch a single node locally.
source code
 
is_node_running(self, node)
Check for running node process.
source code
 
spin_once(self)
Same as spin() but only does one cycle.
source code
 
spin(self)
spin() must be run from the main thread.
source code
 
stop(self)
Stop the launch and all associated processes.
source code
([str], [str])
launch(self)
Run the launch.
source code
 
run_test(self, test)
Run the test node.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, run_id, config, server_uri=None, pmon=None, is_core=False, remote_runner=None, is_child=False, is_rostest=False)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • run_id (str) - /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. ROSLaunchRunner will fail during launch() if they do not match.
  • config (ROSLaunchConfig) - roslauch instance to run
  • server_uri (str) - XML-RPC URI of roslaunch server.
  • pmon (ProcessMonitor) - optionally override the process monitor the runner uses for starting and tracking processes
  • is_core (bool) - 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.
  • remote_runner - remote roslaunch process runner
  • is_rostest (bool) - if True, this runner is a rostest instance. This affects certain validation checks.
Overrides: object.__init__

add_process_listener(self, l)

source code 

Add listener to list of listeners. Not threadsafe. Must be called before processes started.

Parameters:

launch_node(self, node, core=False)

source code 

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.

Parameters:
  • node, Node - node to launch
  • core, bool - if True, core node

is_node_running(self, node)

source code 

Check for running node process.

Parameters:
  • node, Node - node object to check

spin_once(self)

source code 

Same as spin() but only does one cycle. must be run from the main thread.

spin(self)

source code 

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.

stop(self)

source code 

Stop the launch and all associated processes. not thread-safe.

launch(self)

source code 

Run the launch. Depending on usage, caller should call spin_once or spin as appropriate after launch().

Returns: ([str], [str])
Raises:
  • RLException - if launch fails (e.g. run_id parameter does not match ID on parameter server)

run_test(self, test)

source code 

Run the test node. Blocks until completion or timeout.

Parameters:
  • test (Test) - test node to run
Raises: