diff --git a/include/core/frame/frame_base.h b/include/core/frame/frame_base.h index ec6b987af5bbe23e05799566e80c1e2fcf51e5c7..d1cb69dc41d0986575ef125a4e74a04942389296 100644 --- a/include/core/frame/frame_base.h +++ b/include/core/frame/frame_base.h @@ -8,14 +8,6 @@ namespace wolf{ class TrajectoryBase; class CaptureBase; class StateBlock; - -/** \brief Enumeration of frame types - */ -typedef enum -{ - KEY = 1, ///< key frame. It plays at optimizations (estimated). - REGULAR = 0 ///< regular frame. It does not play at optimization. -} FrameType; } //Wolf includes @@ -44,7 +36,6 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha protected: unsigned int frame_id_; - FrameType type_; ///< type of frame. Either NON_KEY_FRAME or KEY_FRAME. (types defined at wolf.h) TimeStamp time_stamp_; ///< frame time stamp public: @@ -77,12 +68,8 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha public: unsigned int id() const; - // get type - bool isKey() const; - - // set type - void setKey(ProblemPtr _prb); - void unsetKey(); + // link to problem + void link(ProblemPtr _prb); // Frame values ------------------------------------------------ public: @@ -178,10 +165,11 @@ inline unsigned int FrameBase::id() const return frame_id_; } -inline bool FrameBase::isKey() const -{ - return (type_ == KEY); -} +//inline bool FrameBase::isKey() const +//{ +// return true; +//// return (type_ == KEY); +//} inline void FrameBase::getTimeStamp(TimeStamp& _ts) const { diff --git a/src/frame/frame_base.cpp b/src/frame/frame_base.cpp index a2a3deb19ac18d37d15c82ceb10ee8498e68fd89..6207d6f1711d0431ebeb0039b4be462cece85371 100644 --- a/src/frame/frame_base.cpp +++ b/src/frame/frame_base.cpp @@ -126,20 +126,9 @@ void FrameBase::setTimeStamp(const TimeStamp& _ts) time_stamp_ = _ts; } -void FrameBase::unsetKey() +void FrameBase::link(ProblemPtr _prb) { - // unregister if previously estimated - if (isKey()) - for (const auto& sb : getStateBlockVec()) - getProblem()->notifyStateBlock(sb, REMOVE); - - type_ = REGULAR; -} - -void FrameBase::setKey(ProblemPtr _prb) -{ - assert(_prb != nullptr && "setting Key fram with a null problem pointer"); - type_ = KEY; + assert(_prb != nullptr && "Trying to link Frame with a null problem pointer!"); this->link(_prb->getTrajectory()); } diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp index 70ffce8ac80117de1766bca16e53c6137a01ca0d..17919a7b9eabb2cfda8902ce9585c45dd7c38714 100644 --- a/src/processor/processor_motion.cpp +++ b/src/processor/processor_motion.cpp @@ -423,7 +423,7 @@ void ProcessorMotion::processCapture(CaptureBasePtr _incoming_ptr) // Set the frame of last_ptr as key auto key_frame = last_ptr_->getFrame(); - key_frame ->setKey(getProblem()); + key_frame ->link(getProblem()); // create motion feature and add it to the key_capture auto key_feature = emplaceFeature(last_ptr_); diff --git a/src/processor/processor_tracker.cpp b/src/processor/processor_tracker.cpp index e1d2e1c26dcc42703343993ea75afcc4c7b5e405..860b9867f8e6173659b464df904dde17db5e6ac1 100644 --- a/src/processor/processor_tracker.cpp +++ b/src/processor/processor_tracker.cpp @@ -187,7 +187,7 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) // We create a KF // set KF on last last_ptr_->getFrame()->setState(getProblem()->getState(last_ptr_->getTimeStamp())); - last_ptr_->getFrame()->setKey(getProblem()); + last_ptr_->getFrame()->link(getProblem()); // // make F; append incoming to new F // FrameBasePtr frm = FrameBase::createNonKeyFrame<FrameBase>(incoming_ptr_->getTimeStamp()); diff --git a/test/gtest_has_state_blocks.cpp b/test/gtest_has_state_blocks.cpp index b1baad456cf808ccbd670c39efee13f21c9622e1..0d42d813257b1b2b26aeefe3fb908a3b29b5b616 100644 --- a/test/gtest_has_state_blocks.cpp +++ b/test/gtest_has_state_blocks.cpp @@ -68,7 +68,7 @@ TEST_F(HasStateBlocksTest, Notifications_add_makeKF) ASSERT_FALSE(problem->getStateBlockNotification(sbv0, n)); - F0->setKey(problem); + F0->link(problem); ASSERT_TRUE(problem->getStateBlockNotification(sbp0, n)); ASSERT_EQ(n, ADD); @@ -85,7 +85,7 @@ TEST_F(HasStateBlocksTest, Notifications_makeKF_add) // first make KF, then add SB // F1->link(problem->getTrajectory()); - F1->setKey(problem); + F1->link(problem); F1->addStateBlock('P', sbp1); @@ -116,7 +116,7 @@ TEST_F(HasStateBlocksTest, Add_solve_notify_solve_add) ASSERT_FALSE(problem->getStateBlockNotification(sbp0, n)); F0->addStateBlock('V', sbv0); - F0->setKey(problem); + F0->link(problem); ASSERT_TRUE(problem->getStateBlockNotification(sbv0, n)); ASSERT_EQ(n, ADD); diff --git a/test/gtest_track_matrix.cpp b/test/gtest_track_matrix.cpp index 9bb9eec223650a1a07aed3a9566042c8dfc7dbd1..a14c436ddc0864f7b55e1ef9db1fd451ecf494ea 100644 --- a/test/gtest_track_matrix.cpp +++ b/test/gtest_track_matrix.cpp @@ -52,8 +52,8 @@ class TrackMatrixTest : public testing::Test f4 = FeatureBase::emplace<FeatureBase>(nullptr, "FeatureBase", m, m_cov); // F0 and F4 are keyframes - F0->setKey(problem); - F4->setKey(problem); + F0->link(problem); + F4->link(problem); // link captures C0->link(F0);