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.
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include <robot_sensor_msgs/PointCloud2.h>
|
||||
#include <robot_sensor_msgs/point_cloud_conversion.h>
|
||||
#include <robot_costmap_2d/obstacle_layer.h>
|
||||
#include <robot_costmap_2d/depth_evidence_store.h>
|
||||
#include <robot_voxel_grid/voxel_grid.h>
|
||||
|
||||
#include <limits>
|
||||
@@ -57,6 +58,8 @@
|
||||
namespace robot_costmap_2d
|
||||
{
|
||||
|
||||
class DepthVisibilityChecker;
|
||||
|
||||
class VoxelLayer : public ObstacleLayer
|
||||
{
|
||||
public:
|
||||
@@ -111,14 +114,35 @@ private:
|
||||
double min_range, double max_range, double skip_dist,
|
||||
double* min_x, double* min_y, double* max_x, double* max_y);
|
||||
bool clipColumnSegment(double& sx, double& sy, double& ex, double& ey) const;
|
||||
/// Paired depth marking: the checker of the same frame gates marking at the image
|
||||
/// border and the store records evidence points. Null for every other source.
|
||||
struct PairedMarking
|
||||
{
|
||||
const DepthVisibilityChecker* checker;
|
||||
const DepthFrustumConfig* config;
|
||||
};
|
||||
void markObservation(const Observation& observation, double* min_x, double* min_y,
|
||||
double* max_x, double* max_y);
|
||||
double* max_x, double* max_y, const PairedMarking* paired = nullptr);
|
||||
void processPairedDepth(double* min_x, double* min_y, double* max_x, double* max_y);
|
||||
struct VisibilityCounts
|
||||
{
|
||||
uint64_t free{0}, unknown{0}, surface{0}, frames{0};
|
||||
uint64_t by_evidence{0}; ///< decisions made from evidence points
|
||||
uint64_t border_dropped{0}; ///< marking points dropped at the image border
|
||||
} visibility_counts_;
|
||||
|
||||
/// Window-independent key: local cell index plus the cells the rolling origin moved.
|
||||
DepthEvidenceStore::VoxelKey evidenceKey(unsigned int x, unsigned int y, unsigned int z) const
|
||||
{
|
||||
return {static_cast<int>(x) + evidence_offset_x_, static_cast<int>(y) + evidence_offset_y_, z};
|
||||
}
|
||||
/// Drops evidence of voxels that left the window or are no longer MARKED.
|
||||
void pruneDepthEvidence();
|
||||
DepthEvidenceStore depth_evidence_;
|
||||
int evidence_offset_x_ = 0;
|
||||
int evidence_offset_y_ = 0;
|
||||
uint64_t frames_since_evidence_prune_ = 0;
|
||||
|
||||
|
||||
bool publish_voxel_;
|
||||
robot_voxel_grid::VoxelGrid robot_voxel_grid_;
|
||||
|
||||
Reference in New Issue
Block a user