33 typedef std::map<KeyFrame*, Sim3, std::less<KeyFrame*>,
48 void setParams(
const bool bFixScale,
const bool bActiveLC);
59 void RequestResetActiveMap(
Map* pMap);
62 void RunGlobalBundleAdjustment(
Map* pActiveMap,
uint04 nLoopKF);
65 std::unique_lock<std::mutex> lock(mMutexGBA);
68 bool isFinishedGBA() {
69 std::unique_lock<std::mutex> lock(mMutexGBA);
79 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
83 bool CheckNewKeyFrames();
87 bool NewDetectCommonRegions();
88 bool DetectAndReffineSim3FromLastKF(KeyFrame* pCurrentKF, KeyFrame* pMatchedKF,
Sim3& gScw,
uint04& nNumProjMatches,
89 Buffer<MapPoint*>& vpMPs, Buffer<MapPoint*>& vpMatchedMPs);
90 bool DetectCommonRegionsFromBoW(Buffer<KeyFrame*>& vpBowCand, KeyFrame*& pMatchedKF, KeyFrame*& pLastCurrentKF,
Sim3& ParkeScw,
91 int& nNumCoincidences, Buffer<MapPoint*>& vpMPs, Buffer<MapPoint*>& vpMatchedMPs);
92 uint04 FindMatchesByProjection(KeyFrame* pCurrentKF, KeyFrame* pMatchedKFw,
Sim3& ParkeScw, Buffer<MapPoint*>& vpMapPoints,
93 Buffer<MapPoint*>& vpMatchedMapPoints);
96 void SearchAndFuse(
const KeyFrameAndPose& CorrectedPosesMap, Buffer<MapPoint*>& vpMapPoints);
97 void SearchAndFuse(
const Buffer<KeyFrame*>& vConectedKFs, Buffer<MapPoint*>& vpMapPoints);
104 void ResetIfRequested();
105 Buffer<KeyFrame*> m_covisible_frames;
106 ORBmatcher m_orb_matcher;
107 ORBmatcher m_bow_matcher;
108 bool mbResetRequested =
false;
109 bool mbResetActiveMapRequested =
false;
110 Map* mpMapToReset =
nullptr;
111 std::mutex mMutexReset;
115 bool mbFinishRequested =
false;
116 bool mbFinished =
true;
117 std::mutex mMutexFinish;
122 KeyFrameDatabase* mpKeyFrameDB;
125 LocalMapping* mpLocalMapper;
127 std::list<KeyFrame*> mlpLoopKeyFrameQueue;
129 std::mutex mMutexLoopQueue;
132 float mnCovisibilityConsistencyTh = 3.0f;
135 KeyFrame* mpCurrentKF =
nullptr;
136 KeyFrame* mpLastCurrentKF =
nullptr;
137 KeyFrame* mpMatchedKF =
nullptr;
138 Buffer<ConsistentGroup> mvConsistentGroups;
139 Buffer<KeyFrame*> mvpEnoughConsistentCandidates;
140 Buffer<KeyFrame*> mvpCurrentConnectedKFs;
141 Buffer<MapPoint*> mvpCurrentMatchedPoints;
142 Buffer<MapPoint*> mvpLoopMapPoints;
147 Map* mpLastMap =
nullptr;
149 bool mbLoopDetected =
false;
150 int mnLoopNumCoincidences = 0;
151 int mnLoopNumNotFound = 0;
152 KeyFrame* mpLoopLastCurrentKF =
nullptr;
155 KeyFrame* mpLoopMatchedKF =
nullptr;
156 Buffer<MapPoint*> mvpLoopMPs;
157 Buffer<MapPoint*> mvpLoopMatchedMPs;
158 bool mbMergeDetected =
false;
159 int mnMergeNumCoincidences = 0;
160 int mnMergeNumNotFound = 0;
161 KeyFrame* mpMergeLastCurrentKF =
nullptr;
165 KeyFrame* mpMergeMatchedKF;
166 Buffer<MapPoint*> mvpMergeMPs;
167 Buffer<MapPoint*> mvpMergeMatchedMPs;
168 Buffer<KeyFrame*> mvpMergeConnectedKFs;
172 bool mbRunningGBA =
false;
173 bool mbFinishedGBA =
true;
174 bool mbStopGBA =
false;
175 std::mutex mMutexGBA;
176 std::thread* mpThreadGBA =
nullptr;
185 int mnNumCorrection = 0;
186 int mnCorrectionGBA = 0;
190 bool mbActiveLC =
true;
193 Optimizer m_optimizer;
LoopClosing(Atlas *pAtlas, KeyFrameDatabase *pDB, ORBVocabulary *pVoc, const bool bFixScale, const bool bActiveLC, LogPtr log)
Constructs the loop closer.