fix(sensor_gateway): give static maps to the directional layer first

With a same-geometry map, StaticLayer could be written and report current
between the two dispatches while the old direction field was still READY,
so a plan could pair the new map with the old zones. The directional
layer only needs the map topic to go PENDING, and direction grids are
ignored by StaticLayer, so dispatching it first needs no lock.
This commit is contained in:
2026-11-04 11:14:15 +07:00
parent f85d89ef8c
commit 7bfb3c362d
2 changed files with 27 additions and 4 deletions

View File

@@ -152,6 +152,27 @@ TEST(SensorGateway, StaticMapArrivesWithOccupancyGridType)
EXPECT_TRUE(*layer->records()[0].type == typeid(robot_nav_msgs::OccupancyGrid));
}
TEST(SensorGateway, DirectionalLayerSeesAStaticMapBeforeTheStaticLayer)
{
// A same-geometry map must invalidate the old direction field before StaticLayer can be written
// and report current; otherwise a plan could pair the new map with the old zones (DIRECTION_ZONE_PLAN 5.3).
Bench bench;
std::vector<std::string> order;
SpyPtr static_layer = bench.addGlobal(LayerType::STATIC_LAYER, "navigation_map");
SpyPtr directional = bench.addGlobal(LayerType::DIRECTIONAL_LAYER, "direction_zones");
static_layer->setObserver([&](const void*, const std::type_info&, const std::string&) {
order.push_back("static");
});
directional->setObserver([&](const void*, const std::type_info&, const std::string&) {
order.push_back("directional");
});
bench.attach();
bench.gateway().pushStaticMap("/map", robot_nav_msgs::OccupancyGrid());
EXPECT_EQ(order, (std::vector<std::string>{"directional", "static"}));
}
TEST(SensorGateway, PointCloudAndPointCloud2AreDistinctTypes)
{
Bench bench;