feat(sensor_gateway): feed DepthCameraObstacleLayer through its own LayerType

robot_costmap_2d has LayerType::DEPTH_CAMERA_LAYER for
DepthCameraObstacleLayer. The gateway now pushes PointCloud2 to that type
as well as to VOXEL_LAYER, in both the local and the global costmap.
LaserScan, PointCloud and DepthCameraData stay VOXEL_LAYER only: the layer
marks and clears from the filtered camera cloud and does not use the depth
image.

Needs robot_costmap_2d main 64974d4 or later (the enum value).

Squashed from feature/depth-camera-layer-type (c280a0a..d3a9208).
This commit is contained in:
2026-10-21 14:21:53 +07:00
parent 8977e5ec14
commit ea7f9659b8
3 changed files with 29 additions and 0 deletions

View File

@@ -220,6 +220,27 @@ TEST(SensorGateway, ObstacleDataGoesOnlyToVoxelLayers)
EXPECT_EQ(inflation->count(), 0U);
}
TEST(SensorGateway, DepthCameraLayerGetsPointCloud2Only)
{
// DepthCameraObstacleLayer has its own LayerType: it must get the camera cloud, and neither the
// depth image (it does not use it) nor anything meant for the lidar layers.
Bench bench;
SpyPtr depth_layer = bench.addLocal(LayerType::DEPTH_CAMERA_LAYER, "depth_obstacles");
SpyPtr global_depth = bench.addGlobal(LayerType::DEPTH_CAMERA_LAYER, "depth_obstacles");
SpyPtr voxel = bench.addLocal(LayerType::VOXEL_LAYER, "lidar_obstacles");
bench.attach();
bench.gateway().pushLaserScan("/f_scan", makeScan());
bench.gateway().pushPointCloud("/pc", robot_sensor_msgs::PointCloud());
bench.gateway().pushPointCloud2("/camera/depth/points_proc", robot_sensor_msgs::PointCloud2());
bench.gateway().pushDepthCameraData("/camera/depth/data", makeDepth());
ASSERT_EQ(depth_layer->count(), 1U);
EXPECT_TRUE(*depth_layer->records()[0].type == typeid(robot_sensor_msgs::PointCloud2));
EXPECT_EQ(global_depth->count(), 1U);
EXPECT_EQ(voxel->count(), 4U); // the voxel layers keep getting everything, as before
}
TEST(SensorGateway, LayerNamedAfterATopicDoesNotReceiveTheSample)
{
// Hồi quy cho C5. Bản `move_base` cũ lọc bằng