# [nav2_costmap_2d] 滚动窗口大小与代价地图大小不匹配。宽度：10，高度：10，滚动窗口宽度：20，滚动窗口高度：20

- **ID:** `ros2/nav2-costmap-rolling-window-size-mismatch`
- **领域:** ros2
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

Nav2 代价地图配置中的 rolling_window 参数指定的窗口大小大于代价地图的宽度/高度，导致代价地图无法正确初始化或更新。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| ROS2 Humble | active | — | — |
| Nav2 1.1.x | active | — | — |
| Nav2 1.2.x | active | — | — |

## 解决方案

1. ```
   将 rolling_window_width 和 rolling_window_height 设置为与 YAML 配置文件中的代价地图宽度和高度匹配，例如 width: 10, height: 10, rolling_window_width: 10, rolling_window_height: 10
   ```
2. ```
   通过从 YAML 配置中删除 rolling_window 参数来禁用滚动窗口
   ```

## 无效尝试

- **** — The rolling_window must be equal to or smaller than the costmap dimensions; arbitrary changes may cause other issues like memory blowup. (70% 失败率)
- **** — Setting rolling_window to zero may disable the rolling window feature but can cause unexpected behavior or crashes in Nav2. (85% 失败率)
- **** — The costmap may not update obstacles correctly, leading to navigation failures or phantom obstacles. (90% 失败率)
