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.
This commit is contained in:
2026-10-15 16:58:23 +07:00
parent 6340838dac
commit 63707c968c
8 changed files with 169 additions and 4 deletions

View File

@@ -84,6 +84,9 @@ public:
}
virtual void matchSize();
virtual void reset();
/// Recovery clear. Also drops the voxels and evidence points of the cleared cells: the
/// base class only writes the 2D cells, and the next column update re-derived the obstacle.
void clearArea(int start_x, int start_y, int end_x, int end_y, bool invert_area = false) override;
LayerType getType() const override
{
@@ -138,6 +141,10 @@ private:
}
/// Drops evidence of voxels that left the window or are no longer MARKED.
void pruneDepthEvidence();
/// Frees every voxel of the column and its evidence points; the 2D cell is left to the caller.
void clearDepthColumn(unsigned int x, unsigned int y);
/// Paired depth only: the voxels under the footprint, which ObstacleLayer frees in 2D only.
void clearFootprintVoxels();
DepthEvidenceStore depth_evidence_;
int evidence_offset_x_ = 0;
int evidence_offset_y_ = 0;