From 627ae03d0df840c4a5ef2704aa027dc5892b47d5 Mon Sep 17 00:00:00 2001 From: jcasals <jcasals@iri.upc.edu> Date: Tue, 16 Jun 2020 16:26:13 +0200 Subject: [PATCH] Remove frame atributes w/o breaking tests Remove as many XXX_frame_ptr_ as possible without breaking the gtests --- include/core/processor/processor_motion.h | 3 +-- include/core/processor/processor_tracker.h | 2 -- src/processor/processor_motion.cpp | 6 ++---- src/processor/processor_tracker.cpp | 22 ++++------------------ 4 files changed, 7 insertions(+), 26 deletions(-) diff --git a/include/core/processor/processor_motion.h b/include/core/processor/processor_motion.h index 3f9d53f96..12d43a1b5 100644 --- a/include/core/processor/processor_motion.h +++ b/include/core/processor/processor_motion.h @@ -485,9 +485,8 @@ class ProcessorMotion : public ProcessorBase, public IsMotion CaptureMotionPtr last_ptr_; CaptureMotionPtr incoming_ptr_; - FrameBasePtr origin_frame_ptr_; FrameBasePtr last_frame_ptr_; - FrameBasePtr incoming_frame_ptr_; + FrameBasePtr origin_frame_ptr_; protected: // helpers to avoid allocation diff --git a/include/core/processor/processor_tracker.h b/include/core/processor/processor_tracker.h index fdc8da6b8..1a0539731 100644 --- a/include/core/processor/processor_tracker.h +++ b/include/core/processor/processor_tracker.h @@ -101,9 +101,7 @@ class ProcessorTracker : public ProcessorBase CaptureBasePtr origin_ptr_; ///< Pointer to the origin of the tracker. CaptureBasePtr last_ptr_; ///< Pointer to the last tracked capture. CaptureBasePtr incoming_ptr_; ///< Pointer to the incoming capture being processed. - FrameBasePtr origin_frame_ptr_; FrameBasePtr last_frame_ptr_; - FrameBasePtr incoming_frame_ptr_; FeatureBasePtrList new_features_last_; ///< List of new features in \b last for landmark initialization and new key-frame creation. FeatureBasePtrList new_features_incoming_; ///< list of the new features of \b last successfully tracked in \b incoming FeatureBasePtrList known_features_last_; ///< list of the known features in previous captures successfully tracked in \b last diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp index c828ab93f..ed2279577 100644 --- a/src/processor/processor_motion.cpp +++ b/src/processor/processor_motion.cpp @@ -33,10 +33,9 @@ ProcessorMotion::ProcessorMotion(const std::string& _type, origin_ptr_(), last_ptr_(), incoming_ptr_(), - origin_frame_ptr_(), last_frame_ptr_(), - incoming_frame_ptr_(), - dt_(0.0), + origin_frame_ptr_(), + dt_(0.0), x_(_state_size), delta_(_delta_size), delta_cov_(_delta_cov_size, _delta_cov_size), @@ -390,7 +389,6 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr) // clear incoming just in case incoming_ptr_ = nullptr; // This line is not really needed, but it makes things clearer. - incoming_frame_ptr_ = nullptr; postProcess(); } diff --git a/src/processor/processor_tracker.cpp b/src/processor/processor_tracker.cpp index 4e777ec5b..a3b00d916 100644 --- a/src/processor/processor_tracker.cpp +++ b/src/processor/processor_tracker.cpp @@ -24,9 +24,7 @@ ProcessorTracker::ProcessorTracker(const std::string& _type, origin_ptr_(nullptr), last_ptr_(nullptr), incoming_ptr_(nullptr), - origin_frame_ptr_(nullptr), last_frame_ptr_(nullptr), - incoming_frame_ptr_(nullptr), state_structure_(_structure) { // @@ -120,7 +118,6 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) getProblem()->getFrameStructure(), getProblem()->getState()); incoming_ptr_->link(frm); - incoming_frame_ptr_ = frm; // We have a last_ Capture with no features, so we do not process known features, and we do not vote for KF. // Process info @@ -133,11 +130,9 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) // Update pointers resetDerived(); origin_ptr_ = last_ptr_; - origin_frame_ptr_ = last_frame_ptr_; last_ptr_ = incoming_ptr_; - last_frame_ptr_ = incoming_frame_ptr_; + last_frame_ptr_ = frm; incoming_ptr_ = nullptr; - incoming_frame_ptr_ = nullptr; break; } @@ -160,7 +155,6 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) getProblem()->getFrameStructure(), getProblem()->getState()); incoming_ptr_->link(frm); - incoming_frame_ptr_ = frm; // Detect new Features, initialize Landmarks, create Factors, ... processNew(params_tracker_->max_new_features); @@ -171,11 +165,9 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) // Update pointers resetDerived(); origin_ptr_ = last_ptr_; - origin_frame_ptr_ = last_frame_ptr_; last_ptr_ = incoming_ptr_; - last_frame_ptr_ = incoming_frame_ptr_; + last_frame_ptr_ = frm; incoming_ptr_ = nullptr; - incoming_frame_ptr_ = nullptr; break; } @@ -216,14 +208,10 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) getProblem()->getDim(), last_ptr_->getFrame()->getStateVector()); incoming_ptr_->link(frm); - incoming_frame_ptr_ = frm; - origin_ptr_ = last_ptr_; - origin_frame_ptr_ = last_frame_ptr_; last_ptr_ = incoming_ptr_; - last_frame_ptr_ = incoming_frame_ptr_; + last_frame_ptr_ = frm; incoming_ptr_ = nullptr; - incoming_frame_ptr_ = nullptr; } /* TODO: create an auxiliary frame @@ -270,14 +258,12 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) getProblem()->getDim(), last_ptr_->getFrame()->getStateVector()); incoming_ptr_->link(frm); - incoming_frame_ptr_ = frm; last_ptr_->getFrame()->remove(); // implicitly calling last_ptr_->remove(); // Update pointers last_ptr_ = incoming_ptr_; - last_frame_ptr_ = incoming_frame_ptr_; + last_frame_ptr_ = frm; incoming_ptr_ = nullptr; - incoming_frame_ptr_ = nullptr; } break; } -- GitLab