diff --git a/include/core/frame/frame_base.h b/include/core/frame/frame_base.h index baf67a4ae8afc59be83f614c7f4642770fdd82d5..c4e423947d5ce6c1c00d2f70f6c510dea38e1608 100644 --- a/include/core/frame/frame_base.h +++ b/include/core/frame/frame_base.h @@ -65,7 +65,7 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha // Add and remove from WOLF tree --------------------------------- template<typename classType, typename... T> - static std::shared_ptr<classType> emplaceFrame(TrajectoryBasePtr _ptr, T&&... all); + static std::shared_ptr<classType> emplace(TrajectoryBasePtr _ptr, T&&... all); void link(TrajectoryBasePtr); void link(ProblemPtr _prb); @@ -157,7 +157,7 @@ class FrameBase : public NodeBase, public HasStateBlocks, public std::enable_sha namespace wolf { template<typename classType, typename... T> -std::shared_ptr<classType> FrameBase::emplaceFrame(TrajectoryBasePtr _ptr, T&&... all) +std::shared_ptr<classType> FrameBase::emplace(TrajectoryBasePtr _ptr, T&&... all) { std::shared_ptr<classType> frm = std::make_shared<classType>(std::forward<T>(all)...); frm->link(_ptr); diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index d0a311aec438e3cc81d526aca264fcadc0f902b8..3dceffdd79180d3bb3bd9f5d4a27d33321ace5b7 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -356,10 +356,10 @@ FrameBasePtr Problem::emplaceFrame(const TimeStamp& _time_stamp, // assert (_frame_state.size() == index && "State vector incompatible with given structure and dimension! Vector too large."); - auto frm = FrameBase::emplaceFrame<FrameBase>(trajectory_ptr_, - _time_stamp, - _frame_structure, - state); + auto frm = FrameBase::emplace<FrameBase>(trajectory_ptr_, + _time_stamp, + _frame_structure, + state); return frm; } @@ -377,10 +377,10 @@ FrameBasePtr Problem::emplaceFrame (const TimeStamp& _time_stamp, // const StateStructure& _frame_structure, // const VectorComposite& _frame_state) { - return FrameBase::emplaceFrame<FrameBase>(getTrajectory(), - _time_stamp, - _frame_structure, - _frame_state); + return FrameBase::emplace<FrameBase>(getTrajectory(), + _time_stamp, + _frame_structure, + _frame_state); } FrameBasePtr Problem::emplaceFrame (const TimeStamp& _time_stamp, // @@ -394,14 +394,14 @@ FrameBasePtr Problem::emplaceFrame (const TimeStamp& _time_stamp, // frame_structure_ += std::string(1,key); } - return FrameBase::emplaceFrame<FrameBase>(getTrajectory(), - _time_stamp, - getFrameStructure(), - _frame_state); + return FrameBase::emplace<FrameBase>(getTrajectory(), + _time_stamp, + getFrameStructure(), + _frame_state); } FrameBasePtr Problem::emplaceFrame(const TimeStamp& _time_stamp, // - const Eigen::VectorXd& _frame_state) + const Eigen::VectorXd& _frame_state) { return emplaceFrame(_time_stamp, this->getFrameStructure(), @@ -412,8 +412,8 @@ FrameBasePtr Problem::emplaceFrame(const TimeStamp& _time_stamp, // FrameBasePtr Problem::emplaceFrame(const TimeStamp& _time_stamp) { return emplaceFrame(_time_stamp, - this->getFrameStructure(), - this->getDim()); + this->getFrameStructure(), + this->getDim()); } TimeStamp Problem::getTimeStamp ( ) const diff --git a/src/processor/processor_motion.cpp b/src/processor/processor_motion.cpp index 17919a7b9eabb2cfda8902ce9585c45dd7c38714..c6fda0b6468a76644dfdf165240fdfdcf07949ba 100644 --- a/src/processor/processor_motion.cpp +++ b/src/processor/processor_motion.cpp @@ -662,10 +662,10 @@ VectorComposite ProcessorMotion::getState(const TimeStamp& _ts, const StateStruc FrameBasePtr ProcessorMotion::setOrigin(const VectorComposite& _x_origin, const TimeStamp& _ts_origin) { - FrameBasePtr key_frame_ptr = FrameBase::emplaceFrame<FrameBase>(getProblem()->getTrajectory(), - _ts_origin, - getStateStructure(), - _x_origin); + FrameBasePtr key_frame_ptr = FrameBase::emplace<FrameBase>(getProblem()->getTrajectory(), + _ts_origin, + getStateStructure(), + _x_origin); setOrigin(key_frame_ptr); return key_frame_ptr; diff --git a/src/processor/processor_tracker.cpp b/src/processor/processor_tracker.cpp index 860b9867f8e6173659b464df904dde17db5e6ac1..52421e86398bc049321e8b3dc5f75dc56d2d3001 100644 --- a/src/processor/processor_tracker.cpp +++ b/src/processor/processor_tracker.cpp @@ -81,10 +81,10 @@ void ProcessorTracker::processCapture(CaptureBasePtr _incoming_ptr) { WOLF_DEBUG( "PT ", getName(), " FIRST_TIME_WITHOUT_PACK" ); - FrameBasePtr kfrm = FrameBase::emplaceFrame<FrameBase>(getProblem()->getTrajectory(), - incoming_ptr_->getTimeStamp(), - getProblem()->getFrameStructure(), - getProblem()->getState()); + FrameBasePtr kfrm = FrameBase::emplace<FrameBase>(getProblem()->getTrajectory(), + incoming_ptr_->getTimeStamp(), + getProblem()->getFrameStructure(), + getProblem()->getState()); incoming_ptr_->link(kfrm); // Process info diff --git a/test/gtest_emplace.cpp b/test/gtest_emplace.cpp index 23d0e097076b741ac5e6976ae77df152b818171a..21ed3167006049866bcbc481ec5bfa81c760a23c 100644 --- a/test/gtest_emplace.cpp +++ b/test/gtest_emplace.cpp @@ -42,7 +42,7 @@ TEST(Emplace, Frame) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); ASSERT_EQ(P, P->getTrajectory()->getFirstFrame()->getTrajectory()->getProblem()); } @@ -67,7 +67,7 @@ TEST(Emplace, Capture) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); ASSERT_EQ(P, P->getTrajectory()->getFirstFrame()->getTrajectory()->getProblem()); auto cpt = CaptureBase::emplace<CaptureBase>(frm, "Dummy", TimeStamp(0), nullptr, nullptr, nullptr, nullptr); @@ -81,7 +81,7 @@ TEST(Emplace, Feature) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); ASSERT_EQ(P, P->getTrajectory()->getFirstFrame()->getTrajectory()->getProblem()); auto cpt = CaptureBase::emplace<CaptureBase>(frm, "Dummy", TimeStamp(0), nullptr, nullptr, nullptr, nullptr); @@ -99,7 +99,7 @@ TEST(Emplace, Factor) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); ASSERT_EQ(P, P->getTrajectory()->getFirstFrame()->getTrajectory()->getProblem()); auto cpt = CaptureBase::emplace<CaptureBase>(frm, "Dummy", TimeStamp(0), nullptr, nullptr, nullptr, nullptr); @@ -119,7 +119,7 @@ TEST(Emplace, EmplaceDerived) { ProblemPtr P = Problem::create("POV", 3); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); auto sen = SensorBase::emplace<SensorOdom2d>(P->getHardware(), Eigen::VectorXd(3), ParamsSensorOdom2d()); auto cov = Eigen::MatrixXd::Identity(2,2); auto cpt = CaptureBase::emplace<CaptureOdom2d>(frm, TimeStamp(0), sen, Eigen::VectorXd(2), cov, nullptr); @@ -141,7 +141,7 @@ TEST(Emplace, ReturnDerived) ProblemPtr P = Problem::create("POV", 3); ASSERT_NE(P->getTrajectory(), nullptr); - auto frm = FrameBase::emplaceFrame<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); + auto frm = FrameBase::emplace<FrameBase>(P->getTrajectory(), TimeStamp(0), std::make_shared<StateBlock>(2,true), std::make_shared<StateBlock>(2,true)); auto cpt = CaptureBase::emplace<CaptureBase>(frm, "Dummy", TimeStamp(0), nullptr, nullptr, nullptr, nullptr); auto cov = Eigen::MatrixXd::Identity(2,2); auto ftr = FeatureBase::emplace<FeatureOdom2d>(cpt, Eigen::VectorXd(2), cov); diff --git a/test/gtest_factor_diff_drive.cpp b/test/gtest_factor_diff_drive.cpp index 61f38c020cc0a6fbc53b3c9f154e11bbf7f926a9..4f3ece70d92af1deeb923ce811d7a09dd96ba543 100644 --- a/test/gtest_factor_diff_drive.cpp +++ b/test/gtest_factor_diff_drive.cpp @@ -159,11 +159,11 @@ class FactorDiffDriveTest : public testing::Test processor = std::static_pointer_cast<ProcessorDiffDrivePublic>(prc); // frames - F0 = FrameBase::emplaceFrame<FrameBase>(trajectory, + F0 = FrameBase::emplace<FrameBase>(trajectory, 0.0, "PO", std::list<VectorXd>{Vector2d(0,0), Vector1d(0)}); - F1 = FrameBase::emplaceFrame<FrameBase>(trajectory, + F1 = FrameBase::emplace<FrameBase>(trajectory, 1.0, "PO", std::list<VectorXd>{Vector2d(1,0), Vector1d(0)}); diff --git a/test/gtest_frame_base.cpp b/test/gtest_frame_base.cpp index 8b651ae32e831d27a738feb66012779c4bbc7664..ac405e6fa1e9f4bcdc7976d8f0adc2014cb79c5f 100644 --- a/test/gtest_frame_base.cpp +++ b/test/gtest_frame_base.cpp @@ -65,8 +65,8 @@ TEST(FrameBase, LinksToTree) intrinsics_odo.k_disp_to_disp = 1; intrinsics_odo.k_rot_to_rot = 1; auto S = SensorBase::emplace<SensorOdom2d>(P->getHardware(), Vector3d::Zero(), intrinsics_odo); - auto F1 = FrameBase::emplaceFrame<FrameBase>(T, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); - auto F2 = FrameBase::emplaceFrame<FrameBase>(T, 2, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); + auto F1 = FrameBase::emplace<FrameBase>(T, 1, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); + auto F2 = FrameBase::emplace<FrameBase>(T, 2, make_shared<StateBlock>(2), make_shared<StateBlock>(1)); auto C = CaptureBase::emplace<CaptureMotion>(F1, "CaptureMotion", 1, S, Vector3d::Zero(), nullptr); WOLF_INFO("F2->getCaptureList().size() ", F2->getCaptureList().size()); auto p = std::make_shared<ProcessorOdom2d>(std::make_shared<ParamsProcessorOdom2d>());