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

@@ -293,6 +293,9 @@ bool ObstacleLayer::getParams(const std::string& config_file_name, robot::NodeHa
frustum_config.marking_border_px = static_cast<unsigned int>(marking_border);
if (frustum_config.evidence_points_enabled && !frustum_config.observed_volume_clearing)
throw std::invalid_argument("depth_evidence_points_enabled requires depth_clearing_mode: observed_volume");
read_depth_option("depth_far_return_is_behind", frustum_config.far_return_is_behind);
if (frustum_config.far_return_is_behind && !frustum_config.evidence_points_enabled)
throw std::invalid_argument("depth_far_return_is_behind requires depth_evidence_points_enabled");
// One pixel more than the patch radius absorbs rounding of the stored float points,
// so every kept evidence point is re-checked with a full patch from its own pose.
if (frustum_config.evidence_points_enabled &&
@@ -440,12 +443,14 @@ bool ObstacleLayer::getParams(const std::string& config_file_name, robot::NodeHa
marking_buffers_.erase(std::remove(marking_buffers_.begin(), marking_buffers_.end(), m.buffer), marking_buffers_.end());
robot::log_info("depth clearing observed_volume: paired %s + %s, height=[%.3f, %.3f] m; "
"unknown/occluded/outside FOV retained; queue=%u age=%.3f s; one valid free frame; "
"evidence_points=%s per_voxel=%u marking_border=%u px projection_margin=%u px\n",
"evidence_points=%s per_voxel=%u marking_border=%u px projection_margin=%u px "
"far_return_behind=%s\n",
paired->cloud_topic.c_str(), paired->depth_topic.c_str(), m.min_height, m.max_height,
paired->config.pair_queue_size, paired->config.observation_max_age_s,
paired->config.evidence_points_enabled ? "true" : "false",
paired->config.evidence_points_per_voxel, paired->config.marking_border_px,
paired->config.projection_margin_px);
paired->config.projection_margin_px,
paired->config.far_return_is_behind ? "true" : "false");
}
}
catch (const YAML::BadFile& e) {