diff --git a/include/core/frame/frame_base.h b/include/core/frame/frame_base.h index 1b368bf02df6a89567d90455edba72cf02f54bf0..298202a24925b27f7fd2759aecf3adfd8add1394 100644 --- a/include/core/frame/frame_base.h +++ b/include/core/frame/frame_base.h @@ -14,8 +14,7 @@ class StateBlock; typedef enum { KEY = 1, ///< key frame. It plays at optimizations (estimated). - // AUXILIARY = 1, ///< auxiliary frame. It plays at optimizations (estimated). - NON_ESTIMATED = 0 ///< regular frame. It does not play at optimization. + REGULAR = 0 ///< regular frame. It does not play at optimization. } FrameType; } @@ -85,8 +84,8 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha bool isKey() const; // set type - void setNonEstimated(); void setKey(ProblemPtr _prb); + void unsetKey(); // Frame values ------------------------------------------------ public: @@ -182,7 +181,7 @@ std::shared_ptr<classType> FrameBase::emplaceKeyFrame(TrajectoryBasePtr _ptr, T& template<typename classType, typename... T> std::shared_ptr<classType> FrameBase::createNonKeyFrame(T&&... all) { - std::shared_ptr<classType> frm = std::make_shared<classType>(FrameType::NON_ESTIMATED, std::forward<T>(all)...); + std::shared_ptr<classType> frm = std::make_shared<classType>(FrameType::REGULAR, std::forward<T>(all)...); return frm; } diff --git a/src/frame/frame_base.cpp b/src/frame/frame_base.cpp index 20ab9331867cd18963b5bc85b0f42fa1c01b4a2f..dedc166703a231a514aeaded0a7e86ce200412f5 100644 --- a/src/frame/frame_base.cpp +++ b/src/frame/frame_base.cpp @@ -133,14 +133,14 @@ void FrameBase::setTimeStamp(const TimeStamp& _ts) time_stamp_ = _ts; } -void FrameBase::setNonEstimated() +void FrameBase::unsetKey() { // unregister if previously estimated if (isKey()) for (const auto& sb : getStateBlockVec()) getProblem()->notifyStateBlock(sb, REMOVE); - type_ = NON_ESTIMATED; + type_ = REGULAR; } void FrameBase::setKey(ProblemPtr _prb) diff --git a/test/gtest_frame_base.cpp b/test/gtest_frame_base.cpp index 7167566535827fa6281057903e6f11dafdf3810d..504ea3afe8ab6fddf77a7d3b48f6b4648b5941e9 100644 --- a/test/gtest_frame_base.cpp +++ b/test/gtest_frame_base.cpp @@ -22,7 +22,7 @@ using namespace wolf; TEST(FrameBase, GettersAndSetters) { - FrameBasePtr F = make_shared<FrameBase>(NON_ESTIMATED, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); + FrameBasePtr F = make_shared<FrameBase>(REGULAR, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); // getters ASSERT_EQ(F->id(), (unsigned int) 1); @@ -37,7 +37,7 @@ TEST(FrameBase, GettersAndSetters) TEST(FrameBase, StateBlocks) { - FrameBasePtr F = make_shared<FrameBase>(NON_ESTIMATED, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); + FrameBasePtr F = make_shared<FrameBase>(REGULAR, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); ASSERT_EQ(F->getStateBlockMap().size(),(unsigned int) 2); ASSERT_EQ(F->getP()->getState().size(),(unsigned int) 2); @@ -47,7 +47,7 @@ TEST(FrameBase, StateBlocks) TEST(FrameBase, LinksBasic) { - FrameBasePtr F = make_shared<FrameBase>(NON_ESTIMATED, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); + FrameBasePtr F = make_shared<FrameBase>(REGULAR, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); ASSERT_FALSE(F->getTrajectory()); ASSERT_FALSE(F->getProblem()); @@ -128,7 +128,7 @@ TEST(FrameBase, GetSetState) StateQuaternionPtr sbq = make_shared<StateQuaternion>(); // Create frame - FrameBase F(NON_ESTIMATED, 1, sbp, sbq, sbv); + FrameBase F(REGULAR, 1, sbp, sbq, sbv); // Give values to vectors and vector blocks VectorXd x(10), x1(10), x2(10); diff --git a/test/gtest_has_state_blocks.cpp b/test/gtest_has_state_blocks.cpp index 646dd602e619b0c2d2fadd70eb6c6f94e7f79a5f..c19d99aa697ef7ad96994d2385a07433f8a7d47c 100644 --- a/test/gtest_has_state_blocks.cpp +++ b/test/gtest_has_state_blocks.cpp @@ -41,8 +41,8 @@ class HasStateBlocksTest : public testing::Test sbo1 = std::make_shared<StateQuaternion>(); sbv1 = std::make_shared<StateBlock>(3); // size 3 - F0 = std::make_shared<FrameBase>(NON_ESTIMATED, 0.0, sbp0, sbo0); // non KF - F1 = std::make_shared<FrameBase>(NON_ESTIMATED, 1.0, nullptr); // non KF + F0 = std::make_shared<FrameBase>(REGULAR, 0.0, sbp0, sbo0); // non KF + F1 = std::make_shared<FrameBase>(REGULAR, 1.0, nullptr); // non KF } void TearDown() override{} diff --git a/test/gtest_pack_KF_buffer.cpp b/test/gtest_pack_KF_buffer.cpp index 056fbcf0bb231962e109ea60f404a5a0cefd58f5..351edf4c950f154ddc2550965980c0650e2fe40e 100644 --- a/test/gtest_pack_KF_buffer.cpp +++ b/test/gtest_pack_KF_buffer.cpp @@ -34,10 +34,10 @@ class BufferPackKeyFrameTest : public testing::Test void SetUp(void) override { - f10 = std::make_shared<FrameBase>(NON_ESTIMATED, TimeStamp(10),nullptr,nullptr,nullptr); - f20 = std::make_shared<FrameBase>(NON_ESTIMATED, TimeStamp(20),nullptr,nullptr,nullptr); - f21 = std::make_shared<FrameBase>(NON_ESTIMATED, TimeStamp(21),nullptr,nullptr,nullptr); - f28 = std::make_shared<FrameBase>(NON_ESTIMATED, TimeStamp(28),nullptr,nullptr,nullptr); + f10 = std::make_shared<FrameBase>(REGULAR, TimeStamp(10),nullptr,nullptr,nullptr); + f20 = std::make_shared<FrameBase>(REGULAR, TimeStamp(20),nullptr,nullptr,nullptr); + f21 = std::make_shared<FrameBase>(REGULAR, TimeStamp(21),nullptr,nullptr,nullptr); + f28 = std::make_shared<FrameBase>(REGULAR, TimeStamp(28),nullptr,nullptr,nullptr); tt10 = 1.0; tt20 = 1.0; @@ -230,7 +230,7 @@ TEST_F(BufferPackKeyFrameTest, removeUpTo) // Specifically, only f28 should remain pack_kf_buffer.add(f28, tt28); ASSERT_EQ(pack_kf_buffer.size(), (unsigned int) 2); - FrameBasePtr f22 = std::make_shared<FrameBase>(NON_ESTIMATED, TimeStamp(22),nullptr,nullptr,nullptr); + FrameBasePtr f22 = std::make_shared<FrameBase>(REGULAR, TimeStamp(22),nullptr,nullptr,nullptr); PackKeyFramePtr pack22 = std::make_shared<PackKeyFrame>(f22,5); pack_kf_buffer.removeUpTo( pack22->key_frame->getTimeStamp() ); ASSERT_EQ(pack_kf_buffer.size(), (unsigned int) 1);