#!/usr/bin/env python3
from launch import LaunchDescription
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
import os

def generate_launch_description():
    # 获取参数文件路径
    pkg_share = get_package_share_directory('cyy_slamtoolbox')
    params_file = os.path.join(pkg_share, 'config', 'mapper_params_localization.yaml')
    
    # 创建SLAM Toolbox节点
    slam_toolbox_node = Node(
        package='slam_toolbox',
        executable='localization_slam_toolbox_node',  # 或 sync_slam_toolbox_node
        name='slam_toolbox',
        output='screen',
        parameters=[params_file]
    )
    
    
    return LaunchDescription([
        slam_toolbox_node
    ])