launch.launch_description module

Module for LaunchDescription class.

class launch.launch_description.LaunchDescription[source]

Bases: LaunchDescriptionEntity

Description of a launch-able system.

The description is expressed by a collection of entities which represent the system architect’s intentions.

The description may also have arguments, which are declared by launch.actions.DeclareLaunchArgument actions within this launch description.

Arguments for this description may be accessed via the get_launch_arguments() method. The arguments are gathered by searching through the entities in this launch description and the descriptions of each entity (which may include entities yielded by those entities).

__init__(initial_entities: Iterable[LaunchDescriptionEntity] | None = None, *, deprecated_reason: str | None = None) None[source]

Create a LaunchDescription.

add_action(action: Action) None[source]

Add an action to the LaunchDescription.

add_entity(entity: LaunchDescriptionEntity) None[source]

Add an entity to the LaunchDescription.

property deprecated: bool

Getter for deprecated.

property deprecated_reason: str | None

Getter for deprecated.

Returns None if the launch description is not deprecated.

describe_sub_entities() List[LaunchDescriptionEntity][source]

Override describe_sub_entities from LaunchDescriptionEntity to return sub entities.

property entities: List[LaunchDescriptionEntity]

Getter for the entities.

get_launch_arguments(conditional_inclusion=False) List[DeclareLaunchArgument][source]

Return a list of launch.actions.DeclareLaunchArgument actions.

See get_launch_arguments_with_include_launch_description_actions() for more details.

get_launch_arguments_with_include_launch_description_actions(conditional_inclusion=False) List[Tuple[DeclareLaunchArgument, List[IncludeLaunchDescription]]][source]

Return a list of launch arguments with its associated include launch descriptions actions.

The first element of the tuple is a declare launch argument action. The second is None if the argument was declared at the top level of this launch description, if not it’s a list with all the nested include launch description actions involved.

This list is generated (never cached) by searching through this launch description for any instances of the action that declares launch arguments.

It will use launch.LaunchDescriptionEntity.describe_sub_entities() and launch.LaunchDescriptionEntity.describe_conditional_sub_entities() in order to discover as many instances of the declare launch argument actions as is possible. Also, specifically in the case of the launch.actions.IncludeLaunchDescription action, the method launch.LaunchDescriptionSource.try_get_launch_description_without_context() is used to attempt to load launch descriptions without the “runtime” context available. This function may fail, e.g. if the path to the launch file to include uses the values of launch configurations that have not been set yet, and in that case the failure is ignored and the arguments defined in those launch files will not be seen either.

Duplicate declarations of an argument are ignored, therefore the default value and description from the first instance of the argument declaration is used.

visit(context: LaunchContext) List[LaunchDescriptionEntity] | None[source]

Override visit from LaunchDescriptionEntity to visit contained entities.