From 0be31e753d3ef854d88eca8997cd1a1109ea0320 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Thu, 3 Dec 2020 15:31:16 +0100
Subject: [PATCH] Set the capture's calibration with best results available in
 case of new KF

---
 src/processor/processor_motion.cpp | 2 ++
 src/sensor/sensor_base.cpp         | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp
index 0ed2f4387..bf44bb4a9 100644
--- a/src/processor/processor_motion.cpp
+++ b/src/processor/processor_motion.cpp
@@ -418,6 +418,8 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr)
          *
          */
 
+        // Set the capture's calibration with best results available (in case origin_ptr_ received a solve())
+        setCalibration(last_ptr_, getCalibration(origin_ptr_));
 
         // Set the frame of last_ptr as key
         auto key_frame      = last_ptr_->getFrame();
diff --git a/src/sensor/sensor_base.cpp b/src/sensor/sensor_base.cpp
index 46456daaf..9e7adfd0b 100644
--- a/src/sensor/sensor_base.cpp
+++ b/src/sensor/sensor_base.cpp
@@ -263,7 +263,7 @@ CaptureBasePtr SensorBase::findLastCaptureBefore(const TimeStamp& _ts) const
     TrajectoryRevIter frame_rev_it = trajectory->rbegin();
     while (frame_rev_it != trajectory->rend())
     {
-        if ((*frame_rev_it)->getTimeStamp() <= _ts + Constants::EPS)
+        if ((*frame_rev_it)->getTimeStamp() <= _ts)
         {
             auto capture = (*frame_rev_it)->getCaptureOf(shared_from_this());
             if (capture)
-- 
GitLab