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

@@ -44,6 +44,8 @@ const char* toString(robot_costmap_2d::LayerType type)
return "PreferredLayer";
case robot_costmap_2d::LayerType::UNPREFERRED_LAYER:
return "UnpreferredLayer";
case robot_costmap_2d::LayerType::DEPTH_CAMERA_LAYER:
return "DepthCameraObstacleLayer";
case robot_costmap_2d::LayerType::UNKNOWN:
break;
}
@@ -331,6 +333,9 @@ void SensorGateway::pushPointCloud2(const std::string& name,
ScopedSection timer(telemetry_, section_cloud_);
dispatchTo(local_costmap_, cloud, robot_costmap_2d::LayerType::VOXEL_LAYER, name, stats_);
dispatchTo(global_costmap_, cloud, robot_costmap_2d::LayerType::VOXEL_LAYER, name, stats_);
// DepthCameraObstacleLayer has its own type and marks from the camera's PointCloud2.
dispatchTo(local_costmap_, cloud, robot_costmap_2d::LayerType::DEPTH_CAMERA_LAYER, name, stats_);
dispatchTo(global_costmap_, cloud, robot_costmap_2d::LayerType::DEPTH_CAMERA_LAYER, name, stats_);
}
void SensorGateway::pushDepthCameraData(const std::string& topic,
@@ -356,6 +361,10 @@ void SensorGateway::pushDepthCameraData(const std::string& topic,
// rơi im lặng qua mọi nhánh của handleImpl.
dispatchTo(local_costmap_, data, robot_costmap_2d::LayerType::VOXEL_LAYER, topic, stats_);
dispatchTo(global_costmap_, data, robot_costmap_2d::LayerType::VOXEL_LAYER, topic, stats_);
// The depth image goes to DepthCameraObstacleLayer too (unused today, needed by depth-image
// clearing); LaserScan and PointCloud do not.
dispatchTo(local_costmap_, data, robot_costmap_2d::LayerType::DEPTH_CAMERA_LAYER, topic, stats_);
dispatchTo(global_costmap_, data, robot_costmap_2d::LayerType::DEPTH_CAMERA_LAYER, topic, stats_);
}
} // namespace move_base2