import os

from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node


def generate_launch_description():
    default_params_file = os.path.join(
        get_package_share_directory("qr_detection"),
        "config",
        "qr_dete_depth.yaml",
    )
    params_file = LaunchConfiguration("params_file")

    return LaunchDescription([
        DeclareLaunchArgument(
            "params_file",
            default_value=default_params_file,
            description="Path to qr_dete_depth parameter YAML file",
        ),
        Node(
            package="qr_detection",
            executable="qr_dete_depth",
            name="qr_dete_depth",
            output="screen",
            parameters=[params_file],
        ),
    ])
