NAV2_COSTMAP_ROLLING_001 ros2 config_error ai_generated true

[nav2_costmap_2d] 滚动窗口代价地图原点偏移不匹配:预期 (x, y) 但得到 (x', y')

[nav2_costmap_2d] Rolling window costmap origin offset mismatch: expected (x, y) but got (x', y')

ID: ros2/nav2-costmap-rolling-window-offset

其他格式: JSON · Markdown 中文 · English
88%修复率
85%置信度
1证据数
2024-06-10首次发现

版本兼容性

版本状态引入弃用备注
Humble active
Iron active
Jazzy active
Rolling active

根因分析

滚动窗口代价地图的原点在机器人移动时未正确更新,通常是由于 'rolling_window' 参数设置错误或代价地图帧与机器人里程计帧不匹配。

English

The rolling window costmap's origin is not updated correctly when the robot moves, often due to an incorrect 'rolling_window' parameter or a mismatch between the costmap frame and the robot's odometry frame.

generic

官方文档

https://docs.nav2.org/configuration/packages/costmap-2d.html

解决方案

  1. Ensure the 'global_frame' parameter in the costmap config matches the frame used by the robot's odometry (e.g., 'odom' or 'map'). Example: global_frame: odom; rolling_window: true; width: 10.0; height: 10.0;
  2. Add a static transform publisher in the launch file to publish the transform from 'odom' to 'map' if they differ: <node pkg="tf2_ros" exec="static_transform_publisher" args="0 0 0 0 0 0 map odom"/>
  3. Update the costmap parameters to set 'always_send_full_costmap: true' in the nav2_params.yaml to force full costmap updates, reducing drift.

无效尝试

常见但无效的做法:

  1. Set the costmap size to a very large value (e.g., 100x100 meters) 80% 失败

    Large costmaps consume excessive memory and slow down planning; the origin offset still drifts.

  2. Disable the rolling window and use a static costmap 70% 失败

    This changes the navigation behavior (no map following), which may not be acceptable for dynamic environments.

  3. Manually set the costmap origin in the parameter file to a fixed value 95% 失败

    The origin is dynamically updated by the robot's pose; a fixed value will cause the costmap to become misaligned.