diff --git a/CMakeLists.txt b/CMakeLists.txt index b9002bc5e8e89f7cd320d88b07d5359571948631..8342ba0d92db200763dd71e0bba90b9dbb3641dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -228,7 +228,7 @@ SET(HDRS_FACTOR include/core/factor/factor_pose_2d.h include/core/factor/factor_pose_3d.h include/core/factor/factor_quaternion_absolute.h - include/core/factor/factor_relative_2d_analytic.h + include/core/factor/factor_relative_pose_2d.h include/core/factor/factor_relative_pose_2d_with_extrinsics.h ) SET(HDRS_FEATURE diff --git a/include/core/factor/factor_odom_2d.h b/include/core/factor/factor_odom_2d.h index e79aaacdbdad0c49d18c74e05dc9b56a340ac801..b59cc723c7f8218ee39b18e0a160ece3b6eda74b 100644 --- a/include/core/factor/factor_odom_2d.h +++ b/include/core/factor/factor_odom_2d.h @@ -2,7 +2,7 @@ #define FACTOR_ODOM_2d_H_ //Wolf includes -#include "core/factor/factor_relative_2d_analytic.h" +#include "core/factor/factor_relative_pose_2d.h" #include <Eigen/StdVector> namespace wolf { @@ -10,7 +10,7 @@ namespace wolf { WOLF_PTR_TYPEDEFS(FactorOdom2d); //class -class FactorOdom2d : public FactorRelative2dAnalytic +class FactorOdom2d : public FactorRelativePose2d { public: FactorOdom2d(const FeatureBasePtr& _ftr_ptr, @@ -18,7 +18,7 @@ class FactorOdom2d : public FactorRelative2dAnalytic const ProcessorBasePtr& _processor_ptr, bool _apply_loss_function, FactorStatus _status = FAC_ACTIVE) : - FactorRelative2dAnalytic("FactorOdom2d", + FactorRelativePose2d("FactorOdom2d", _ftr_ptr, _frame_ptr, _processor_ptr, diff --git a/include/core/factor/factor_relative_2d_analytic.h b/include/core/factor/factor_relative_pose_2d.h similarity index 93% rename from include/core/factor/factor_relative_2d_analytic.h rename to include/core/factor/factor_relative_pose_2d.h index dfb06c429b10e205ffe93146269f32a05d664a7d..72e77ea03eb9989058c597bc02a13a32ac9d9cc6 100644 --- a/include/core/factor/factor_relative_2d_analytic.h +++ b/include/core/factor/factor_relative_pose_2d.h @@ -1,5 +1,5 @@ -#ifndef FACTOR_RELATIVE_2d_ANALYTIC_H_ -#define FACTOR_RELATIVE_2d_ANALYTIC_H_ +#ifndef FACTOR_RELATIVE_POSE_2d_H_ +#define FACTOR_RELATIVE_POSE_2d_H_ //Wolf includes #include "core/factor/factor_analytic.h" @@ -9,16 +9,16 @@ namespace wolf { -WOLF_PTR_TYPEDEFS(FactorRelative2dAnalytic); +WOLF_PTR_TYPEDEFS(FactorRelativePose2d); //class -class FactorRelative2dAnalytic : public FactorAnalytic +class FactorRelativePose2d : public FactorAnalytic { public: /** \brief Constructor of category FAC_FRAME **/ - FactorRelative2dAnalytic(const std::string& _tp, + FactorRelativePose2d(const std::string& _tp, const FeatureBasePtr& _ftr_ptr, const FrameBasePtr& _frame_other_ptr, const ProcessorBasePtr& _processor_ptr, @@ -43,7 +43,7 @@ class FactorRelative2dAnalytic : public FactorAnalytic /** \brief Constructor of category FAC_FEATURE **/ - FactorRelative2dAnalytic(const std::string& _tp, + FactorRelativePose2d(const std::string& _tp, const FeatureBasePtr& _ftr_ptr, const FeatureBasePtr& _ftr_other_ptr, const ProcessorBasePtr& _processor_ptr, @@ -68,7 +68,7 @@ class FactorRelative2dAnalytic : public FactorAnalytic /** \brief Constructor of category FAC_LANDMARK **/ - FactorRelative2dAnalytic(const std::string& _tp, + FactorRelativePose2d(const std::string& _tp, const FeatureBasePtr& _ftr_ptr, const LandmarkBasePtr& _landmark_other_ptr, const ProcessorBasePtr& _processor_ptr, @@ -96,7 +96,7 @@ class FactorRelative2dAnalytic : public FactorAnalytic return std::string("GEOM"); } - ~FactorRelative2dAnalytic() override = default; + ~FactorRelativePose2d() override = default; /** \brief Returns the factor residual size **/ @@ -139,7 +139,7 @@ class FactorRelative2dAnalytic : public FactorAnalytic /// IMPLEMENTATION /// -inline Eigen::VectorXd FactorRelative2dAnalytic::evaluateResiduals( +inline Eigen::VectorXd FactorRelativePose2d::evaluateResiduals( const std::vector<Eigen::Map<const Eigen::VectorXd> >& _st_vector) const { Eigen::VectorXd residual(3); @@ -155,7 +155,7 @@ inline Eigen::VectorXd FactorRelative2dAnalytic::evaluateResiduals( return residual; } -inline void FactorRelative2dAnalytic::evaluateJacobians(const std::vector<Eigen::Map<const Eigen::VectorXd> >& _st_vector, +inline void FactorRelativePose2d::evaluateJacobians(const std::vector<Eigen::Map<const Eigen::VectorXd> >& _st_vector, std::vector<Eigen::Map<Eigen::MatrixRowXd> >& jacobians, const std::vector<bool>& _compute_jacobian) const { @@ -191,7 +191,7 @@ inline void FactorRelative2dAnalytic::evaluateJacobians(const std::vector<Eigen: } } -inline void FactorRelative2dAnalytic::evaluateJacobians(const std::vector<Eigen::Map<const Eigen::VectorXd>>& _st_vector, +inline void FactorRelativePose2d::evaluateJacobians(const std::vector<Eigen::Map<const Eigen::VectorXd>>& _st_vector, std::vector<Eigen::MatrixXd>& jacobians, const std::vector<bool>& _compute_jacobian) const { @@ -227,7 +227,7 @@ inline void FactorRelative2dAnalytic::evaluateJacobians(const std::vector<Eigen: } } -inline void FactorRelative2dAnalytic::evaluatePureJacobians(std::vector<Eigen::MatrixXd>& jacobians) const +inline void FactorRelativePose2d::evaluatePureJacobians(std::vector<Eigen::MatrixXd>& jacobians) const { assert(jacobians.size() == 4); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 4363e38a4d4df67a73ce92086b7a3ae071c4a561..2e7d21c96e9061674a1d5108e45913f298994a3e 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -201,14 +201,14 @@ target_link_libraries(gtest_factor_pose_2d ${PLUGIN_NAME}) wolf_add_gtest(gtest_factor_pose_3d gtest_factor_pose_3d.cpp) target_link_libraries(gtest_factor_pose_3d ${PLUGIN_NAME}) +# FactorRelativePose2d class test +wolf_add_gtest(gtest_factor_relative_pose_2d gtest_factor_relative_pose_2d.cpp) +target_link_libraries(gtest_factor_relative_pose_2d ${PLUGIN_NAME}) + # FactorRelativePose2dWithExtrinsics class test wolf_add_gtest(gtest_factor_relative_pose_2d_with_extrinsics gtest_factor_relative_pose_2d_with_extrinsics.cpp) target_link_libraries(gtest_factor_relative_pose_2d_with_extrinsics ${PLUGIN_NAME}) -# FactorRelative2dAnalytic class test -wolf_add_gtest(gtest_factor_relative_2d_analytic gtest_factor_relative_2d_analytic.cpp) -target_link_libraries(gtest_factor_relative_2d_analytic ${PLUGIN_NAME}) - # MakePosDef function test wolf_add_gtest(gtest_make_posdef gtest_make_posdef.cpp) target_link_libraries(gtest_make_posdef ${PLUGIN_NAME}) diff --git a/test/gtest_factor_relative_2d_analytic.cpp b/test/gtest_factor_relative_pose_2d.cpp similarity index 88% rename from test/gtest_factor_relative_2d_analytic.cpp rename to test/gtest_factor_relative_pose_2d.cpp index 70cbc464716d50d60bb8ad05cfdb1a4bd6f79d95..8a46caebb25d6ffc0d50d779fcd7642c11140074 100644 --- a/test/gtest_factor_relative_2d_analytic.cpp +++ b/test/gtest_factor_relative_pose_2d.cpp @@ -1,7 +1,7 @@ #include "../include/core/ceres_wrapper/solver_ceres.h" #include "core/utils/utils_gtest.h" -#include "core/factor/factor_relative_2d_analytic.h" +#include "core/factor/factor_relative_pose_2d.h" #include "core/capture/capture_odom_2d.h" #include "core/math/rotations.h" @@ -25,12 +25,12 @@ FrameBasePtr frm1 = problem_ptr->emplaceFrame(1.0, Vector3d::Zero()); // Capture from frm1 to frm0 auto cap1 = CaptureBase::emplace<CaptureOdom2d>(frm1, 1, nullptr, Vector3d::Zero(), data_cov); -TEST(FactorRelative2dAnalytic, check_tree) +TEST(FactorRelativePose2d, check_tree) { ASSERT_TRUE(problem_ptr->check(0)); } -TEST(FactorRelative2dAnalytic, fix_0_solve) +TEST(FactorRelativePose2d, fix_0_solve) { for (int i = 0; i < 1e3; i++) { @@ -54,7 +54,7 @@ TEST(FactorRelative2dAnalytic, fix_0_solve) // feature & factor with delta measurement auto fea1 = FeatureBase::emplace<FeatureBase>(cap1, "FeatureOdom2d", delta, data_cov); - FactorBase::emplace<FactorRelative2dAnalytic>(fea1, "odom2d", fea1, frm0, nullptr, false); + FactorBase::emplace<FactorRelativePose2d>(fea1, "odom2d", fea1, frm0, nullptr, false); // Fix frm0, perturb frm1 frm0->fix(); @@ -71,7 +71,7 @@ TEST(FactorRelative2dAnalytic, fix_0_solve) } } -TEST(FactorRelative2dAnalytic, fix_1_solve) +TEST(FactorRelativePose2d, fix_1_solve) { for (int i = 0; i < 1e3; i++) { @@ -95,7 +95,7 @@ TEST(FactorRelative2dAnalytic, fix_1_solve) // feature & factor with delta measurement auto fea1 = FeatureBase::emplace<FeatureBase>(cap1, "FeatureOdom2d", delta, data_cov); - FactorBase::emplace<FactorRelative2dAnalytic>(fea1, "odom2d", fea1, frm0, nullptr, false); + FactorBase::emplace<FactorRelativePose2d>(fea1, "odom2d", fea1, frm0, nullptr, false); // Fix frm1, perturb frm0 frm1->fix();