From 009e985d93f7606d7ae2ef29f0ed67d00ef3c745 Mon Sep 17 00:00:00 2001 From: laobai Date: Sun, 24 Apr 2022 23:16:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BF=9D=E5=AD=98=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E6=97=B6=E4=BC=9A=E5=B4=A9=E5=9D=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Optimizer.cc | 1 + src/System.cc | 34 ++++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/Optimizer.cc b/src/Optimizer.cc index 6e5d9ca..8fbb877 100644 --- a/src/Optimizer.cc +++ b/src/Optimizer.cc @@ -2832,6 +2832,7 @@ void Optimizer::LocalInertialBA(KeyFrame *pKF, bool *pbStopFlag, Map *pMap, int& } //cout << "Total map points: " << lLocalMapPoints.size() << endl; + // TODO debug会报错先注释掉 for(map::iterator mit=mVisEdges.begin(), mend=mVisEdges.end(); mit!=mend; mit++) { assert(mit->second>=3); diff --git a/src/System.cc b/src/System.cc index bdebe78..9620b73 100644 --- a/src/System.cc +++ b/src/System.cc @@ -569,6 +569,13 @@ void System::Shutdown() cout << "Shutdown" << endl; + if (mpViewer) + { + mpViewer->RequestFinish(); + while (!mpViewer->isFinished()) + usleep(5000); + } + mpLocalMapper->RequestFinish(); mpLoopCloser->RequestFinish(); /*if(mpViewer) @@ -579,22 +586,25 @@ void System::Shutdown() }*/ // Wait until all thread have effectively stopped - /*while(!mpLocalMapper->isFinished() || !mpLoopCloser->isFinished() || mpLoopCloser->isRunningGBA()) + // 源代码这里注释掉了,但是不执行会有锁报错 + while(!mpLocalMapper->isFinished() || !mpLoopCloser->isFinished() || mpLoopCloser->isRunningGBA()) { - if(!mpLocalMapper->isFinished()) - cout << "mpLocalMapper is not finished" << endl;*/ - /*if(!mpLoopCloser->isFinished()) - cout << "mpLoopCloser is not finished" << endl; - if(mpLoopCloser->isRunningGBA()){ - cout << "mpLoopCloser is running GBA" << endl; - cout << "break anyway..." << endl; - break; - }*/ - /*usleep(5000); - }*/ + // if(!mpLocalMapper->isFinished()) + // cout << "mpLocalMapper is not finished" << endl; + // if(!mpLoopCloser->isFinished()) + // cout << "mpLoopCloser is not finished" << endl; + // if(mpLoopCloser->isRunningGBA()){ + // cout << "mpLoopCloser is running GBA" << endl; + // cout << "break anyway..." << endl; + // break; + // } + usleep(5000); + } + if(!mStrSaveAtlasToFile.empty()) { + std::cout << "开始保存地图" << std::endl; Verbose::PrintMess("Atlas saving to file " + mStrSaveAtlasToFile, Verbose::VERBOSITY_NORMAL); SaveAtlas(FileType::BINARY_FILE); }