From 146f83082ed1f92d6da08829b2bbd598562e6b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Wed, 27 May 2020 13:28:46 +0200 Subject: [PATCH] Remove getStructureSize() from Problem --- include/core/problem/problem.h | 29 +++++++++++++++++++++-------- src/problem/problem.cpp | 11 ----------- test/gtest_problem.cpp | 2 +- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/include/core/problem/problem.h b/include/core/problem/problem.h index a3557b0e9..e01c62094 100644 --- a/include/core/problem/problem.h +++ b/include/core/problem/problem.h @@ -83,8 +83,6 @@ class Problem : public std::enable_shared_from_this<Problem> // Properties ----------------------------------------- public: - SizeEigen getFrameStructureSize() const; - void getFrameStructureSize(SizeEigen& _x_size, SizeEigen& _cov_size) const; SizeEigen getDim() const; StateStructure getFrameStructure() const; @@ -208,7 +206,7 @@ class Problem : public std::enable_shared_from_this<Problem> const TimeStamp &_ts, const double &_time_tol); - /** \brief Emplace frame from string frame_structure + /** \brief Emplace frame from string frame_structure, dimension and vector * \param _frame_key_type Either KEY, AUXILIARY or NON_ESTIMATED * \param _time_stamp Time stamp of the frame * \param _frame_structure String indicating the frame structure. @@ -226,12 +224,14 @@ class Problem : public std::enable_shared_from_this<Problem> const SizeEigen _dim, // const Eigen::VectorXd& _frame_state); - /** \brief Emplace frame from string frame_structure + /** \brief Emplace frame from string frame_structure and state * \param _frame_key_type Either KEY, AUXILIARY or NON_ESTIMATED * \param _time_stamp Time stamp of the frame * \param _frame_structure String indicating the frame structure. * \param _frame_state State vector; must match the size and format of the chosen frame structure * + * - The dimension is taken from Problem + * * This acts as a Frame factory, but also takes care to update related lists in WolfProblem: * - Create a Frame * - Add it to Trajectory @@ -242,11 +242,14 @@ class Problem : public std::enable_shared_from_this<Problem> const StateStructure& _frame_structure, // const VectorComposite& _frame_state); - /** \brief Emplace frame from string frame_structure + /** \brief Emplace frame from state * \param _frame_key_type Either KEY, AUXILIARY or NON_ESTIMATED * \param _time_stamp Time stamp of the frame * \param _frame_state State; must be part of the problem's frame structure * + * - The structure is taken from Problem + * - The dimension is taken from Problem + * * This acts as a Frame factory, but also takes care to update related lists in WolfProblem: * - Create a Frame * - Add it to Trajectory @@ -256,12 +259,15 @@ class Problem : public std::enable_shared_from_this<Problem> const TimeStamp& _time_stamp, // const VectorComposite& _frame_state); - /** \brief Emplace frame from string frame_structure without state + /** \brief Emplace frame from string frame_structure and dimension * \param _frame_key_type Either KEY, AUXILIARY or NON_ESTIMATED * \param _time_stamp Time stamp of the frame * \param _frame_structure String indicating the frame structure. * \param _dim variable indicating the dimension of the problem * + * - The dimension is taken from Problem + * - The state is taken from Problem + * * This acts as a Frame factory, but also takes care to update related lists in WolfProblem: * - Create a Frame * - Add it to Trajectory @@ -272,11 +278,14 @@ class Problem : public std::enable_shared_from_this<Problem> const StateStructure& _frame_structure, // const SizeEigen _dim); - /** \brief Emplace frame from string frame_structure without structure + /** \brief Emplace frame from state vector * \param _frame_key_type Either KEY, AUXILIARY or NON_ESTIMATED * \param _time_stamp Time stamp of the frame * \param _frame_state State vector; must match the size and format of the chosen frame structure * + * - The structure is taken from Problem + * - The dimension is taken from Problem + * * This acts as a Frame factory, but also takes care to update related lists in WolfProblem: * - Create a Frame * - Add it to Trajectory @@ -286,10 +295,14 @@ class Problem : public std::enable_shared_from_this<Problem> const TimeStamp& _time_stamp, // const Eigen::VectorXd& _frame_state); - /** \brief Emplace frame from string frame_structure without structure nor state + /** \brief Emplace frame, guess all values * \param _frame_key_type Either KEY, AUXILIARY or NON_ESTIMATED * \param _time_stamp Time stamp of the frame * + * - The structure is taken from Problem + * - The dimension is taken from Problem + * - The state is taken from Problem + * * This acts as a Frame factory, but also takes care to update related lists in WolfProblem: * - Create a Frame * - Add it to Trajectory diff --git a/src/problem/problem.cpp b/src/problem/problem.cpp index 1cff3a842..c95128244 100644 --- a/src/problem/problem.cpp +++ b/src/problem/problem.cpp @@ -483,17 +483,6 @@ VectorComposite Problem::getState (const TimeStamp& _ts, const StateStructure& _ return state; } -SizeEigen Problem::getFrameStructureSize() const -{ - return state_size_; -} - -void Problem::getFrameStructureSize(SizeEigen& _x_size, SizeEigen& _cov_size) const -{ - _x_size = state_size_; - _cov_size = state_cov_size_; -} - SizeEigen Problem::getDim() const { return dim_; diff --git a/test/gtest_problem.cpp b/test/gtest_problem.cpp index 1d5fb2694..f173cb849 100644 --- a/test/gtest_problem.cpp +++ b/test/gtest_problem.cpp @@ -74,7 +74,7 @@ TEST(Problem, create) ASSERT_EQ(P, P->getMap()->getProblem()); // check frame structure through the state size - ASSERT_EQ(P->getFrameStructureSize(), 10); + ASSERT_EQ(P->getFrameStructure(), "POV"); } TEST(Problem, Sensors) -- GitLab