refactor(depth): DepthCameraObstacleLayer follows the CostmapLayer contract
The port wrote LETHAL straight into the master from its stored 3D points and left its own grid empty, as costmap_depth_camera does. Everything CostmapLayer offers on top of the own grid therefore missed the layer: clearArea() (the ClearCostmapRecovery path), reset() (Costmap2DROBOT::resetLayers()), footprint clearing and combination_method all acted on an empty grid, and the next cycle wrote the ghosts back. Cleared cells also stayed on the master until another layer's bounds covered them (the source's B7). The stored points stay the source of truth; the clearing and marking algorithm is unchanged. The own grid now mirrors them cell by cell, the way VoxelLayer keeps a voxel grid next to its 2D grid: - marking sets the column's cell LETHAL, the last point of a column leaving sets it FREE_SPACE, and both touch the bounds, so a cleared cell leaves the master in the same cycle (clear_touches_bounds is gone, always on); - updateCosts() only merges the own grid with combination_method, like ObstacleLayer; combination_method other than 0/1 now means "no effect"; - reset() drops the stored points and buffered observations; - clearArea() follows CostmapLayer::clearArea(): invert_area false clears outside the box and keeps the inside, true clears the inside; - footprint clearing erases the stored columns under the robot; - markings that leave the window are dropped in updateBounds() (B6), and a column whose cell went missing is re-marked; - the layer mutex guards the point map, since ClearCostmapRecovery and resetLayers() reach it from other threads (recursive mutex, held by the recovery around clearArea()). Tests: the two clear_touches_bounds cases become one bounded-update case, and clearArea (both directions), reset and footprint clearing get their own.
This commit is contained in:
21
README.md
21
README.md
@@ -461,9 +461,10 @@ cần quan sát. Không tăng `max_obstacle_height` vượt khỏi voxel grid m
|
||||
|
||||
### 5.6. DepthCameraObstacleLayer
|
||||
|
||||
Port của `costmap_depth_camera` (noetic). Layer nhận `PointCloud2` đã lọc của từng depth
|
||||
camera, giữ các điểm vật cản 3D trong frame global của costmap và ghi `LETHAL` trực tiếp
|
||||
lên master costmap. Mỗi chu kỳ:
|
||||
Port thuật toán của `costmap_depth_camera` (noetic). 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ỳ:
|
||||
|
||||
1. Cloud mới nhất của từng source được biến đổi sang frame global bằng TF **tại đúng
|
||||
stamp của cloud** (chờ tối đa `transform_tolerance`, quá hạn thì bỏ cloud và log lỗi),
|
||||
@@ -476,7 +477,14 @@ lên master costmap. Mỗi chu kỳ:
|
||||
3. **Đánh dấu:** gom cụm Euclidean (`ec_seg_distance`); cụm có `<= size_of_cluster_rejection`
|
||||
điểm bị bỏ; điểm của cụm còn lại nằm trong khối nhìn và cách mọi mặt khối nhìn hơn
|
||||
12 cm thì được lưu.
|
||||
4. Điểm ra ngoài cửa sổ costmap (rolling window) bị bỏ.
|
||||
4. Điểm ra ngoài cửa sổ costmap (rolling window) bị bỏ; điểm dưới footprint robot bị xóa khi
|
||||
bật `footprint_clearing_enabled`.
|
||||
|
||||
Mọi ô đổi trạng thái (đánh dấu hoặc xóa) đều được đưa vào vùng cập nhật, nên ô vừa xóa biến
|
||||
khỏi master ngay trong chu kỳ đó. `reset()` (dùng bởi `Costmap2DROBOT::resetLayers()`) xóa toàn
|
||||
bộ điểm đã lưu; `clearArea()` (dùng bởi `ClearCostmapRecovery`) xóa điểm theo đúng ngữ nghĩa
|
||||
của `CostmapLayer::clearArea()`: `invert_area: false` xóa các ô **ngoài** hình chữ nhật và giữ
|
||||
các ô bên trong, `true` xóa các ô **bên trong**.
|
||||
|
||||
Tham số chung của layer:
|
||||
|
||||
@@ -495,10 +503,9 @@ Tham số chung của layer:
|
||||
| `voxel_resolution` | `0.01 m` | Bước lượng tử độ cao của điểm lưu. |
|
||||
| `use_voxelized_observation` | `true` | Gộp voxel 5 cm trước khi xử lý. |
|
||||
| `transform_tolerance` | `0.2 s` | Thời gian chờ TF tại stamp của cloud. |
|
||||
| `footprint_clearing_enabled` | `true` | Như các layer khác (xem ghi chú bên dưới). |
|
||||
| `footprint_clearing_enabled` | `true` | Xóa ô và điểm đã lưu nằm dưới footprint robot. |
|
||||
| `combination_method` | `1` | Như các layer khác. |
|
||||
| `use_global_frame_to_mark` | `true` | Chỉ hỗ trợ `true`; `false` báo lỗi. |
|
||||
| `clear_touches_bounds` | `false` | `true`: điểm bị xóa cũng mở rộng vùng cập nhật để master được reset ngay. |
|
||||
| `debug/stats` | `true` | Log `[debug/stats]` định kỳ: số điểm, số điểm đánh dấu/xóa, TF chờ/bỏ, thời gian. |
|
||||
| `debug/stats_period` | `5.0 s` | Chu kỳ log trên. |
|
||||
|
||||
@@ -524,8 +531,6 @@ 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".
|
||||
- `reset()`, `clearArea()` và footprint clearing không xóa các điểm đã lưu; layer ghi lại
|
||||
chúng ở chu kỳ sau.
|
||||
- `DepthCameraData` (ảnh depth) đi tới layer này bị bỏ qua.
|
||||
|
||||
### 5.7. InflationLayer
|
||||
|
||||
Reference in New Issue
Block a user