From 33f7ef16ed4adddb4ade7aa27b31ba46aa9320ae Mon Sep 17 00:00:00 2001 From: lao bailaobai Date: Fri, 17 Feb 2023 23:59:55 +0800 Subject: [PATCH] update bug from Jason Gao --- src/LoopClosing.cc | 11 ++++++++--- src/MapPoint.cc | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/LoopClosing.cc b/src/LoopClosing.cc index ee101f8..3df41aa 100644 --- a/src/LoopClosing.cc +++ b/src/LoopClosing.cc @@ -1217,11 +1217,16 @@ int LoopClosing::FindMatchesByProjection( { spCheckKFs.insert(vpKFs[j]); ++nInserted; + + // 改成这样 + vpCovKFm.push_back(vpKFs[j]); } ++j; } + // 这里是原来的代码,这么写不太合适,会出现重复 + // 所以下面的插入可以改成放在if里面 // 把每个帧的共视关键帧都加到窗口内 - vpCovKFm.insert(vpCovKFm.end(), vpKFs.begin(), vpKFs.end()); + // vpCovKFm.insert(vpCovKFm.end(), vpKFs.begin(), vpKFs.end()); // 已放上面 } } @@ -2274,8 +2279,8 @@ void LoopClosing::MergeLocal() // Essential graph 优化后可以重新开始局部建图了 mpLocalMapper->Release(); - // 全局的BA(永远不会执行) - // 这里没有imu, 所以isImuInitialized一定是false, 此时地图融合Atlas至少2个地图,所以第二个条件也一定是false + // 全局的BA,后面一串的判断都为true + // !pCurrentMap->isImuInitialized()一定是true // Step 9 全局BA if(bRelaunchBA && (!pCurrentMap->isImuInitialized() || (pCurrentMap->KeyFramesInMap()<200 && mpAtlas->CountMaps()==1))) { diff --git a/src/MapPoint.cc b/src/MapPoint.cc index 4b7f43c..9c1d87e 100644 --- a/src/MapPoint.cc +++ b/src/MapPoint.cc @@ -769,7 +769,8 @@ void MapPoint::PreSave(set& spKF,set& spMP) mBackupObservationsId1.clear(); mBackupObservationsId2.clear(); // Save the id and position in each KF who view it - for(std::map >::const_iterator it = mObservations.begin(), end = mObservations.end(); it != end; ++it) + for(std::map >::const_iterator it = mObservations.begin(), + end = mObservations.end(); it != end; ++it) { KeyFrame* pKFi = it->first; if(spKF.find(pKFi) != spKF.end())