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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user