refactor(obstacle_layer): drop the DepthCameraData startup guard

ObstacleLayer and VoxelLayer no longer carry any depth code, so the check
that rejected a DepthCameraData source or frustum_clearing_enabled goes too.
A DepthCameraData source still fails at startup through the generic
data_type check; frustum_clearing_enabled is now an unknown key.

The README and the LayerType comment now say the gateway feeds
DepthCameraObstacleLayer PointCloud2 only.
This commit is contained in:
2026-10-21 13:35:14 +07:00
parent 40dc70e758
commit 74a02bd4a8
3 changed files with 8 additions and 20 deletions

View File

@@ -195,9 +195,7 @@ voxel_layer:
combination_method: 1
```
Depth camera không còn đi qua `VoxelLayer`: khai báo source `DepthCameraData` hoặc
`frustum_clearing_enabled: true` cho `ObstacleLayer`/`VoxelLayer` sẽ báo lỗi lúc khởi
động. Dùng plugin `DepthCameraObstacleLayer` (mục 5.6).
Depth camera dùng plugin `DepthCameraObstacleLayer` (mục 5.6), không đi qua `VoxelLayer`.
### 3.5. Inflation layer
@@ -420,7 +418,7 @@ dụ `f_scan b_scan`. Mỗi tên phải có một map tham số cùng tên.
| Tham số | Mặc định code | Ý nghĩa và cách chỉnh |
| --- | ---: | --- |
| `topic` | `map` | Topic input. Đây cũng là key dispatch callback, phải khớp tuyệt đối. |
| `data_type` | `PointCloud` | Một trong `LaserScan`, `PointCloud`, `PointCloud2`. `DepthCameraData` báo lỗi lúc khởi động. |
| `data_type` | `PointCloud` | Một trong `LaserScan`, `PointCloud`, `PointCloud2`; giá trị khác báo lỗi lúc khởi động. |
| `sensor_frame` | rỗng | Để rỗng để dùng `header.frame_id`; chỉ đặt khi cần ép origin của sensor. |
| `marking` | `true` | Đánh dấu điểm quan sát thành vật cản. |
| `clearing` | `false` | Raytrace PointCloud/LaserScan để xóa vùng trống. |
@@ -462,7 +460,7 @@ cần quan sát. Không tăng `max_obstacle_height` vượt khỏi voxel grid m
### 5.6. DepthCameraObstacleLayer
Port thuật toán của `costmap_depth_camera` (noetic). Layer có loại riêng `LayerType::DEPTH_CAMERA_LAYER`:
`SensorGateway` của `move_base2` đẩy `PointCloud2` và `DepthCameraData` vào nó (không đẩy `LaserScan`).
`SensorGateway` của `move_base2` chỉ đẩy `PointCloud2` vào nó (không đẩy `LaserScan`, `PointCloud`, `DepthCameraData`).
Layer nhận `PointCloud2` đã lọc của từng depth camera và giữ các điểm vật cản 3D trong frame global của costmap. Lưới riêng của layer
phản chiếu các điểm đó theo từng ô (cột có điểm là `LETHAL`, cột mất điểm cuối cùng thành
`FREE_SPACE`), rồi được gộp lên master như `ObstacleLayer` (`combination_method`). Mỗi chu kỳ:
@@ -532,7 +530,7 @@ Giới hạn đã biết:
hai.
- Khối nhìn đối xứng và trùng mép ảnh; dải mép ảnh không có depth (lọc mép, dải stereo
bên trái) vẫn được coi là "nhìn thấy trống".
- `DepthCameraData` (ảnh depth) đi tới layer này bị bỏ qua.
- Layer không dùng ảnh depth (`DepthCameraData`): host phải đổi ảnh sang `PointCloud2` trước khi đẩy vào.
### 5.7. InflationLayer
@@ -604,8 +602,8 @@ InflationLayer nằm sau các layer tạo vật cản
## 8. Lưu ý cho depth camera
- Layer chỉ dùng `PointCloud2` đã lọc (ví dụ `/camera/depth/points_proc`). Ảnh
`DepthCameraData` mà bridge vẫn gửi bị các layer bỏ qua.
- Layer chỉ dùng `PointCloud2` đã lọc (ví dụ `/camera/depth/points_proc`); bridge đổi ảnh
depth sang cloud trước khi đẩy vào nav core.
- Mỗi camera là một source trong `observation_sources` của cùng một
`DepthCameraObstacleLayer`, với topic, frame, FOV và dải độ cao riêng.
- Ngưỡng độ cao làm việc trong frame global: sai số lắp camera (roll, pitch, chiều cao)

View File

@@ -58,7 +58,7 @@ enum class LayerType
UNPREFERRED_LAYER,
VOXEL_LAYER,
/// DepthCameraObstacleLayer. Appended last so the values above keep their numbers; the host's
/// SensorGateway feeds it PointCloud2 and DepthCameraData.
/// SensorGateway feeds it PointCloud2.
DEPTH_CAMERA_LAYER
};

View File

@@ -175,16 +175,6 @@ bool ObstacleLayer::getParams(const std::string& config_file_name, robot::NodeHa
if (priv_nh.hasParam("raytrace_range"))
priv_nh.getParam("raytrace_range", raytrace_range);
// Depth images are handled by DepthCameraObstacleLayer; the frustum clearing that used to
// live here was removed. Fail at startup instead of silently dropping a camera.
if (data_type == "DepthCameraData" ||
loadParam(layer[source], "frustum_clearing_enabled", false))
{
robot::log_error("source %s: DepthCameraData / frustum_clearing_enabled are no longer supported by "
"ObstacleLayer/VoxelLayer, use a DepthCameraObstacleLayer plugin\n", source.c_str());
throw std::invalid_argument("source " + source + ": depth frustum clearing was removed from "
"ObstacleLayer/VoxelLayer, use DepthCameraObstacleLayer");
}
if (!(data_type == "PointCloud2" || data_type == "PointCloud" || data_type == "LaserScan"))
{
robot::log_error("Only topics that use point clouds or laser scans are currently supported\n");
@@ -236,7 +226,7 @@ void ObstacleLayer::handleImpl(const void* data,
if (!enabled_ || stop_receiving_data_)
return;
// DepthCameraData and other types are for other layers sharing this gateway; ignored here.
// Samples that match no configured source (type and topic) are ignored.
if (observation_buffers_.empty() || callback_infos_.empty())
return;