slam_toolbox:
  ros__parameters:

    # ============================ Solver 插件参数 ======================================
    solver_plugin: solver_plugins::CeresSolver
    ceres_linear_solver: SPARSE_NORMAL_CHOLESKY
    ceres_preconditioner: SCHUR_JACOBI
    ceres_trust_strategy: LEVENBERG_MARQUARDT
    ceres_dogleg_type: TRADITIONAL_DOGLEG
    ceres_loss_function: None

    # ============================ ROS 基础参数（实车）===================================
    odom_frame: odom_combined                   # 实车：EKF 融合后的里程计坐标系
    map_frame: map                             # 地图坐标系
    base_frame: base_footprint                 # 机器人基座坐标系（与 URDF 根帧一致）
    scan_topic: /scan                          # 激光雷达话题（实车镭神雷达）
    use_map_saver: true                        # 启用地图保存功能
    mode: mapping                              # mapping = 定位 + 实时建图

    # ============================ 已有地图加载 ==========================================
    # map_file_name: ""                        # 从零开始建图，留空
    map_start_pose: [0.0, 0.0, 0.0]           # 初始位姿 [x, y, yaw]

    # ============================ 调试与性能 ===========================================
    debug_logging: false
    throttle_scans: 1                          # 每 N 帧处理一次（实车每秒10帧左右）
    transform_publish_period: 0.02             # TF 发布周期（秒）
    map_update_interval: 3.0                   # /map 话题更新间隔（秒）
    resolution: 0.05                           # 地图分辨率（米/像素）
    restamp_tf: false
    min_laser_range: 0.15                      # 实车雷达盲区约 0.12m，设 0.15 过滤近处噪点
    max_laser_range: 12.0                      # 实车雷达最大有效距离（镭神 N10 ≈ 10-15m）
    minimum_time_interval: 0.3                 # 最小处理时间间隔（实车可适当放宽）
    transform_timeout: 0.2                     # TF 查找超时
    tf_buffer_duration: 30.0                   # TF 缓冲区时长
    stack_size_to_use: 40000000                # 栈大小（序列化大地图需要）
    enable_interactive_mode: true              # 交互模式：允许外部工具编辑地图

    # ============================ 通用建图参数 =========================================
    use_scan_matching: true
    use_scan_barycenter: true
    minimum_travel_distance: 0.3               # 实车最小移动距离（米），小于仿真以更频繁更新
    minimum_travel_heading: 0.3                # 最小转向角度（弧度）
    check_min_dist_and_heading_precisely: false
    scan_buffer_size: 10                       # 扫描缓冲区大小
    scan_buffer_maximum_scan_distance: 10.0
    link_match_minimum_response_fine: 0.1
    link_scan_maximum_distance: 1.5

    # ============================ 回环检测参数 =========================================
    do_loop_closing: true                      # 启用回环检测
    loop_match_minimum_chain_size: 10
    loop_match_maximum_variance_coarse: 3.0
    loop_match_minimum_response_coarse: 0.35
    loop_match_minimum_response_fine: 0.45
    loop_search_maximum_distance: 3.0

    # ============================ 相关性匹配参数 =======================================
    correlation_search_space_dimension: 0.5
    correlation_search_space_resolution: 0.01
    correlation_search_space_smear_deviation: 0.1

    loop_search_space_dimension: 8.0
    loop_search_space_resolution: 0.05
    loop_search_space_smear_deviation: 0.03

    # ============================ 扫描匹配器参数 ========================================
    distance_variance_penalty: 0.5
    angle_variance_penalty: 1.0

    fine_search_angle_offset: 0.00349
    coarse_search_angle_offset: 0.349
    coarse_angle_resolution: 0.0349
    minimum_angle_penalty: 0.9
    minimum_distance_penalty: 0.5
    use_response_expansion: true
    min_pass_through: 2
    occupancy_threshold: 0.1
