NAV2_COSTMAP_ROLLING_001 ros2 config_error ai_generated true

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

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

Also available as: JSON · Markdown · 中文
88%Fix Rate
85%Confidence
1Evidence
2024-06-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Humble active
Iron active
Jazzy active
Rolling active

Root Cause

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

中文

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

Official Documentation

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

Workarounds

  1. 90% success 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;
    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. 80% success 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"/>
    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. 75% success Update the costmap parameters to set 'always_send_full_costmap: true' in the nav2_params.yaml to force full costmap updates, reducing drift.
    Update the costmap parameters to set 'always_send_full_costmap: true' in the nav2_params.yaml to force full costmap updates, reducing drift.

中文步骤

  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.

Dead Ends

Common approaches that don't work:

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

    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% fail

    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% fail

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