fix(costmap_2d): draw StaticLayer-family layers correctly in rolling costmaps

In a rolling (local) costmap the StaticLayer extent is in map_frame_, so the
bounds it reported did not cover the moving master window and zone layers
(forbidden, preferred, unpreferred, critical) were not redrawn as the robot
moved.

- StaticLayer::updateBounds: when the costmap is rolling, expand the bounds to
  the whole master window every cycle.
- StaticLayer::updateCosts: skip when disabled; the transformed path uses the
  master grid passed in and the same merge policy as the aligned path.
- CostmapLayer::mergeCost: one merge rule for aligned and transformed grids.
  NO_INFORMATION in the layer keeps the master cell; CRITICAL_SPACE always
  wins; PREFERRED/UNPREFERRED only below INSCRIBED_INFLATED_OBSTACLE; otherwise
  max. updateWithMax and updateWithOverwrite keep their previous results.
- CriticalLayer::updateCosts delegates to StaticLayer::updateCosts, so it is
  rolling-aware too.
- Test: rolling_static_layer_test, 7 cases.

Tests on dev: rolling_static_layer_test 7/7, test_costmap 9/9,
costmap_common_root_test 4/4 (rooted and flat). directional_layer_test
InvalidMaxDeviationThrows still fails: it checks directional_layer.cpp
initialization, which this change does not touch.
This commit is contained in:
2026-11-16 14:01:01 +07:00
parent 5034029c6e
commit 74bc39b1f6
6 changed files with 285 additions and 40 deletions

View File

@@ -72,6 +72,9 @@ public:
void addExtraBounds(double mx0, double my0, double mx1, double my1);
protected:
/// Merge one known layer cell with the same policy in aligned and transformed grids.
static unsigned char mergeCost(unsigned char master_cost, unsigned char layer_cost, bool use_maximum);
/*
* Updates the master_grid within the specified
* bounding box using this layer's values.