From 57082085e6d7dba4496cf29ac977a525207e8987 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Vallv=C3=A9=20Navarro?= <jvallve@iri.upc.edu>
Date: Tue, 20 Apr 2021 16:00:05 +0000
Subject: [PATCH] bug fixed in processor_loop_closure.cpp

---
 src/processor/processor_loop_closure.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/processor/processor_loop_closure.cpp b/src/processor/processor_loop_closure.cpp
index 574ac512e..67e724a53 100644
--- a/src/processor/processor_loop_closure.cpp
+++ b/src/processor/processor_loop_closure.cpp
@@ -15,7 +15,7 @@ ProcessorLoopClosure::ProcessorLoopClosure(const std::string& _type,
 void ProcessorLoopClosure::processCapture(CaptureBasePtr _capture)
 {
     /* This function has 3 scenarios:
-     *  1. Capture already linked to a frame -> process
+     *  1. Capture already linked to a frame (in trajectory) -> process
      *  2. Capture has a timestamp compatible with any stored frame -> link + process
      *  3. Otherwise -> store capture (Note that more than one processor can be emplacing frames, so an older frame can arrive later than this one)
      */
@@ -23,7 +23,7 @@ void ProcessorLoopClosure::processCapture(CaptureBasePtr _capture)
     WOLF_DEBUG("ProcessorLoopClosure::processCapture capture ", _capture->id());
 
     // CASE 1:
-    if (_capture->getFrame())
+    if (_capture->getFrame() and _capture->getFrame()->getTrajectory())
     {
         WOLF_DEBUG("CASE 1");
 
@@ -39,7 +39,7 @@ void ProcessorLoopClosure::processCapture(CaptureBasePtr _capture)
     auto frame_pack = buffer_pack_kf_.select(_capture->getTimeStamp(), params_->time_tolerance);
 
     // CASE 2:
-    if (frame_pack)
+    if (_capture->getFrame() == nullptr and frame_pack)
     {
         WOLF_DEBUG("CASE 2");
 
-- 
GitLab