Ask Your Question

Revision history [back]

It seems that a neater solution is on the way:

Once the PR changes are available upstream, you will be able to do something like:

import launch
from launch.actions import LogInfo, DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch.conditions import LaunchConfigurationEquals

def generate_launch_description():
    return launch.LaunchDescription([
        DeclareLaunchArgument('bag_version', default_value='v1'),
        LogInfo(msg='Version 1', condition=LaunchConfigurationEquals('bag_version', 'v1')),
        LogInfo(msg='Version 2', condition=LaunchConfigurationEquals('bag_version', 'v2'))

Before the LaunchConfigurationEquals condition is available I guess your best bet is to copy the condition locally:
and change the import once it becomes available upstream.

Or, to stick with the solution you have now.