From d90cb63215d52dd4846154fb9e93a66423e734a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Mon, 14 Dec 2020 20:09:22 +0100 Subject: [PATCH] Remove Auxiliare frame and some related renaming --- include/core/frame/frame_base.h | 7 +++---- src/frame/frame_base.cpp | 4 ++-- test/gtest_frame_base.cpp | 8 ++++---- test/gtest_has_state_blocks.cpp | 4 ++-- test/gtest_pack_KF_buffer.cpp | 10 +++++----- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/include/core/frame/frame_base.h b/include/core/frame/frame_base.h index 1b368bf02..298202a24 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 20ab93318..dedc16670 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 716756653..504ea3afe 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 646dd602e..c19d99aa6 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 056fbcf0b..351edf4c9 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); -- GitLab