From f85d89ef8c9cff8f7d179f958554ce7d9f0e38d2 Mon Sep 17 00:00:00 2001 From: duongtd Date: Tue, 3 Nov 2026 16:57:01 +0700 Subject: [PATCH] feat(sensor_gateway): deliver static map grids to the directional layer pushStaticMap now also dispatches to DIRECTIONAL_LAYER on the global costmap, after STATIC_LAYER so the master is already resized to the new map when the directional layer checks a direction grid against it. The layer filters by topic: map_topic resets it to PENDING, direction_topic carries the direction grid. --- src/io/sensor_gateway.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/io/sensor_gateway.cpp b/src/io/sensor_gateway.cpp index 6cf7475..d43e30f 100644 --- a/src/io/sensor_gateway.cpp +++ b/src/io/sensor_gateway.cpp @@ -279,6 +279,10 @@ void SensorGateway::pushStaticMap(const std::string& name, const robot_nav_msgs: dispatchTo(global_costmap_, map, robot_costmap_2d::LayerType::STATIC_LAYER, name, stats_); dispatchTo(global_costmap_, map, robot_costmap_2d::LayerType::PREFERRED_LAYER, name, stats_); dispatchTo(global_costmap_, map, robot_costmap_2d::LayerType::UNPREFERRED_LAYER, name, stats_); + // Sau STATIC_LAYER có chủ đích: StaticLayer resize master theo map mới ngay trong callback, nên + // DirectionalLayer kiểm geometry của grid hướng trên master đã đúng kích thước. Layer tự lọc theo + // topic: map_topic đưa nó về PENDING, direction_topic là grid hướng. Chỉ global costmap có layer này. + dispatchTo(global_costmap_, map, robot_costmap_2d::LayerType::DIRECTIONAL_LAYER, name, stats_); dispatchTo(local_costmap_, map, robot_costmap_2d::LayerType::STATIC_LAYER, name, stats_); dispatchTo(local_costmap_, map, robot_costmap_2d::LayerType::PREFERRED_LAYER, name, stats_);