"""aruco_detect.launch.py — ArUco marker detection for docking (Issue #627)."""

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():
    pkg_share = get_package_share_directory('saltybot_aruco_detect')
    default_params = os.path.join(pkg_share, 'config', 'aruco_detect_params.yaml')

    params_arg = DeclareLaunchArgument(
        'params_file',
        default_value=default_params,
        description='Path to aruco_detect_params.yaml',
    )

    aruco_node = Node(
        package='saltybot_aruco_detect',
        executable='aruco_detect',
        name='aruco_detect',
        output='screen',
        parameters=[LaunchConfiguration('params_file')],
    )

    return LaunchDescription([params_arg, aruco_node])
