This commit is contained in:
trung09122002
2026-09-23 13:36:48 +07:00
parent dbcbf84dc3
commit 0a1b1b13f1
38 changed files with 2331 additions and 138 deletions

View File

@@ -197,6 +197,30 @@ StatusResponse Runtime::Wire() {
if (camera_ != nullptr) {
camera_->SetCallback([this](const CameraFrame& f) {
if (!f.depth) return;
// --- Latch cho SLAM 3D, TRUOC chuoi perception ---
//
// Tap thang vao CameraFrame tho: `depth_filter` chan 30 Hz xuong 10 Hz,
// nhung RTAB-Map tu bo khung bang RGBD/LinearUpdate va Rtabmap/DetectionRate,
// nen cho no khung day du va de no tu chon.
//
// Khong dung `approx_sync.h` o day co y: queue_size mac dinh 30 se ghim
// 30 khung librealsense, va `Fire()` goi callback tren CHINH luong goi
// Add() -- tuc chay Rtabmap::process() (100-600 ms) tren luong camera.
// SlamLoop von da la vong pull "scan moi nhat + odom moi nhat"; them
// "depth moi nhat" la cung mot hinh. Khi nao depth that su can XEP HANG
// thi moi quay lai approx_sync.
if (slam_use_depth_) {
std::lock_guard<std::mutex> lk(depth_mu_);
latest_depth_ = f.depth;
latest_infra1_ = f.infra1;
// CameraInfo nam trong CameraFrame theo VALUE -> phai dong hop de
// SlamLoop cam duoc con tro ra ngoai lock.
latest_depth_info_ = std::make_shared<const CameraInfo>(f.depth_info);
latest_depth_stamp_ = f.header.stamp;
have_depth_ = true;
}
// Ca chuoi perception chay INLINE o day: depth -> cloud -> loc ->
// can trong luc -> phat hien vuc. Mot loi goi ham, tren chinh luong
// camera.