launch.launch_description_source module

Module for the LaunchDescriptionSource class.

class launch.launch_description_source.LaunchDescriptionSource[source]

Bases: object

Encapsulation of a launch description, where it comes from, and how it was generated.

__init__(launch_description: LaunchDescription | None = None, location: str | Substitution | Iterable[str | Substitution] = '<string>', method: str = 'unspecified mechanism from a script') None[source]

Create a LaunchDescriptionSource.

For example, loading a file called example.launch.py for inclusion might end up setting location to /path/to/example.launch.py and the method to be interpreted python launch file.

Parameters:
  • launch_description – the launch description that this source represents

  • location – the location from where this launch description was loaded if applicable

  • method – the method by which the launch description was generated

get_launch_description(context: LaunchContext) LaunchDescription[source]

Get the LaunchDescription, loading it if necessary.

property location: str

Get the location of the launch description source as a string.

The string is either a list of Substitution instances converted to strings or the expanded path if get_launch_description() has been called.

property method: str

Getter for self.__method.

try_get_launch_description_without_context() LaunchDescription | None[source]

Attempt to load the LaunchDescription without a context, return None if unsuccessful.

This method is useful for trying to introspect the included launch description without visiting the user of this source.