update
This commit is contained in:
@@ -26,6 +26,11 @@ struct DbFacts {
|
||||
int nodes = 0;
|
||||
int words = 0; // 0 = ban do quet KHONG co tu vung
|
||||
std::string optimizer_strategy; // tham so DB nho, co the khac cai ta ep
|
||||
|
||||
// DB nay duoc quet voi luoi cuc bo 3D hay khong. Quet phang roi mo ban do
|
||||
// voxel len thi chi thay MOT lop ngang o cao do LiDAR -- canh bao duoc, chu
|
||||
// khong phai loi.
|
||||
bool grid_3d = false;
|
||||
};
|
||||
|
||||
DbFacts InspectDatabase(const std::string& path);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "vslam/rtabmap_params.h"
|
||||
#include "vslam/slam_types.h"
|
||||
#include "vslam/voxel_export.h"
|
||||
#include "vslam/vslam_common.h"
|
||||
|
||||
namespace vslam {
|
||||
@@ -75,11 +76,22 @@ class RtabmapSlam {
|
||||
// Xuat occupancy grid hien tai. Dat, goi khi map_version doi.
|
||||
StatusResponse ExportMap(OccupancyGrid* out);
|
||||
|
||||
// Xuat ban do VOXEL 3D. Dat hon ExportMap: no quet lai o bi chiem cua moi
|
||||
// node. Goi cung nhip va cung ngan sach voi ExportMap -- xem Runtime::SlamLoop.
|
||||
//
|
||||
// `out->epoch` khong duoc dat o day: vong doi epoch la viec cua nguoi goi,
|
||||
// chi ho moi biet tap truoc do la gi.
|
||||
StatusResponse ExportVoxels(const VoxelExportOptions& opt, VoxelGrid* out);
|
||||
|
||||
StatusResponse Close(bool save_database);
|
||||
|
||||
const SlamStats& stats() const;
|
||||
SlamMode mode() const;
|
||||
|
||||
// Duong dan DB DA GIAI (tuong doi -> MapDir(), {stamp} da no).
|
||||
// Rong = DB trong RAM. Chi co nghia sau Init().
|
||||
const std::string& database_path() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<RtabmapSlamImpl> impl_;
|
||||
};
|
||||
|
||||
100
libs/vslam_slam/include/vslam/voxel_export.h
Normal file
100
libs/vslam_slam/include/vslam/voxel_export.h
Normal file
@@ -0,0 +1,100 @@
|
||||
#ifndef VSLAM_VOXEL_EXPORT_H
|
||||
#define VSLAM_VOXEL_EXPORT_H
|
||||
|
||||
// Xuat BAN DO VOXEL 3D tu do thi RTAB-Map, cho khung 3D cua web UI.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// ⚠️ 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().
|
||||
// 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 <vector>
|
||||
|
||||
#include "vslam/vslam_common.h"
|
||||
|
||||
namespace rtabmap {
|
||||
class Rtabmap;
|
||||
}
|
||||
|
||||
namespace vslam {
|
||||
|
||||
struct VoxelExportOptions {
|
||||
// Kich thuoc o PHAT. Doc lap voi Grid/CellSize (0.05) cua SLAM: lam tho
|
||||
// them mot bac cat bon lan so voxel ma mat rat it hinh dang.
|
||||
double emit_size_m = 0.10;
|
||||
|
||||
// Cat san va tran. z do tu base_footprint = mat san.
|
||||
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.
|
||||
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;
|
||||
};
|
||||
|
||||
// Gom diem -> tap voxel. KHONG chua kieu nao cua RTAB-Map, nen test duoc ma
|
||||
// khong can mot Rtabmap dang chay -- do la ly do no tach rieng khoi
|
||||
// ExportVoxelGrid.
|
||||
class VoxelAccumulator {
|
||||
public:
|
||||
explicit VoxelAccumulator(const VoxelExportOptions& opt);
|
||||
|
||||
// Toa do trong frame MAP, met.
|
||||
void AddPoint(double x, double y, double z);
|
||||
|
||||
// Sort + unique lan cuoi roi do ra `out`. `out->cells` da sap xep.
|
||||
void Finish(VoxelGrid* out);
|
||||
|
||||
// So diem bi bo vi ra ngoai dai int16. Khac 0 nghia la ban do vuot +-3 km
|
||||
// hoac resolution bi dat sai.
|
||||
size_t clamped() const { return clamped_; }
|
||||
// So diem bi cat vi nam ngoai [z_min, z_max].
|
||||
size_t z_rejected() const { return z_rejected_; }
|
||||
|
||||
private:
|
||||
void Flush();
|
||||
|
||||
VoxelExportOptions opt_;
|
||||
double inv_size_ = 10.0;
|
||||
std::vector<uint64_t> scratch_;
|
||||
std::vector<uint64_t> acc_; // luon o trang thai da sort+unique
|
||||
size_t clamped_ = 0;
|
||||
size_t z_rejected_ = 0;
|
||||
};
|
||||
|
||||
// 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
|
||||
// chi ho moi biet tap truoc do la gi.
|
||||
StatusResponse ExportVoxelGrid(rtabmap::Rtabmap& slam,
|
||||
const VoxelExportOptions& opt, VoxelGrid* 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.
|
||||
//
|
||||
// Tach ra de test duoc va de nguoi goi quyet dinh gui delta hay gui lai ca
|
||||
// tap dua tren ti le thay doi.
|
||||
void DiffVoxelGrids(const std::vector<VoxelIndex>& prev,
|
||||
const std::vector<VoxelIndex>& now,
|
||||
std::vector<VoxelIndex>* added,
|
||||
std::vector<VoxelIndex>* removed);
|
||||
|
||||
} // namespace vslam
|
||||
|
||||
#endif // VSLAM_VOXEL_EXPORT_H
|
||||
Reference in New Issue
Block a user