launch.substitutions.string_join_substitution module

Module for the StringJoinSubstitution substitution.

class launch.substitutions.string_join_substitution.StringJoinSubstitution[source]

Bases: Substitution

Substitution that joins strings and/or other substitutions.

This takes in a list of string components as substitutions. The substitutions for each string component are performed and concatenated, and then all string components are joined with a specified delimiter as seperation.

For example:

StringJoinSubstitution(
    [['https', '://'], LaunchConfiguration('subdomain')], 'ros', 'org'],
    delimiter='.'
)

If the subdomain launch configuration was set to docs and the delimiter to ., this would result in a string equal to

'https://docs.ros.org'
__init__(substitutions: Iterable[str | Path | Substitution | Iterable[str | Path | Substitution]], delimiter: str | Path | Substitution | Iterable[str | Path | Substitution] = '') None[source]

Create a StringJoinSubstitution.

Parameters:
  • substitutions – the list of string component substitutions to join

  • delimiter – the text inbetween two consecutive components (default no text)

property delimiter: List[Substitution]

Getter for delimiter.

perform(context: LaunchContext) str[source]

Perform the substitution by retrieving the local variable.

property substitutions: List[List[Substitution]]

Getter for substitutions.