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.
This commit is contained in:
@@ -336,7 +336,7 @@ void VoxelLayer::markObservation(const Observation& obs, double* min_x, double*
|
||||
// A point at the image edge could never be re-checked with a full patch from the
|
||||
// pose that saw it, and would leave a voxel that only the whole-box rule judges.
|
||||
const Eigen::Vector3d point(*iter_x, *iter_y, *iter_z);
|
||||
if (paired->config->marking_border_px > 0 &&
|
||||
if ((paired->config->marking_border_px > 0 || paired->config->stereo_baseline_m > 0) &&
|
||||
!paired->checker->projectsInside(point, paired->config->marking_border_px))
|
||||
{
|
||||
++visibility_counts_.border_dropped;
|
||||
@@ -372,6 +372,37 @@ void VoxelLayer::pruneDepthEvidence()
|
||||
});
|
||||
}
|
||||
|
||||
bool VoxelLayer::reobserveFrees(DepthObservation observation, const DepthEvidenceStore::VoxelKey& key,
|
||||
const DepthFrustumConfig& config)
|
||||
{
|
||||
float miss = 0.f;
|
||||
switch (observation)
|
||||
{
|
||||
case DepthObservation::Confirmed:
|
||||
++visibility_counts_.confirmed;
|
||||
depth_evidence_.resetMiss(key);
|
||||
return false;
|
||||
case DepthObservation::Occluded:
|
||||
++visibility_counts_.occluded;
|
||||
return false;
|
||||
case DepthObservation::OutOfView:
|
||||
++visibility_counts_.out_of_view;
|
||||
return false;
|
||||
case DepthObservation::SeenThrough:
|
||||
++visibility_counts_.seen_through;
|
||||
miss = depth_evidence_.addMiss(key, 1.f);
|
||||
break;
|
||||
case DepthObservation::NoReturn:
|
||||
++visibility_counts_.no_return;
|
||||
if (config.no_return_weight <= 0)
|
||||
return false;
|
||||
miss = depth_evidence_.addMiss(key, static_cast<float>(config.no_return_weight));
|
||||
break;
|
||||
}
|
||||
// The small slack absorbs float rounding when fractional no-return weights add up.
|
||||
return miss >= static_cast<float>(config.miss_frames) - 1e-3f;
|
||||
}
|
||||
|
||||
void VoxelLayer::processPairedDepth(double* min_x, double* min_y, double* max_x, double* max_y)
|
||||
{
|
||||
for (const auto& source : paired_depth_sources_)
|
||||
@@ -418,6 +449,7 @@ void VoxelLayer::processPairedDepth(double* min_x, double* min_y, double* max_x,
|
||||
// With evidence points a voxel is judged by the points that marked it; a voxel
|
||||
// without evidence (marked before the mode was enabled) keeps the whole-box rule.
|
||||
const bool use_evidence = source->config.evidence_points_enabled;
|
||||
const bool reobserve = use_evidence && source->config.reobserve_clearing;
|
||||
std::vector<Eigen::Vector3d> evidence;
|
||||
std::vector<std::array<unsigned int, 3>> free_voxels;
|
||||
for (unsigned int y = 0; y < size_y_; ++y)
|
||||
@@ -428,10 +460,17 @@ void VoxelLayer::processPairedDepth(double* min_x, double* min_y, double* max_x,
|
||||
{
|
||||
if (robot_voxel_grid_.getVoxel(x, y, z) != robot_voxel_grid::MARKED) continue;
|
||||
DepthVisibilityResult visibility;
|
||||
if (use_evidence && depth_evidence_.points(evidenceKey(x, y, z), evidence))
|
||||
const auto key = evidenceKey(x, y, z);
|
||||
if (use_evidence && depth_evidence_.points(key, evidence))
|
||||
{
|
||||
visibility = checker.classifyPoints(evidence);
|
||||
++visibility_counts_.by_evidence;
|
||||
if (reobserve)
|
||||
{
|
||||
if (reobserveFrees(checker.observePoints(evidence), key, source->config))
|
||||
{ free_voxels.push_back({x, y, z}); ++visibility_counts_.free; }
|
||||
continue;
|
||||
}
|
||||
visibility = checker.classifyPoints(evidence);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -475,6 +514,7 @@ void VoxelLayer::processPairedDepth(double* min_x, double* min_y, double* max_x,
|
||||
robot::log_info_throttle(5.0, "paired depth [%s]: applied=%llu tf_wait=%llu "
|
||||
"invalid=%llu stale=%llu expired=%llu overflow=%llu duplicate=%llu; "
|
||||
"voxel decisions free=%llu surface=%llu unknown=%llu by_evidence=%llu; "
|
||||
"reobserve confirmed=%llu occluded=%llu seen_through=%llu no_return=%llu out_of_view=%llu; "
|
||||
"border_dropped_points=%llu evidence_voxels=%zu (cumulative)\n",
|
||||
name_.c_str(), static_cast<unsigned long long>(counts.applied),
|
||||
static_cast<unsigned long long>(counts.tf_wait), static_cast<unsigned long long>(counts.invalid),
|
||||
@@ -484,6 +524,11 @@ void VoxelLayer::processPairedDepth(double* min_x, double* min_y, double* max_x,
|
||||
static_cast<unsigned long long>(visibility_counts_.surface),
|
||||
static_cast<unsigned long long>(visibility_counts_.unknown),
|
||||
static_cast<unsigned long long>(visibility_counts_.by_evidence),
|
||||
static_cast<unsigned long long>(visibility_counts_.confirmed),
|
||||
static_cast<unsigned long long>(visibility_counts_.occluded),
|
||||
static_cast<unsigned long long>(visibility_counts_.seen_through),
|
||||
static_cast<unsigned long long>(visibility_counts_.no_return),
|
||||
static_cast<unsigned long long>(visibility_counts_.out_of_view),
|
||||
static_cast<unsigned long long>(visibility_counts_.border_dropped), depth_evidence_.size());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user