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():
    # 假设配置文件路径，你需要根据实际情况修改
    config_path = os.path.join(
        get_package_share_directory('cyy_slamtoolbox'),
        'config',
        'angular_filter_example.yaml'
    )

    laser_filter_node = Node(
        package='laser_filters',
        executable='scan_to_scan_filter_chain',
        name='laser_filter',
        output='screen',
        parameters=[config_path],
        # 重新映射话题：从/base_scan原始数据过滤后发布到/scan
        remappings=[('scan', '/base_scan'), ('scan_filtered', '/scan')]
    )

    return LaunchDescription([laser_filter_node])