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

- **ID:** `ros2/nav2-costmap-rolling-window-offset`
- **Domain:** ros2
- **Category:** config_error
- **Error Code:** `NAV2_COSTMAP_ROLLING_001`
- **Verification:** ai_generated
- **Fix Rate:** 88%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Humble | active | — | — |
| Iron | active | — | — |
| Jazzy | active | — | — |
| Rolling | active | — | — |

## Workarounds

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;** (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;
   ```
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"/>** (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"/>
   ```
3. **Update the costmap parameters to set 'always_send_full_costmap: true' in the nav2_params.yaml to force full costmap updates, reducing drift.** (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.
   ```

## Dead Ends

- **Set the costmap size to a very large value (e.g., 100x100 meters)** — Large costmaps consume excessive memory and slow down planning; the origin offset still drifts. (80% fail)
- **Disable the rolling window and use a static costmap** — This changes the navigation behavior (no map following), which may not be acceptable for dynamic environments. (70% fail)
- **Manually set the costmap origin in the parameter file to a fixed value** — The origin is dynamically updated by the robot's pose; a fixed value will cause the costmap to become misaligned. (95% fail)
