From d245a62dce71d86540cfcaa273823d5bdd343246 Mon Sep 17 00:00:00 2001 From: Joaquim Casals <jcasals@iri.upc.edu> Date: Tue, 14 May 2019 11:20:43 +0200 Subject: [PATCH] HOTFIX: addFeatureList --- CMakeLists.txt | 16 +++++++--------- src/capture/capture_base.cpp | 4 ++-- src/map/map_base.cpp | 18 ++++++++++-------- test/gtest_capture_base.cpp | 2 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dea914f14..75d015f9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -195,8 +195,6 @@ ENDIF (SPDLOG_INCLUDE_DIR) INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIRS}) include_directories("include") -include_directories(.) -# include_directories("templinks") IF(Ceres_FOUND) INCLUDE_DIRECTORIES(${CERES_INCLUDE_DIRS}) ENDIF(Ceres_FOUND) @@ -455,14 +453,14 @@ IF (Ceres_FOUND) include/core/ceres_wrapper/ceres_manager.h include/core/ceres_wrapper/cost_function_wrapper.h include/core/ceres_wrapper/create_numeric_diff_cost_function.h - include/core/ceres_wrapper/local_parametrization_wrapper.h + include/core/ceres_wrapper/local_parametrization_wrapper.h include/core/solver/solver_manager.h include/core/solver_suitesparse/sparse_utils.h ) SET(SRCS_WRAPPER #ceres_wrapper/qr_manager.cpp src/ceres_wrapper/ceres_manager.cpp - src/ceres_wrapper/local_parametrization_wrapper.cpp + src/ceres_wrapper/local_parametrization_wrapper.cpp src/solver/solver_manager.cpp ) ELSE(Ceres_FOUND) @@ -493,15 +491,15 @@ IF(YAMLCPP_FOUND) src/yaml/sensor_odom_3D_yaml.cpp ) ENDIF(YAMLCPP_FOUND) - + # create the shared library -ADD_LIBRARY(${PROJECT_NAME} - SHARED +ADD_LIBRARY(${PROJECT_NAME} + SHARED ${SRCS} - ${SRCS_BASE} + ${SRCS_BASE} ${SRCS_CAPTURE} ${SRCS_COMMON} - ${SRCS_DTASSC} + ${SRCS_DTASSC} ${SRCS_FACTOR} ${SRCS_FEATURE} ${SRCS_FRAME} diff --git a/src/capture/capture_base.cpp b/src/capture/capture_base.cpp index fef9c2ae9..78904aa8b 100644 --- a/src/capture/capture_base.cpp +++ b/src/capture/capture_base.cpp @@ -109,9 +109,9 @@ void CaptureBase::addFeatureList(FeatureBasePtrList& _new_ft_list) feature_ptr->setCapture(shared_from_this()); if (getProblem() != nullptr) feature_ptr->setProblem(getProblem()); - feature_list_.push_back(feature_ptr); + // feature_list_.push_back(feature_ptr); } -// feature_list_.splice(feature_list_.end(), _new_ft_list); + feature_list_.splice(feature_list_.end(), _new_ft_list); } void CaptureBase::getFactorList(FactorBasePtrList& _fac_list) diff --git a/src/map/map_base.cpp b/src/map/map_base.cpp index 94041ad51..204fc7b8f 100644 --- a/src/map/map_base.cpp +++ b/src/map/map_base.cpp @@ -37,14 +37,16 @@ void MapBase::addLandmarkList(LandmarkBasePtrList& _landmark_list) { for (auto lmk : _landmark_list) addLandmark(lmk); -// LandmarkBasePtrList lmk_list_copy = _landmark_list; //since _landmark_list will be empty after addDownNodeList() -// for (LandmarkBasePtr landmark_ptr : lmk_list_copy) -// { -// landmark_ptr->setMapPtr(shared_from_this()); -// landmark_ptr->setProblem(getProblem()); -// landmark_ptr->registerNewStateBlocks(); -// } -// landmark_list_.splice(landmark_list_.end(), _landmark_list); + + //TEMPORARY FIX, should be made compliant with the new emplace methodology + LandmarkBasePtrList lmk_list_copy = _landmark_list; //since _landmark_list will be empty after addDownNodeList() + for (LandmarkBasePtr landmark_ptr : lmk_list_copy) + { + landmark_ptr->setMap(shared_from_this()); + landmark_ptr->setProblem(getProblem()); + landmark_ptr->registerNewStateBlocks(); + } + landmark_list_.splice(landmark_list_.end(), _landmark_list); } void MapBase::load(const std::string& _map_file_dot_yaml) diff --git a/test/gtest_capture_base.cpp b/test/gtest_capture_base.cpp index e52b5497c..8bb84231d 100644 --- a/test/gtest_capture_base.cpp +++ b/test/gtest_capture_base.cpp @@ -99,7 +99,7 @@ TEST(CaptureBase, addFeatureList) C->addFeatureList((fl)); ASSERT_EQ(C->getFeatureList().size(), (unsigned int) 4); -// ASSERT_EQ(fl.size(), (unsigned int) 0); // features have been moved, not copied // EDIT 02-2019: features have been copied + ASSERT_EQ(fl.size(), (unsigned int) 0); // features have been moved, not copied // EDIT 02-2019: features have been copied ASSERT_EQ(C->getFeatureList().front(), f_first); ASSERT_EQ(C->getFeatureList().back(), f_last); } -- GitLab