update
This commit is contained in:
@@ -6,26 +6,30 @@
|
||||
// Khac occupancy_export.cc o mot cho ban le: o day KHONG dung
|
||||
// rtabmap::OccupancyGrid. `BuildFromCache` ep Grid/3D="false" ngay trong ham
|
||||
// (occupancy_export.cc) va do la dung cho duong 2D -- no chieu moi thu xuong
|
||||
// mot mat phang. Ban do 3D phai lay o BI CHIEM o he cuc bo cua tung node roi
|
||||
// tu bien doi bang pose DA TOI UU.
|
||||
// mot mat phang. Ban do 3D lay DEPTH cua tung node, chieu thanh diem MOT lan
|
||||
// (cache theo id node), roi moi lan xuat chi bien doi cac diem do bang pose
|
||||
// DA TOI UU. Khong dung luoi cuc bo 3D cua RTAB-Map: dung no trong process()
|
||||
// keo pose lech (xem BuildRtabmapParams).
|
||||
//
|
||||
// ⚠️ Chinh vi dung pose da toi uu ma ban do 3D tu NAN lai sau moi vong dong:
|
||||
// khong co buoc "sua ban do" nao ca, ta dung lai tu dau tu do thi moi. Doi
|
||||
// lai, sau mot lan toi uu thi gan nhu MOI voxel doi chi so -- xem `epoch`
|
||||
// trong VoxelGrid va luat 35% o phia web.
|
||||
//
|
||||
// ⚠️ `data.uncompressData()` la BAT BUOC truoc khi doc gridObstacleCellsRaw().
|
||||
// ⚠️ `data.uncompressData()` la BAT BUOC truoc khi doc depthOrRightRaw().
|
||||
// Quen no thi moi node tra ve ma tran RONG, va trieu chung la "1990 node, 0 o"
|
||||
// -- y het cai bay da co trong occupancy_export.h.
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include "vslam/vslam_common.h"
|
||||
|
||||
namespace rtabmap {
|
||||
class Rtabmap;
|
||||
class SensorData;
|
||||
}
|
||||
|
||||
namespace vslam {
|
||||
@@ -39,13 +43,31 @@ struct VoxelExportOptions {
|
||||
double z_min = 0.05;
|
||||
double z_max = 2.00;
|
||||
|
||||
// Tran cung. Cham tran thi cat bot va bat `truncated` chu khong am tham
|
||||
// nuot: mot ban do 3D thieu mot nua trong im lang la kieu hong te nhat.
|
||||
// Tran SO O PHAT. Cham tran thi GIAM MAU DEU (buoc `stride`), khong cat cut
|
||||
// -- ban do giu nguyen hinh dang, chi thua di. Xem Finish().
|
||||
size_t max_cells = 150000;
|
||||
|
||||
// Gom bao nhieu khoa thi sort+unique mot lan. Doi bo nho dinh lay so lan
|
||||
// tron: 2M khoa = 16 MB tam thoi.
|
||||
size_t flush_every = 2000000;
|
||||
|
||||
// Chieu depth cua node thanh diem. Cung dai voi depth_filter (pipeline.yaml
|
||||
// 0.22-4.0 m): xa hon 4 m nhieu cua D410 tang theo binh phuong.
|
||||
double depth_min_m = 0.22;
|
||||
double depth_max_m = 4.0;
|
||||
// Bang Grid/DepthDecimation (4) ma luoi 3D cu da dung.
|
||||
int depth_decimation = 4;
|
||||
// So node MOI toi da doi depth -> diem trong MOT lan xuat. Localization nap
|
||||
// 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;
|
||||
};
|
||||
|
||||
// Diem cua tung node, o frame CUA NODE, da gom voxel. Tinh MOT lan roi giu:
|
||||
// depth cua node khong doi, chi pose cua no doi sau moi lan toi uu.
|
||||
// CHI luong slam cham vao.
|
||||
struct VoxelNodeCache {
|
||||
std::unordered_map<int, std::vector<float>> nodes; // id -> x,y,z,x,y,z...
|
||||
};
|
||||
|
||||
// Gom diem -> tap voxel. KHONG chua kieu nao cua RTAB-Map, nen test duoc ma
|
||||
@@ -67,6 +89,9 @@ class VoxelAccumulator {
|
||||
// So diem bi cat vi nam ngoai [z_min, z_max].
|
||||
size_t z_rejected() const { return z_rejected_; }
|
||||
|
||||
// Buoc giam mau da dung o lan Finish() gan nhat. 1 = khong giam.
|
||||
size_t stride() const { return stride_; }
|
||||
|
||||
private:
|
||||
void Flush();
|
||||
|
||||
@@ -76,6 +101,7 @@ class VoxelAccumulator {
|
||||
std::vector<uint64_t> acc_; // luon o trang thai da sort+unique
|
||||
size_t clamped_ = 0;
|
||||
size_t z_rejected_ = 0;
|
||||
size_t stride_ = 1;
|
||||
};
|
||||
|
||||
// Quet toan bo pose da toi uu va dung lai tap voxel tu dau.
|
||||
@@ -83,7 +109,15 @@ class VoxelAccumulator {
|
||||
// `out->epoch` KHONG duoc dat o day -- nguoi goi quan ly vong doi epoch, vi
|
||||
// chi ho moi biet tap truoc do la gi.
|
||||
StatusResponse ExportVoxelGrid(rtabmap::Rtabmap& slam,
|
||||
const VoxelExportOptions& opt, VoxelGrid* out);
|
||||
const VoxelExportOptions& opt,
|
||||
VoxelNodeCache* cache, VoxelGrid* out);
|
||||
|
||||
// Depth trong `data` (da uncompressData) -> diem o frame base cua node, cat
|
||||
// theo depth_min/max va z_min/z_max, gom theo emit_size_m. Rong neu node
|
||||
// khong co depth. Tach rieng de test duoc ma khong can Rtabmap.
|
||||
void NodeCloudFromSensorData(const rtabmap::SensorData& data,
|
||||
const VoxelExportOptions& opt,
|
||||
std::vector<float>* out);
|
||||
|
||||
// Hieu hai tap DA SAP XEP: `added` co trong `now` ma khong co trong `prev`,
|
||||
// `removed` thi nguoc lai. O(n + m), mot luot.
|
||||
|
||||
Reference in New Issue
Block a user