Skip to content
Snippets Groups Projects
Commit adcf4120 authored by PierreGtch's avatar PierreGtch
Browse files

Split decisions of searching for LC and creating features

parent fa19e351
No related branches found
No related tags found
1 merge request!290Resolve "ProcessorLoopClosureBase class"
Pipeline #3661 passed
This commit is part of merge request !290. Comments created here will be created in the context of that merge request.
...@@ -21,6 +21,7 @@ struct ProcessorParamsLoopClosure2 : public ProcessorParamsBase ...@@ -21,6 +21,7 @@ struct ProcessorParamsLoopClosure2 : public ProcessorParamsBase
* *
* This is an abstract class. * This is an abstract class.
* + You must define the following classes : * + You must define the following classes :
* - voteComputeFeatures()
* - voteSearchLoopClosure() * - voteSearchLoopClosure()
* - computeFeatures() * - computeFeatures()
* - findLoopCandidate() * - findLoopCandidate()
...@@ -63,21 +64,15 @@ public: ...@@ -63,21 +64,15 @@ public:
protected: protected:
/** \brief Called by process(). Tells if processLoopClosure will be called /** \brief Called by process(). Tells if computeFeatures() will be called
*/ */
virtual bool voteSearchLoopClosure(CaptureBasePtr _incoming_ptr) = 0; virtual bool voteComputeFeatures(CaptureBasePtr _incoming_ptr) = 0;
/** \brief Tries to close a loop /** \brief Called by process(). Tells if findLoopCandidate() and createFactors() will be called
* *
* this method is called in process() if voteSearchLoopClosure retruns true * WARNING : A LC can be searched only when voteComputeFeatures() return true
* this method uses :
* - selectPairKC()
* - computeFeatures()
* - findLoopCandidate()
* - validateLoop()
* - createFactors()
*/ */
void processLoopClosure(void); virtual bool voteSearchLoopClosure(CaptureBasePtr _incoming_ptr) = 0;
/** \brief returns a KeyFrame-Capture pair compatible together (selected from the buffers) /** \brief returns a KeyFrame-Capture pair compatible together (selected from the buffers)
* *
......
...@@ -24,30 +24,26 @@ void ProcessorLoopClosureBase2::process(CaptureBasePtr _incoming_ptr) ...@@ -24,30 +24,26 @@ void ProcessorLoopClosureBase2::process(CaptureBasePtr _incoming_ptr)
// the pre-process, if necessary, is implemented in the derived classes // the pre-process, if necessary, is implemented in the derived classes
preProcess(); preProcess();
if (voteSearchLoopClosure(_incoming_ptr)) if (voteComputeFeatures(_incoming_ptr))
{ {
//CREAT_THREAD(function=processLoopClosure); std::pair<FrameBasePtr,CaptureBasePtr> pairKC = selectPairKC();
processLoopClosure(); if (pairKC.first==nullptr || pairKC.second==nullptr) return;
computeFeatures(pairKC);
if (voteSearchLoopClosure(_incoming_ptr))
{
FrameBasePtr key_frame_1 = pairKC.first;
FrameBasePtr key_frame_2 = findLoopCandidate(key_frame_1);
if (key_frame_2==nullptr) return;
if (validateLoop(key_frame_1, key_frame_2)==false) return;
createFactors(key_frame_1, key_frame_2);
};
}; };
// the post-process, if necessary, is implemented in the derived classes // the post-process, if necessary, is implemented in the derived classes
postProcess(); postProcess();
} }
void ProcessorLoopClosureBase2::processLoopClosure()
{
std::pair<FrameBasePtr,CaptureBasePtr> pairKC = selectPairKC();
if (pairKC.first==nullptr || pairKC.second==nullptr)
return;
computeFeatures(pairKC);
FrameBasePtr key_frame_1 = pairKC.first;
FrameBasePtr key_frame_2 = findLoopCandidate(key_frame_1);
if (key_frame_2==nullptr)
return;
if (validateLoop(key_frame_1, key_frame_2)==false)
return;
createFactors(key_frame_1, key_frame_2);
}
/** /**
* In the default implementation, we select the KF with the most recent TimeStamp * In the default implementation, we select the KF with the most recent TimeStamp
* and that is compatible with at least a Capture * and that is compatible with at least a Capture
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment