From 2db3c8e561ee1a89e1fe2b77ff89a33702ebdda0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Sat, 18 Jun 2022 12:50:36 +0200
Subject: [PATCH] Make voteKF more precise

---
 src/processor/processor_imu.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/processor/processor_imu.cpp b/src/processor/processor_imu.cpp
index 56d47d96e..0e4257e65 100644
--- a/src/processor/processor_imu.cpp
+++ b/src/processor/processor_imu.cpp
@@ -49,14 +49,13 @@ void ProcessorImu::preProcess()
 bool ProcessorImu::voteForKeyFrame() const
 {
     // time span
-    if (getBuffer().back().ts_ - getBuffer().front().ts_ > params_motion_Imu_->max_time_span)
+    if (getBuffer().back().ts_ - getBuffer().front().ts_ > params_motion_Imu_->max_time_span - params_motion_Imu_->time_tolerance)
     {
         WOLF_DEBUG( "PM: vote: time span" );
         return true;
     }
     // buffer length
-    WOLF_INFO("buff size: ", getBuffer().size(), " max: ", params_motion_Imu_->max_buff_length);
-    if (getBuffer().size() > params_motion_Imu_->max_buff_length)
+    if (getBuffer().size() -1 > params_motion_Imu_->max_buff_length)
     {
         WOLF_DEBUG( "PM: vote: buffer length" );
         return true;
-- 
GitLab