[nav2_costmap_2d] 滚动窗口大小与代价地图大小不匹配。宽度:10,高度:10,滚动窗口宽度:20,滚动窗口高度:20
[nav2_costmap_2d] Rolling window size does not match costmap size. width: 10, height: 10, rolling_window_width: 20, rolling_window_height: 20
ID: ros2/nav2-costmap-rolling-window-size-mismatch
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| ROS2 Humble | active | — | — | — |
| Nav2 1.1.x | active | — | — | — |
| Nav2 1.2.x | active | — | — | — |
根因分析
Nav2 代价地图配置中的 rolling_window 参数指定的窗口大小大于代价地图的宽度/高度,导致代价地图无法正确初始化或更新。
English
The rolling_window parameter in the Nav2 costmap configuration specifies a window size larger than the costmap's width/height, causing the costmap to fail to initialize or update correctly.
官方文档
https://docs.nav2.org/configuration/packages/costmap-plugins/rolling.html解决方案
-
将 rolling_window_width 和 rolling_window_height 设置为与 YAML 配置文件中的代价地图宽度和高度匹配,例如 width: 10, height: 10, rolling_window_width: 10, rolling_window_height: 10
-
通过从 YAML 配置中删除 rolling_window 参数来禁用滚动窗口
无效尝试
常见但无效的做法:
-
70% 失败
The rolling_window must be equal to or smaller than the costmap dimensions; arbitrary changes may cause other issues like memory blowup.
-
85% 失败
Setting rolling_window to zero may disable the rolling window feature but can cause unexpected behavior or crashes in Nav2.
-
90% 失败
The costmap may not update obstacles correctly, leading to navigation failures or phantom obstacles.