Commit Graph

81 Commits

Author SHA1 Message Date
a5f548f0d7 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.
2026-10-20 13:34:08 +07:00
b23ff27a3c refactor(depth): keep DepthCameraObstacleLayer, drop the legacy depth clearing
Two depth-image clearing designs lived in this package: the frustum ray
clearing inherited from dev_cam_intel (DepthCameraData sources of
ObstacleLayer/VoxelLayer, frustum_* and column_* keys) and the observed_volume
evidence clearing (ROC) on top of it. Both are replaced on the robot by
DepthCameraObstacleLayer, a port of costmap_depth_camera that takes the
filtered PointCloud2 directly, so both are removed and the tree is rebuilt
from main (a63c084) plus the plugin.

- observation.h / observation_buffer: DepthFrustumConfig, DepthCameraObservation
  and the depth buffering API are gone; buffers hold point clouds only.
- ObstacleLayer/VoxelLayer: no frustum ray casting, column clearing or depth
  ray cache. A DepthCameraData source or frustum_clearing_enabled: true now
  fails at startup with a message pointing to DepthCameraObstacleLayer
  instead of silently dropping the camera; DepthCameraData reaching the layer
  through the gateway is ignored.
- copyParentParameters no longer forwards the frustum_* / column_* keys.
- ROC files (depth_evidence_store, depth_visibility, depth_frame_pairer) and
  their tests are not carried over; CloudProcessingConfig goes with them.
- PCL is needed by the plugin library only. The plugin test moves under
  BUILD_COSTMAP_TESTS; BUILD_DEPTH_MARKING_TESTS is gone.
- README documents DepthCameraObstacleLayer and its known limits.

The plugin code is unchanged from the version running on the KIT robot.
2026-10-20 09:47:33 +07:00
9a67eee148 wip: state before depth cleanup
Uncommitted work as it ran on the KIT robot until 2026-10-20: the ROC observed_volume tuning patch on top of 63707c9 and the DepthCameraObstacleLayer plugin (clone of tsengapola/costmap_depth_camera noetic, B6 window fix), its 17 unit tests and the CMake wiring. Kept as one commit so the cleanup that follows has a recoverable starting point; not meant to be pushed.
2026-10-20 09:36:53 +07:00
63707c968c fix(depth): free voxels on clearArea/footprint, accept far returns as behind
clearArea and footprint clearing only wrote the 2D cells, so the voxels and
evidence points stayed MARKED and the next column update brought the phantom
back. VoxelLayer now frees the voxel column and its evidence in both paths
(footprint only for observed_volume; legacy unchanged).

A valid return deeper than depth_valid_max_z_m kept every evidence point
unknown, so phantoms with nothing within 3 m behind never cleared. New key
depth_far_return_is_behind (default false) counts such a return as behind a
point that lies at least free_margin_m inside the trusted range.

Replay of the 2026-10-15 bags: real phantoms 62 -> 53, static-cell dropouts
unchanged, object kept on 10/11 FOV exits as before.
2026-10-15 16:58:23 +07:00
6340838dac fix(depth): forward the evidence-point keys to the layer namespace
Costmap2DROBOT copies a fixed list of observed_volume keys from obstacles/<source>
into <costmap>/obstacles/<source>. The three phase-1 keys were missing, so the
live layer always ran with their C++ defaults (evidence off, marking border 0)
whatever the runtime YAML said. Unit tests set the layer params directly and did
not catch it.

The factory test now checks that the runtime YAML values reach the layer.
2026-10-15 13:40:26 +07:00
5e38857e48 feat(depth): certify evidence points instead of whole voxels (phase 1)
The whole-voxel rule never clears a voxel whose box crosses the image edge.
A person bending over to lift an object leaves high voxels at the top edge
of the image: in the 2026-10-15 lift bag 0 of 54 phantom cells cleared.

- DepthEvidenceStore keeps, per marked voxel, the 6 per-axis extreme points
  plus the most recent ones, keyed by a window-independent cell index.
- DepthVisibilityChecker::classifyPoints: Free only when every evidence
  point projects with a full patch inside the usable image and sees valid
  depth behind it; any surface in front keeps it, invalid depth keeps it.
- Paired marking drops points within depth_marking_border_px of the image
  edge, so every kept point can be re-checked from the pose that saw it.
- Voxels without evidence keep the whole-voxel rule; evidence is erased on
  clear, pruned on rolling shift and every 50 frames.
- New keys depth_evidence_points_enabled (default false),
  depth_evidence_points_per_voxel (8, 6..16), depth_marking_border_px
  (must be > depth_projection_margin_px when enabled); startup log and
  counters (by_evidence, border_dropped_points, evidence_voxels).
- Tests: depth_evidence_store_test; checker and layer tests for the image
  top cut, border drop, rolling shift and a still-visible object.
2026-10-15 13:22:28 +07:00
2ca0bcc1c1 feat(depth): observed_volume depth clearing as deployed 2026-10-14
Baseline commit of the working-tree refactor built on 2026-10-14 17:24 and
running on the KIT robot, recorded in one commit before further changes.

