From 9f46d784583a5f95d31f2b60334127887d82cc84 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Vallv=C3=A9=20Navarro?= <jvallve@iri.upc.edu>
Date: Mon, 17 Jun 2019 15:10:23 +0200
Subject: [PATCH] changed documentation and added WOLF_DEBUGs

---
 include/core/processor/processor_tracker_feature.h  |  8 ++++----
 include/core/processor/processor_tracker_landmark.h |  8 ++++----
 src/processor/processor_tracker.cpp                 | 12 +++++++++---
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/include/core/processor/processor_tracker_feature.h b/include/core/processor/processor_tracker_feature.h
index 1225ab73e..a808a421d 100644
--- a/include/core/processor/processor_tracker_feature.h
+++ b/include/core/processor/processor_tracker_feature.h
@@ -121,8 +121,8 @@ class ProcessorTrackerFeature : public ProcessorTracker
          *
          * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
          * Then, they will be already linked to the _capture.
-         * If you detect all the features at once in preprocess(), you should either emplace them (`FeatureBase::emplace()`) and remove the not returned features in _features_out (`FeatureBase::remove()`),
-         * or create them (`make_shared()`) and link all the returned features in _features_out (`FeatureBase::link(_capture)`).
+         * If you detect all the features at once in preprocess(), you should create them (`make_shared()`) and only link the
+         * features that are returned in _features_out (`FeatureBase::link(_capture)`).
          *
          * \return the number of features tracked
          */
@@ -168,8 +168,8 @@ class ProcessorTrackerFeature : public ProcessorTracker
          *
          * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
          * Then, they will be already linked to the _capture.
-         * If you detect all the features at once in preprocess(), you should either emplace them (`FeatureBase::emplace()`) and remove the not returned features in _features_out (`FeatureBase::remove()`),
-         * or create them (`make_shared()`) and link all the returned features in _features_out (`FeatureBase::link(_capture)`).
+         * If you detect all the features at once in preprocess(), you should create them (`make_shared()`) and only link the
+         * features that are returned in _features_out (`FeatureBase::link(_capture)`).
          *
          * The function is called in ProcessorTrackerFeature::processNew() to set the member new_features_last_,
          * the list of newly detected features of the capture last_ptr_.
diff --git a/include/core/processor/processor_tracker_landmark.h b/include/core/processor/processor_tracker_landmark.h
index f539a4cab..c11adecc7 100644
--- a/include/core/processor/processor_tracker_landmark.h
+++ b/include/core/processor/processor_tracker_landmark.h
@@ -112,8 +112,8 @@ class ProcessorTrackerLandmark : public ProcessorTracker
          *
          * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
          * Then, they will be already linked to the _capture.
-         * If you detect all the features at once in `preprocess()`, you should either emplace them (`FeatureBase::emplace()`) and remove the not returned features in _features_out (`FeatureBase::remove()`),
-         * or create them (`make_shared()`) and link all the returned features in _features_out (`FeatureBase::link(_capture)`).
+         * If you detect all the features at once in preprocess(), you should create them (`make_shared()`) and only link the
+         * features that are returned in _features_out (`FeatureBase::link(_capture)`).
          *
          * \return the number of landmarks found
          */
@@ -150,8 +150,8 @@ class ProcessorTrackerLandmark : public ProcessorTracker
          *
          * IMPORTANT: The features in _features_out should be emplaced. Don't use `make_shared`, use `FeatureBase::emplace` instead.
          * Then, they will be already linked to the _capture.
-         * If you detect all the features at once in `preprocess()`, you should either emplace them (`FeatureBase::emplace()`) and remove the not returned features in _features_out (`FeatureBase::remove()`),
-         * or create them (`make_shared()`) and link all the returned features in _features_out (`FeatureBase::link(_capture)`).
+         * If you detect all the features at once in preprocess(), you should create them (`make_shared()`) and only link the
+         * features that are returned in _features_out (`FeatureBase::link(_capture)`).
          *
          * The function is called in ProcessorTrackerLandmark::processNew() to set the member new_features_last_,
          * the list of newly detected features of the capture last_ptr_.
diff --git a/src/processor/processor_tracker.cpp b/src/processor/processor_tracker.cpp
index b1c67806c..3cde80f33 100644
--- a/src/processor/processor_tracker.cpp
+++ b/src/processor/processor_tracker.cpp
@@ -54,7 +54,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
             PackKeyFramePtr pack = buffer_pack_kf_.selectPack( incoming_ptr_, params_tracker_->time_tolerance);
             buffer_pack_kf_.removeUpTo( pack->key_frame->getTimeStamp() );
 
-            WOLF_DEBUG( "PT ", getName(), ": KF" , pack->key_frame->id() , " callback unpacked with ts= " , pack->key_frame->getTimeStamp().get() );
+            WOLF_DEBUG( "PT ", getName(), " FIRST_TIME_WITH_PACK: KF" , pack->key_frame->id() , " callback unpacked with ts= " , pack->key_frame->getTimeStamp() );
 
             // Append incoming to KF
             // pack->key_frame->addCapture(incoming_ptr_);
@@ -75,6 +75,8 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
         }
         case FIRST_TIME_WITHOUT_PACK :
         {
+            WOLF_DEBUG( "PT ", getName(), " FIRST_TIME_WITHOUT_PACK" );
+
             FrameBasePtr kfrm = getProblem()->emplaceFrame(KEY, incoming_ptr_->getTimeStamp());
             incoming_ptr_->link(kfrm);
 
@@ -97,10 +99,12 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
         {
         	// No-break case only for debug. Next case will be executed too.
             PackKeyFramePtr pack = buffer_pack_kf_.selectPack( incoming_ptr_, params_tracker_->time_tolerance);
-            WOLF_DEBUG( "PT ", getName(), ": KF" , pack->key_frame->id() , " callback unpacked with ts= " , pack->key_frame->getTimeStamp().get() );
+            WOLF_DEBUG( "PT ", getName(), " SECOND_TIME_WITH_PACK: KF" , pack->key_frame->id() , " callback unpacked with ts= " , pack->key_frame->getTimeStamp() );
         } // @suppress("No break at end of case")
         case SECOND_TIME_WITHOUT_PACK :
         {
+            WOLF_DEBUG( "PT ", getName(), " SECOND_TIME_WITHOUT_PACK" );
+
             FrameBasePtr frm = getProblem()->emplaceFrame(NON_ESTIMATED, incoming_ptr_->getTimeStamp());
             incoming_ptr_->link(frm);
 
@@ -126,7 +130,7 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
             PackKeyFramePtr pack = buffer_pack_kf_.selectPack( last_ptr_ , params_tracker_->time_tolerance);
             buffer_pack_kf_.removeUpTo( pack->key_frame->getTimeStamp() );
 
-            WOLF_DEBUG( "PT ", getName(), ": KF" , pack->key_frame->id() , " callback unpacked with ts= " , pack->key_frame->getTimeStamp().get() );
+            WOLF_DEBUG( "PT ", getName(), " RUNNING_WITH_PACK: KF" , pack->key_frame->id() , " callback unpacked with ts= " , pack->key_frame->getTimeStamp() );
 
             processKnown();
 
@@ -155,6 +159,8 @@ void ProcessorTracker::process(CaptureBasePtr const _incoming_ptr)
         }
         case RUNNING_WITHOUT_PACK :
         {
+            WOLF_DEBUG( "PT ", getName(), " RUNNING_WITHOUT_PACK" );
+
             processKnown();
 
             if (voteForKeyFrame() && permittedKeyFrame())
-- 
GitLab