From 405af470fe8a971d13719e700ef154633e419ff6 Mon Sep 17 00:00:00 2001
From: joanvallve <jvallve@iri.upc.edu>
Date: Tue, 2 Jun 2020 22:34:26 +0200
Subject: [PATCH] use update.. in FactorBase::link

---
 src/factor/factor_base.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/factor/factor_base.cpp b/src/factor/factor_base.cpp
index 92cd31c45..f2be4153e 100644
--- a/src/factor/factor_base.cpp
+++ b/src/factor/factor_base.cpp
@@ -252,14 +252,13 @@ void FactorBase::link(FeatureBasePtr _ftr_ptr)
         return;
     }
 
-    // copy measurement_ and measurement_sqrt_information_upper_
-    measurement_ = _ftr_ptr->getMeasurement();
-    measurement_sqrt_information_upper_ = _ftr_ptr->getMeasurementSquareRootInformationUpper();
-
     // link with feature
     _ftr_ptr->addFactor(shared_from_this());
     this->setFeature(_ftr_ptr);
 
+    // update measurement and info according to the feature
+    updateMeasurementAndSquareRootInformationUpper();
+
     // if frame, should be key
     if (getCapture() and getFrame())
         assert(getFrame()->isKey() && "Forbidden: linking a factor with a non-key frame.");
-- 
GitLab