- VoxelLayer clearing looks up TF at the depth image stamp.
- ObservationBuffer: per-source cloud preparation at the measurement stamp,
  height/range gate before the PCL VoxelGrid.
- DepthFramePairer: pairs the marking cloud with the clearing image by
  source and stamp, bounded queue and age.
- DepthVisibilityChecker and the observed_volume clearing mode in VoxelLayer;
  the legacy frustum mode stays the default.
- Tests: depth_observation_buffer_test, depth_visibility_test.
2026-10-15 11:37:56 +07:00
a63c084002 Bring main up to the dev_cam_intel line
main had not moved since 11 July, while the depth-camera work continued on
dev_cam_intel for six weeks. The two branches did not diverge by accident: they
ended up holding two different clearing designs for the same layer.

main carried frustum clearing as VoxelLayer members - frustum_clearing_enabled_,
a pixel step and a min/max range - driven from costmap_2d_robot. dev_cam_intel
replaced that with a full-column clearing pass whose configuration lives per
observation, so the layer keeps no frustum state of its own.

This commit takes the dev_cam_intel tree whole. It is the line running on the
robot, the one rb_ws points at, and the one the NUC measurements were taken
against; the frustum design is superseded rather than merged, and stays in
history at 45c8227 if it is ever wanted back.

Squashed deliberately: the nineteen commits behind it are a working diary -
metrics that were added and removed, test toggles, an optimal-run series - and
none of that is worth carrying onto a branch other trees track.
2026-08-27 13:41:42 +07:00
45c8227f5c change topic and msg depth camera 2026-07-11 10:09:55 +07:00
faa57d9c93 change topic and msg depth camera 2026-07-11 09:50:40 +07:00
a2a021c114 add function computeCost file layer.h 2026-07-10 11:27:20 +07:00
2fcd211ccf update 2026-03-03 07:26:47 +00:00
3d621de809 fix bugs 2026-02-26 14:54:23 +07:00
1f9e9f1398 update 2026-02-26 14:52:33 +07:00
9208c8bcdc WIP: fix costmap_2d_robot 2026-02-26 14:49:45 +07:00
6c6e5b44f8 update copyParentParameters 2026-02-26 14:43:17 +07:00
eb52edc6e8 update tf3 2026-02-07 11:00:46 +07:00
ed43912c33 delete console_brigde 2026-02-06 10:14:35 +00:00
9026c03e1e update 2026-01-13 14:30:13 +07:00
81e7874274 Duong update 2026-01-12 15:48:43 +07:00
9d3d31a4f9 include <robot/console.h> 2026-01-10 14:10:41 +07:00
b18aeb39ab replaced printf -> robot::console 2026-01-10 11:38:19 +07:00
b66bd7c751 DuongTD gui zalo 2026-01-10 10:16:51 +07:00
384897b750 update from DuongTD 2026-01-08 10:35:27 +07:00
f052dac142 update for ROS 2026-01-07 16:55:01 +07:00
80bde38f4d ros 2026-01-07 09:26:36 +07:00
03c151afd2 update 2026-01-06 17:49:14 +07:00
a8fc8cb9a4 Merge branch 'main' of https://git.pnkr.asia/DuongTD/costmap_2d into main 2026-01-06 17:37:52 +07:00
800e5c1735 update obstacle_layer 2026-01-06 17:33:13 +07:00
b6733ae04c update 2025-12-31 15:43:07 +07:00
ae469e3271 add function getTypeLayer 2025-12-31 10:11:12 +07:00
6c682712fe hiep update 2025-12-30 10:42:34 +07:00
72b2f3c639 Hiep update 2025-12-30 10:24:18 +07:00
4246453ae6 hiep sua ten file 2025-12-30 09:56:35 +07:00
2c3d7d586d HiepLM update 2025-12-30 09:08:14 +07:00
71adf1390f hiep sua 2025-12-29 18:01:03 +07:00
59b0b1a806 update 2025-12-29 17:43:03 +07:00
ed54b7b8db Hiep sua file 2025-12-29 17:42:32 +07:00
a28f05c6d5 update 2025-12-29 10:22:16 +07:00
0344c31e5b update 2025-12-25 11:06:15 +07:00
10521c1629 update 2025-12-24 17:16:05 +07:00
b3be5da393 Merge branch 'main' of https://git.pnkr.asia/DuongTD/costmap_2d into main 2025-12-24 14:21:57 +07:00
b807d2c187 Merge branch 'main' of https://git.pnkr.asia/DuongTD/costmap_2d into main 2025-12-24 14:21:14 +07:00
674fb07ad3 update 2025-12-24 14:19:29 +07:00
2bcd8e606b update 2025-12-19 15:35:37 +07:00
fdfba18bde update 2025-12-16 15:13:07 +07:00
e80eddc2c2 update load param using node handle 2025-12-11 17:27:50 +07:00
c53db2280e update load param using node handle 2025-12-11 17:16:46 +07:00
22cfd07519 fix file utils 2025-12-08 11:08:11 +07:00
d37daab594 fix file utils 2025-12-08 11:03:49 +07:00