# Copyright chenyy 2026. Licensed under the MIT License.
# Launch file for armor_yolo_detect node
#
# Copyright (C) FYT Vision Group. All rights reserved.

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node


def generate_launch_description():
    return LaunchDescription([
        # Parameters
        DeclareLaunchArgument(
            'conf_threshold',
            default_value='0.65',
            description='Confidence threshold for detection'),

        DeclareLaunchArgument(
            'nms_threshold',
            default_value='0.45',
            description='NMS threshold for detection'),

        DeclareLaunchArgument(
            'detect_color',
            default_value='0',
            description='Detection color: 0=RED, 1=BLUE'),

        DeclareLaunchArgument(
            'debug',
            default_value='false',
            description='Enable debug mode'),

        # Armor YOLO Detector Node
        Node(
            package='armor_yolo_detect',
            executable='armor_yolo_detector_node',
            name='armor_yolo_detector',
            output='screen',
            parameters=[{
                'conf_threshold': LaunchConfiguration('conf_threshold'),
                'nms_threshold': LaunchConfiguration('nms_threshold'),
                'detect_color': LaunchConfiguration('detect_color'),
                'debug': LaunchConfiguration('debug'),
            }],
            remappings=[
                ('image_raw', '/hik_camera/image_raw'),
                ('camera_info', '/hik_camera/camera_info'),
            ],
        ),
    ])
