From c991d42dbcf771a0a928710d8bc6d6d70c93e1f4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Mon, 6 Dec 2021 00:54:14 +0100
Subject: [PATCH] Fix 420

---
 src/processor/processor_compass.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/processor/processor_compass.cpp b/src/processor/processor_compass.cpp
index 956f7581c..4ddbce358 100644
--- a/src/processor/processor_compass.cpp
+++ b/src/processor/processor_compass.cpp
@@ -39,13 +39,13 @@ ProcessorCompass::~ProcessorCompass()
 void ProcessorCompass::processCapture(CaptureBasePtr _capture)
 {
     // Search for any stored frame within time tolerance of capture
-    auto frame_pack = buffer_pack_kf_.select(_capture->getTimeStamp(), params_->time_tolerance);
-    if (frame_pack)
+    auto keyframe = buffer_frame_.select(_capture->getTimeStamp(), params_->time_tolerance);
+    if (keyframe)
     {
-        processMatch(frame_pack->key_frame, _capture);
+        processMatch(keyframe, _capture);
 
         // remove the frame and older frames
-        buffer_pack_kf_.removeUpTo(frame_pack->key_frame->getTimeStamp());
+        buffer_frame_.removeUpTo(keyframe->getTimeStamp());
     }
     // Otherwise: store capture
     // Note that more than one processor can be emplacing frames, so an older frame can arrive later than this one.
@@ -55,6 +55,8 @@ void ProcessorCompass::processCapture(CaptureBasePtr _capture)
 
 void ProcessorCompass::processKeyFrame(FrameBasePtr _frame, const double& _time_tolerance)
 {
+    _frame->setTimeTolerance(_time_tolerance);
+
     // Search for any stored capture within time tolerance of frame
     auto capture = buffer_capture_.select(_frame->getTimeStamp(), _time_tolerance);
     if (capture)
@@ -68,7 +70,7 @@ void ProcessorCompass::processKeyFrame(FrameBasePtr _frame, const double& _time_
     else if (buffer_capture_.selectLastAfter(_frame->getTimeStamp(), _time_tolerance) == nullptr)
     {
         // store frame
-        buffer_pack_kf_.add(_frame, _time_tolerance);
+        buffer_frame_.add(_frame->getTimeStamp(), _frame);
     }
     // Otherwise: There are captures more recent than the frame but none that match with it -> discard frame
 }
-- 
GitLab