voxel: chi giu o >= 3 node thay; obstacle_z_min 0.15

This commit is contained in:
trung09122002
2026-09-25 15:57:22 +07:00
parent 185814f0ec
commit ccd6d5954a
7 changed files with 210 additions and 36 deletions

View File

@@ -61,6 +61,10 @@ struct VoxelExportOptions {
// ca nghin node mot luc; khong gioi han thi lan xuat dau chan luong slam
// hang chuc giay. Ban do day dan qua cac lan xuat.
size_t max_new_nodes = 40;
// Voxel phai duoc it nhat bay nhieu NODE KHAC NHAU thay moi giu. Diem bay,
// nhieu depth va nguoi di ngang chi o 1-2 khung; tuong, ban ghe dung yen
// thi nhieu node thay. 1 = giu moi voxel (hanh vi cu).
size_t min_node_hits = 1;
};
// Diem cua tung node, o frame CUA NODE, da gom voxel. Tinh MOT lan roi giu:
@@ -104,6 +108,35 @@ class VoxelAccumulator {
size_t stride_ = 1;
};
// Dem so node KHAC NHAU thay moi voxel. Moi node dong gop mot voxel toi da
// MOT lan, du co bao nhieu diem roi vao do. Khong chua kieu RTAB-Map nao --
// test duoc nhu VoxelAccumulator.
class VoxelHitCounter {
public:
explicit VoxelHitCounter(const VoxelExportOptions& opt);
void BeginNode();
// Toa do trong frame MAP, met. Cung luat cat z / dai chi so voi
// VoxelAccumulator::AddPoint.
void AddPoint(double x, double y, double z);
void EndNode();
// Voxel co >= min_node_hits node -> dua qua VoxelAccumulator: giu nguyen
// luat giam mau khi cham tran, dau ra da sort.
void Finish(VoxelGrid* out);
size_t clamped() const { return clamped_; }
size_t stride() const { return stride_; }
private:
VoxelExportOptions opt_;
double inv_size_ = 10.0;
std::vector<uint64_t> node_; // khoa cua node dang gom
std::vector<uint64_t> all_; // khoa DA khu trung theo node, cua moi node
size_t clamped_ = 0;
size_t stride_ = 1;
};
// Quet toan bo pose da toi uu va dung lai tap voxel tu dau.
//
// `out->epoch` KHONG duoc dat o day -- nguoi goi quan ly vong doi epoch, vi