roslaunch2 package¶
Submodules¶
roslaunch2.environment module¶
-
class
roslaunch2.environment.
EnvironmentVariable
(name, value)[source]¶ Bases:
roslaunch2.interfaces.GeneratorBase
,roslaunch2.interfaces.Composable
Represents an environment variable (<env> tag in roslaunch), see http://wiki.ros.org/roslaunch/XML/env This class cannot be used inside a Machine object (deprecated since ROS Fuerte). However, you can use this class to create remote env. variables by setting the “value” to an resolvable object, see remote.py. Also note that env. variables are being propagated to nodes if they are added to Groups or Launch objects, see Composer.add_env_variables_to_nodes() for more information. For instance: root += EnvironmentVariable(‘ROSCONSOLE_CONFIG_FILE’, Path(‘/config/rosconsole.cfg’, pkg)) (assuming “root” is a “Launch” object), would cause the env. variable to be added to all nodes started afterwards. If one of these nodes is started on system A, and another one is launched on system B, the env. variable will be resolved remotely on theses systems A and B respectively (given the “pkg” where the path relates to).
-
generate
(root, starting_machine, pkg)[source]¶ Generates the underlying roslaunch XML code.
Parameters: - root – XML root element object
- starting_machine – May be set to a machine.Machine object where the environment variable should be resolved on
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
Returns: None
-
roslaunch2.group module¶
-
class
roslaunch2.group.
Group
(namespace, ignore_content=False, clear_params=None)[source]¶ Bases:
roslaunch2.remapable.Remapable
,roslaunch2.interfaces.Composer
,roslaunch2.interfaces.Composable
For grouping nodes in namespaces, equals <group ns=”namespace”> ... </group>.
-
generate
(root, machines, pkg)[source]¶ Generates the underlying roslaunch XML code.
Parameters: - root – XML root element object
- machines – list of machines currently known in the launch module (may still contain duplicates)
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
-
start_on
(machine_object)[source]¶ Allows to start all nodes added to this group to be launched on the given machine. However, if a node has already been assigned a specific machine object, the given machine_object is ignored for that node.
Parameters: machine_object – Machine object to be used for launching remotely; a roslaunch2_server needs to be running on that machine
-
roslaunch2.interfaces module¶
-
class
roslaunch2.interfaces.
Composable
[source]¶ Bases:
object
Represents the interface for objects of classes that can be added to Composer instances. They remember if they have already been added to show a warning about created but unused objects. An example is the ServerParameter class which cannot contain any other core type of the roslaunch2 hierarchy.
-
class
roslaunch2.interfaces.
Composer
(valid_types)[source]¶ Bases:
object
Represents the interface for objects of classes allowing to contain other objects. An example is the Node class which can contain Parameter objects.
-
add
(other)[source]¶ Allows to compose objects of type Composable by adding them to this internal list. This is used to create a hierarchy of objects. For example, a Launch object can contain a Group. Both are Composer objects. It throws an assertion if you try to add objects that are not allowed (can be defined in the constructor).
Note that objects are deep-copied so that they can be altered after adding them without chaning the added object.
Parameters: other – Object to be added to this composer Returns: None
-
add_env_variables_to_nodes
(environment_variable_dict=None)[source]¶ Traverses the whole tree of this composer object and searches for instances of environment.EnvironmentVariable. Copy each EnvironmentVariable to all subsequent node.Node instances that has not defined it on their own.
Parameters: environment_variable_dict – Dictionary of instances of environment.EnvironmentVariable that are valid for composer (dictionary keys are the environment variable names)
-
-
class
roslaunch2.interfaces.
GeneratorBase
[source]¶ Bases:
object
Represents the interface for classes that can generate its XML representation for roslaunch. You need to implement the generate() method for this to work.
-
generate
(root, machines, pkg)[source]¶ Generates a roslaunch compatible XML representation of this object. This method is automatically invoked by the roslaunch2 tool, There’s no need for you to call it manually.
Returns: the return value can be used arbitrarily (for an example, see node.Runnable); however, finally, a string (see Launch impl.) must be returned which is the XML representation of the roslaunch file
-
static
to_attr
(elem, name, value, expected_type=None)[source]¶ Creates an XML-based element from the given attribute name and assigned the given value (i. e. <foo name=”value”/>). Optionally verifies value against the expected_type if not None. No attribute is create if the value is None in order to use roslaunch’ default.
Parameters: - elem – XML element where the attribute should be set
- name – Name of attribute
- value – Value of attribute
- expected_type – Expected type that value should have (None to disable this check, e. g., where the type is not known a priori)
Returns: None
-
roslaunch2.launch module¶
-
class
roslaunch2.launch.
Launch
(deprecation_message=None)[source]¶ Bases:
roslaunch2.interfaces.Composable
,roslaunch2.interfaces.Composer
,roslaunch2.remapable.Remapable
Represents the root object of a launch module, similiar to roslaunch’s <launch> tag.
-
add
(other)[source]¶ Allows to add other objects of type Launch, Group, Node, Test, etc. to the launch module.
Parameters: other – Object to be added Returns: None
-
generate
(root=None, machines=None, pkg=None)[source]¶ Generates the underlying roslaunch XML code.
Parameters: - root – XML root element object
- machines – list of machines currently known in the launch module (may still contain duplicates)
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
Returns: string representation in UTF-8 encoding containing the generated XML code if generate() was called on the top level (i. e., the Launch object was not nested as a part of anther launch module; in such cases None is returned)
-
start_on
(machine_object)[source]¶ Allows to start all nodes added to this launch object to be launched on the given machine. However, if a node has already been assigned a specific machine object, the given machine_object is ignored for that node. Also, groups with their own machine object will precede machine_object.
Parameters: machine_object – Machine object to be used for launching remotely; a roslaunch2_server needs to be running on that machine Returns: None
-
roslaunch2.logger module¶
-
roslaunch2.logger.
critical
(args, exit_code=1)[source]¶ Print a critical error message. After such errors, the script exits with the given code.
Parameters: - args – data to be printed
- exit_code – code to be used when exiting the program
-
roslaunch2.logger.
error
(args)[source]¶ Print an error, added for completeness.
Parameters: args – data to be printed
-
roslaunch2.logger.
init_logger
(want_colors=True)[source]¶ Initialize the logging system.
Parameters: want_colors – True to allow colored output, False to disable it
roslaunch2.machine module¶
-
class
roslaunch2.machine.
Machine
(address, user, env_loader=None, name=None, password=None, timeout=None)[source]¶ Bases:
roslaunch2.interfaces.GeneratorBase
For defining (remote) machines to launch on, equals the <machine> tag.
-
static
cleanup
()[source]¶ Cleans up all env-loader script files generated remotely during the launch.
-
generate
(root, machines, pkg)[source]¶ Appends the underlying roslaunch XML code to the given root object.
Parameters: - root – XML root element object
- machines – list of machines currently known in the launch module (may still contain duplicates)
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
-
name
()[source]¶ Return the set machine name (self.__name) if set or generate name as hash of all relevant members.
Returns: Machine name as string
-
remote
(object_name=None)[source]¶ Allows one to remote execute a method on the given machine. For instance, m.remote().cpu_count() retrieves the number of CPUs on the machine “m”.
Parameters: object_name – Pyro-exposed fully-qualified class instance name; can be empty to default to the roslaunch2 API (roslaunch2.remote.API) Returns: Object instance that allows to run methods locally or remotely depending on self
-
resolve
(what)[source]¶ Resolves the given object on the machine (convenience function).
Parameters: what – Object adhering to the remote.Resolvable interface Returns: Resolved data
-
static
resolve_if
(what, machine_obj, pkg)[source]¶ Tries to resolve “what” on the given “machine_obj”, possibly relating to “pkg”
Parameters: - what – Data sleeve to be resolved (should adhere to remote.Resolvable)
- machine_obj – Object of machine.Machine to be used for resolving
- pkg – ROS package instance
Returns: Resolved data or “what” (unchanged) if not resolvable
-
static
-
class
roslaunch2.machine.
MachinePool
(select_strategy=<Strategy.LeastLoadAverage: 1>, *args)[source]¶ Bases:
list
Represents a set of machines to choose from when a new ROS node should be started based on a configurable criterion.
-
class
Strategy
[source]¶ Bases:
enum.IntEnum
-
LeastLoadAverage
= <Strategy.LeastLoadAverage: 1>¶
-
LeastMemoryUsage
= <Strategy.LeastMemoryUsage: 2>¶
-
-
MachinePool.
by_address
(address)[source]¶ Returns the machine with the given address.
Parameters: address – User name to query Returns: machine.Machine object or None if nothing was found
-
MachinePool.
by_user
(user)[source]¶ Returns the machine with the given user name.
Parameters: user – User name to query Returns: machine.Machine object or None if nothing was found
-
MachinePool.
select
()[source]¶ Selects a machine for starting a node based on the current strategy. Note that this just considers the load on the machines in the pool when none of the nodes has actually been started (roslaunch XML generation step).
Returns: current optimal Machine object selected for execution
-
class
roslaunch2.node module¶
-
class
roslaunch2.node.
Node
(pkg, node_type=None, name=None, output=<Output.Screen: 1>, args=None)[source]¶ Bases:
roslaunch2.node.Runnable
For starting ROS nodes, equals <node>, see http://wiki.ros.org/roslaunch/XML/node
-
generate
(root, machines, pkg)[source]¶ Appends the underlying roslaunch XML code to the given root object.
Parameters: - root – XML root element object
- machines – list of machines currently known in the launch module (may still contain duplicates)
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
-
required
¶ Retrieves the required flag. :return: True if node is required, False otherwise
-
respawn
¶ Retrieves the respawn flag. :return: True if node is respawn when it terminates, False otherwise
-
-
class
roslaunch2.node.
Output
[source]¶ Bases:
enum.IntEnum
Possible output targets for ROS logging commands (e. g., ROS_INFO()).
-
Log
= <Output.Log: 2>¶
-
Screen
= <Output.Screen: 1>¶
-
-
class
roslaunch2.node.
Runnable
(tag_name, pkg, node_type=None, name=None, args=None)[source]¶ Bases:
roslaunch2.remapable.Remapable
,roslaunch2.interfaces.Composable
,roslaunch2.interfaces.Composer
Encapsulates the common attributes and methods of a <node> and <test> tag/class (internal base class).
-
add
(param)[source]¶ Adds the parameter to the node’s parameter set.
Parameters: param – New parameter, can be any object derived from parameter.Parameter
-
clear_params
(clear=None)[source]¶ Sets the clear_params flag as provided by roslaunch, see, e. g., http://wiki.ros.org/roslaunch/XML/node :param clear: True to clear all parameter before the node is started
-
debug
(separate_window=True, auto_run=True)[source]¶ Adds a gdb debug prefix to this node. See http://wiki.ros.org/roslaunch/Tutorials/Roslaunch%20Nodes%20in%20Valgrind%20or%20GDB
Parameters: - separate_window – True to launch the node in a separate window using xterm
- auto_run – True to automatically start the node within gdb (otherwise, type “run” and press enter”)
-
generate
(root, machines, pkg)[source]¶ Appends the underlying roslaunch XML code to the given root object.
Parameters: - root – XML root element object
- machines – list of machines currently known in the launch module (may still contain duplicates)
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
-
node
¶ Node type (aka executable name).
Returns: String representing the node’s type
-
pkg
¶ Returns the associated package.
Returns: roslaunch2.package.Package instance
-
roslaunch2.package module¶
-
class
roslaunch2.package.
Package
(name=None, silent=False)[source]¶ Encapsulates a ROS package and its ability to find files in the package directory structure. A caching mechanism is used to speedup *find() commands.
-
find
(path_comp, silent=False)[source]¶ Searches for a file or directory in the current package (self).
Parameters: - path_comp – (partial) path or file name
- silent – if True return None when nothing is found, otherwise an IOError is raised in case of failure
Returns: first found file (full path) or None if silent==True and nothing found
-
static
get_paths_to_file
(start_dir, file_comp)[source]¶ Searches for file_comp in start_dir recursively (also using a cache for speedup).
Parameters: - start_dir – root directory where to start the search
- file_comp – file path component (like some/dir/myfile.xml) name to search for
Returns: Set of files found (with their full path)
-
has_node
(node_name, warn=True)[source]¶ Tests if a ROS node actually exists.
This method checks whether a ROS node named $node_name exists in the current ROS package.
Parameters: - node_name – name of ROS node to test
- warn – True if a warning about the missing node should be emitted
Returns: True if node exists, False otherwise
-
static
import_launch_module
(full_module_path)[source]¶ Rather internal helper function for important a Python module (i. e., a roslaunch2 launch module/file). This function handles all various cases related to different versions of Python.
Parameters: full_module_path – Full path to module file Returns: Handle to imported module (like “foo” in “import bar as foo”)
-
static
include
(pkg_name, path_comp, **kwargs)[source]¶ Like use() but static for convenience.
Parameters: - pkg_name – Name of ROS package to be used for search of path_comp
- path_comp – (partial) path or file name to launch module (if it does not end with .pyl, this is added automatically)
- kwargs – optional arguments to be passed to the main() function of the launch module
Returns: GeneratorBase object as returned by the main() function
-
static
invalidate_cache
()[source]¶ Invalidates the package, directory and file cache for finding packages, enforcing re-lookups.
-
name
¶ Returns the package name.
Returns: ROS package name
-
path
¶ Retrieves the package path.
Returns: ROS package path
-
selective_find
(path_comp_options, path_comp_prefix='', silent=False)[source]¶ Searches for a set of files or directories in the current package (self). Tries to find any path from the path_comp_options list starting at the first element. Once a path is found the search for the remaining paths is canceled and the found path is returned.
Parameters: - path_comp_options – list of (partial) path or file names
- path_comp_prefix – prefix to each element of path_comp_options
- silent – if True return None when nothing is found, otherwise an IOError is raised in case of failure
Returns: first found file (full path) or None if silent==True and nothing found
-
use
(path_comp, **kwargs)[source]¶ Imports (aka uses) the content of a launch module located in the current package (self).
Parameters: - path_comp – (partial) path or file name to launch module (if it does not end with .pyl, this is added automatically)
- kwargs – optional arguments to be passed to the main() function of the launch module
Returns: GeneratorBase object as returned by the main() function
-
roslaunch2.parameter module¶
-
class
roslaunch2.parameter.
FileCommand
[source]¶ Bases:
enum.IntEnum
Defines file operations / commands to be used with
FileParameter
. This allows, e. g., to load a set of parameters from a given .yaml file.-
Delete
= <FileCommand.Delete: 3>¶
-
Dump
= <FileCommand.Dump: 2>¶
-
Load
= <FileCommand.Load: 1>¶
-
-
class
roslaunch2.parameter.
FileParameter
(value=None, command=None, file_path=None, param=None, ns=None)[source]¶ Bases:
roslaunch2.parameter.Parameter
Used for loading, dumping or deleting YAML files to/from the ROS parameter server. Equals the
<rosparam>
tag.-
generate
(root, starting_machine, pkg)[source]¶ Appends the underlying roslaunch XML code to the given root object.
Parameters: - root – XML root element object
- machines – list of machines currently known in the launch module (may still contain duplicates)
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
-
-
class
roslaunch2.parameter.
LaunchParameter
(prog=None, description=None, epilog=None, version=None, parents=None, formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='resolve')[source]¶ Bases:
argparse.ArgumentParser
Represents a parameter for a launch module. For example, this can influence whether to select simulator A or B. These parameters are NOT consumed by ROS nodes (refer to
ServerParameter
andFileParameter
in such cases).-
add
(name, help_text, default, short_name=None, **kwargs)[source]¶ Generates a command line option for the current launch module named
--name
with the givenhelp_text
. Additionally, the default value is retrieved fromkwargs[name]
if that key exists. If not, the provided default value is set. This way, command line options have the highest precedence, followed by parameters passed by the kwargs parameter of a launch module’smain()
function. If neither of which are set, the provided default value is set.Parameters: - name – command line parameter name and key to retrieve (fallback) default in kwargs
- help_text – help text of command line option
- default – final default value if neither a command line argument nor the key in kwargs is given
- short_name – Optional string: Short command line parameter name
- kwargs – dictionary of parameters for the launch module, possibly containing name
Returns: None
-
add_flag
(name, help_text, default, store, short_name=None, **kwargs)[source]¶ Generates a command line flag for the current launch module named
--name
with the givenhelp_text
. Additionally, the default value is retrieved fromkwargs[name]
if that key exists. If not, the provided default value is set. This way, command line flags have the highest precedence, followed by parameters passed by the kwargs parameter of a launch module’smain()
function. If neither of which are set, the provided default value is set.Parameters: - name – command line parameter name and key to retrieve (fallback) default in kwargs
- help_text – help text of command line option
- default – final default value if neither a command line argument nor the key in kwargs is given
- store –
True
to storeTrue
of the flag is set / provided on the command line,False
to storeFalse
if the flag is provided - short_name – Optional string: Short command line parameter name
- kwargs – dictionary of parameters for the launch module, possibly containing name
-
add_parameter_file
(name, path, only_parse_known_args=False)[source]¶ Generates a command line option named –name that loads parameters from a yaml file given by ‘path/value.yaml’ where value is the actual command line value of
--name
.Parameters: - name – Name of the command line option
- path – Path of the .yaml file
- only_parse_known_args – If True unknown arguments from yaml file are ignored otherwise parsing fails with unknown arguments in yaml file
-
get_args
()[source]¶ Parse the previously defined command line arguments using
add()
oradd_argument()
. Ignores unknown arguments. Parameters are always parsed fromsys.argv
and may overlap with parameters from other (used / included) launch modules and/or with arguments of roslaunch.Returns: detected / known arguments. If an argument is named --name
, thenargs.name
contains the value wherebyargs
is the value returned by this method
-
launch_parameter_list
= []¶
-
-
class
roslaunch2.parameter.
Parameter
[source]¶ Bases:
roslaunch2.interfaces.GeneratorBase
,roslaunch2.interfaces.Composable
Base class for ROS node parameters.
-
class
roslaunch2.parameter.
ServerParameter
(name, value, textfile=None, binfile=None, command=None)[source]¶ Bases:
roslaunch2.parameter.Parameter
For setting parameters on the ROS parameter server. Equals the
<param>
tag.-
generate
(root, starting_machine, pkg)[source]¶ Appends the underlying roslaunch XML code to the given root object.
Parameters: - root – XML root element object
- machines – list of machines currently known in the launch module (may still contain duplicates)
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
-
static
set
(name, default, **kwargs)[source]¶ Convenience method for setting a server parameter with an optional default, possibly extracting it from the provided dictionary kwargs.
Parameters: - name – Name of parameter
- default – Default value for the parameter
- kwargs – additional arguments; if kwargs[name] exists, that value is used (otherwise, “default” is used)
Returns: parameter.ServerParameter instance
-
-
roslaunch2.parameter.
load_from_file
(path, only_parse_known_args)[source]¶ Loads parameters from the given YAML file.
Parameters: - path – Prefix to given file name argument
- only_parse_known_args – If True unknown arguments from yaml file are ignored, otherwise parsing fails with unknown arguments in yaml file
roslaunch2.remapable module¶
-
class
roslaunch2.remapable.
Remapable
[source]¶ Bases:
roslaunch2.interfaces.GeneratorBase
Represents the capability of being <remap>able.
-
generate
(root, machines, pkg)[source]¶ Appends the underlying roslaunch XML code to the given root object.
Parameters: - root – XML root element object
- machines – list of machines currently known in the launch module (may still contain duplicates)
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
-
roslaunch2.test module¶
-
class
roslaunch2.test.
Test
(pkg, node_type, test_name, args=None, name=None)[source]¶ Bases:
roslaunch2.node.Runnable
For starting ROS nodes as tests (see rostest), equals <test>.
-
generate
(root, machines, pkg)[source]¶ Appends the underlying roslaunch XML code to the given root object.
Parameters: - root – XML root element object
- machines – list of machines currently known in the launch module (may still contain duplicates)
- pkg – Package object, if none (else None); this is used / required on lower levels of the generation (see, e. g., ServerParameter.generate())
-
roslaunch2.utils module¶
-
class
roslaunch2.utils.
Observable
[source]¶ Bases:
object
Allows to create observable events (like the termination of roslaunch) to register custom actions in case such events are being triggered.
-
fire
()[source]¶ Triggers the event (typically only used by the enitity defining the event, i. e., roslaunch2 here).
-
subscribe
(callback, **kwargs)[source]¶ Allows to register a custom action to be executed if the associated event (= object of this class) fires.
Parameters: - callback – Python function to be executed (“callback”) when the event is being triggered
- kwargs – Optional additional parameters for the callback, may be None / ignored
-
-
roslaunch2.utils.
ROS_NAME_SEP
= '/'¶ Separator for communication (topic, services) and tf (frame) names
-
roslaunch2.utils.
anon
(length=6)[source]¶ Creates random ROS names.
Generates a random ROS name (see also http://wiki.ros.org/Names). Clearly, the longer the name, the smaller the probability of a name collision.
Parameters: length – number of characters in the generated name Returns: random name with [A-Z,a-z,0-9]
-
roslaunch2.utils.
clean_name
(ros_name, c='/')[source]¶ Removes successive duplicates of c from the given ros_name.
Parameters: - ros_name – Name (string) to process
- c – character whose successive occurrences should be removed
Returns: processed string (or unchanged ros_name if nothing needs to be done)
-
roslaunch2.utils.
merge_dicts
(x, y)[source]¶ Given two dicts, merge them into a new dict as a shallow copy. Values in y that are also already present in x will overwrite them. This is supplied to be compatible with Python 2.x, see also http://stackoverflow.com/questions/38987/how-to-merge-two-python-dictionaries-in-a-single-expression
Parameters: - x – first dict to merge
- y – second dict to merge
Returns: merged dictionary
-
roslaunch2.utils.
ros_join
(left, right, force_global=False)[source]¶ Behaves much like tf_join but is intended to work on ROS names (like topics, services, namespaces). Allows to force the creation of a global name.
Parameters: - left – partial name to put leftmost
- right – partial name to put rightmost, can also be a list of names
- force_global – True to ensure / force the resulting name to be in the global namespace (not advised, but useful/required in rare cases). If left is already global, the resulting name remains global.
Returns: combined ROS name
-
roslaunch2.utils.
silent_remove
(path)[source]¶ Remove the file given by path and do not fail if the file does not exist.
Parameters: path – path to file which should be deleted silently Returns: Returns True if the file was removed, False otherwise.
-
roslaunch2.utils.
tf_join
(left, right)[source]¶ Combines the partial frame IDs left and right to a new combined valid frame IDs. According to tf2 design, preceding slashes will be stripped.
Parameters: - left – partial frame ID to put leftmost (e. g., a parent frame ID)
- right – partial frame ID to put rightmost (e. g., a child frame ID)
Returns: combined frame ID (e. g., “parent1/child0”)
roslaunch2.remote module¶
-
class
roslaunch2.remote.
API
[source]¶ Provides an API that can be used locally and remotely (via the PyRO backend) on other robots / machines. For example, it can be used to query the value of a remote environment variable or the number of CPU cores.
-
static
env
(name, optional=True)[source]¶ Determines the current value of the environment variable.
Parameters: - name – Name of environment variable whose value should be queried
- optional – If True (default, None is returned if the variable does not exist; else, an exception is raised
Returns: Value of env. variable or None if not existing and optional=True
-
static
-
class
roslaunch2.remote.
Resolvable
(data)[source]¶ Bases:
object
Represents the interface for data that is just given as a “shell” or “sleeve” and still needs to be filled with the correct information of the target (remote) system. The latter process is denoted as resolving the data.
-
resolve
(address, user, local_only)[source]¶ Retrieves the actual data from the given remote system. (It may also simply be the current local host).
Parameters: - address – IP address of the (remote) system to query
- user – User name required to contact the correct roslaunch2 server instance
- local_only – True do resolve locally (equals a normal Python method call), False to query remotely
Returns: Resolved value of data of interest
-
-
class
roslaunch2.remote.
Path
(path, pkg=None)[source]¶ Bases:
roslaunch2.remote.Resolvable
Represents a (ROS package) path of a local or remote system. For example, if a node may be executed on another machine (depending on some condition) and that machine may be selected “dynamically” on some other condition, a path must be resolved when the final machine is known. This process is encapsulated in this class.
-
resolve
(address, user, local_only)[source]¶ Resolves the path.
Parameters: - address – IP address of the (remote) system to query
- user – User name required to contact the correct roslaunch2 server instance
- local_only – True do resolve locally (equals a normal Python method call), False to query remotely
Returns: Resolved path
-
-
class
roslaunch2.remote.
Variable
(name)[source]¶ Bases:
roslaunch2.remote.Resolvable
Represents an environment variable that is resolved on the localhost or remotely, depending on where the information is needed.
-
resolve
(address, user, local_only)[source]¶ Resolves the environment variable.
Parameters: - address – IP address of the (remote) system to query
- user – User name required to contact the correct roslaunch2 server instance
- local_only – True do resolve locally (equals a normal Python method call), False to query remotely
Returns: Resolved environment variable
-
Module contents¶
-
roslaunch2.
main
(command_line_args=None)¶ Defines the core logic (= Python based dynamic launch files) of roslaunch2. It does NOT create any launch modules or the like.
Parameters: command_line_args – List with command line arguments as strings Returns: None
-
roslaunch2.
start
(launch_obj, dry_run=False, silent=False)¶ Generates a temporary roslaunch XML file from the given roslaunch2 Launch instance and passes it over to roslaunch. Returns after roslaunch has terminated and temporary files have been removed.
Parameters: - launch_obj – Instance of class launch.Launch
- dry_run – If Only print generated XML (default: False)
- silent – Hide roslaunch output
-
roslaunch2.
start_async
(launch_obj, silent=False)¶ Call method start() in a separate process and returns without waiting for roslaunch to terminate. If p is the returned object, call p.terminate() to shutdown roslaunch and p.join() to wait until roslaunch has terminated.
Parameters: - launch_obj – Instance of class launch.Launch
- silent – Hide roslaunch output
Returns: Instance of class multiprocessing.Process