feat(sensor_gateway): feed DepthCameraObstacleLayer through its own LayerType

robot_costmap_2d now has LayerType::DEPTH_CAMERA_LAYER for
DepthCameraObstacleLayer. The gateway pushes PointCloud2 and DepthCameraData
to that type as well as to VOXEL_LAYER; LaserScan and PointCloud stay
VOXEL_LAYER only. Needs the robot_costmap_2d commit that adds the enum value.
This commit is contained in:
2026-10-20 14:28:14 +07:00
parent 8977e5ec14
commit c280a0a019
3 changed files with 33 additions and 0 deletions

View File

@@ -220,6 +220,28 @@ TEST(SensorGateway, ObstacleDataGoesOnlyToVoxelLayers)
EXPECT_EQ(inflation->count(), 0U);
}
TEST(SensorGateway, DepthCameraLayerGetsPointCloud2AndDepthOnly)
{
// DepthCameraObstacleLayer has its own LayerType: it must get the camera cloud and the depth
// image (as ConstPtr), and nothing 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(), 2U);
EXPECT_TRUE(*depth_layer->records()[0].type == typeid(robot_sensor_msgs::PointCloud2));
EXPECT_TRUE(*depth_layer->records()[1].type == typeid(robot_sensor_msgs::DepthCameraData::ConstPtr));
EXPECT_EQ(global_depth->count(), 2U);
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