diff --git a/CMakeLists.txt b/CMakeLists.txt index 7327661..197c791 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,11 @@ LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) +IF (NOT DEFINED REPO_DIR) + SET(REPO_DIR \".\") +ENDIF() +ADD_DEFINITIONS(-DREPO_DIR=${REPO_DIR}) + # required libs find_package(Eigen3 REQUIRED) find_package(OpenCV REQUIRED) diff --git a/examples/run_dso_euroc.cc b/examples/run_dso_euroc.cc index b52e4f8..919f689 100644 --- a/examples/run_dso_euroc.cc +++ b/examples/run_dso_euroc.cc @@ -27,8 +27,8 @@ using namespace ldso; std::string source = "/home/xiang/Dataset/EUROC/MH_01_easy/cam0"; std::string output_file = "./results.txt"; -std::string calib = "./examples/EUROC/EUROC.txt"; -std::string vocPath = "./vocab/orbvoc.dbow3"; +std::string calib = std::string(REPO_DIR) + "/examples/EUROC/EUROC.txt"; +std::string vocPath = std::string(REPO_DIR) + "/vocab/orbvoc.dbow3"; int startIdx = 0; int endIdx = 100000; diff --git a/examples/run_dso_kitti.cc b/examples/run_dso_kitti.cc index 1d60088..5f7fcde 100644 --- a/examples/run_dso_kitti.cc +++ b/examples/run_dso_kitti.cc @@ -30,8 +30,8 @@ using namespace ldso; std::string source = "/media/Data/Dataset/Kitti/dataset/sequences/00"; std::string output_file = "./results.txt"; -std::string calib = "./examples/Kitti/Kitti00-02.txt"; -std::string vocPath = "./vocab/orbvoc.dbow3"; +std::string calib = std::string(REPO_DIR) + "/examples/Kitti/Kitti00-02.txt"; +std::string vocPath = std::string(REPO_DIR) + "/vocab/orbvoc.dbow3"; int startIdx = 0; int endIdx = 100000; diff --git a/examples/run_dso_tum_mono.cc b/examples/run_dso_tum_mono.cc index 8d6fd9f..be6b71d 100644 --- a/examples/run_dso_tum_mono.cc +++ b/examples/run_dso_tum_mono.cc @@ -25,7 +25,7 @@ std::string gammaCalib = "/media/gaoxiang/Data1/Dataset/TUM-MONO/sequence_31/pca std::string source = "/media/gaoxiang/Data1/Dataset/TUM-MONO/sequence_31/"; std::string calib = "/media/gaoxiang/Data1/Dataset/TUM-MONO/sequence_31/camera.txt"; std::string output_file = "./results.txt"; -std::string vocPath = "./vocab/orbvoc.dbow3"; +std::string vocPath = std::string(REPO_DIR) + "/vocab/orbvoc.dbow3"; double rescale = 1; bool reversePlay = false; diff --git a/make_project.sh b/make_project.sh index d1756bd..3c5f37b 100755 --- a/make_project.sh +++ b/make_project.sh @@ -1,25 +1,26 @@ #!/usr/bin/env bash +set -e + BUILD_TYPE=Release NUM_PROC=4 BASEDIR="$PWD" cd "$BASEDIR/thirdparty/DBoW3" -mkdir build +mkdir -p build cd build cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. make -j$NUM_PROC cd "$BASEDIR/thirdparty/g2o" -mkdir build +mkdir -p build cd build cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. make -j$NUM_PROC cd "$BASEDIR" -mkdir build +mkdir -p build cd build -cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. -make -j$NUM_PROC - +cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DREPO_DIR=\"$BASEDIR\" .. +make -j$NUM_PROC \ No newline at end of file diff --git a/thirdparty/g2o/g2o/core/base_binary_edge.h b/thirdparty/g2o/g2o/core/base_binary_edge.h index 660e83a..c18f97f 100644 --- a/thirdparty/g2o/g2o/core/base_binary_edge.h +++ b/thirdparty/g2o/g2o/core/base_binary_edge.h @@ -56,8 +56,8 @@ namespace g2o { typedef typename BaseEdge::ErrorVector ErrorVector; typedef typename BaseEdge::InformationType InformationType; - typedef Eigen::Map, Matrix::Flags & AlignedBit ? Aligned : Unaligned > HessianBlockType; - typedef Eigen::Map, Matrix::Flags & AlignedBit ? Aligned : Unaligned > HessianBlockTransposedType; + typedef Eigen::Map, Matrix::Flags & PacketAccessBit ? Aligned : Unaligned > HessianBlockType; + typedef Eigen::Map, Matrix::Flags & PacketAccessBit ? Aligned : Unaligned > HessianBlockTransposedType; BaseBinaryEdge() : BaseEdge(), _hessianRowMajor(false), diff --git a/thirdparty/g2o/g2o/core/base_multi_edge.h b/thirdparty/g2o/g2o/core/base_multi_edge.h index dd2261f..cccc7ed 100644 --- a/thirdparty/g2o/g2o/core/base_multi_edge.h +++ b/thirdparty/g2o/g2o/core/base_multi_edge.h @@ -66,7 +66,7 @@ namespace g2o { typedef MatrixXd::MapType JacobianType; typedef typename BaseEdge::ErrorVector ErrorVector; typedef typename BaseEdge::InformationType InformationType; - typedef Eigen::Map HessianBlockType; + typedef Eigen::Map HessianBlockType; BaseMultiEdge() : BaseEdge() { diff --git a/thirdparty/g2o/g2o/core/base_vertex.h b/thirdparty/g2o/g2o/core/base_vertex.h index e375fde..a444ec3 100644 --- a/thirdparty/g2o/g2o/core/base_vertex.h +++ b/thirdparty/g2o/g2o/core/base_vertex.h @@ -59,7 +59,7 @@ namespace g2o { static const int Dimension = D; ///< dimension of the estimate (minimal) in the manifold space - typedef Eigen::Map, Matrix::Flags & AlignedBit ? Aligned : Unaligned > HessianBlockType; + typedef Eigen::Map, Matrix::Flags & PacketAccessBit ? Aligned : Unaligned > HessianBlockType; public: BaseVertex(); diff --git a/thirdparty/g2o/g2o/core/hyper_graph_action.cpp b/thirdparty/g2o/g2o/core/hyper_graph_action.cpp index 1fe2439..ed923c2 100644 --- a/thirdparty/g2o/g2o/core/hyper_graph_action.cpp +++ b/thirdparty/g2o/g2o/core/hyper_graph_action.cpp @@ -252,16 +252,14 @@ namespace g2o { void applyAction(HyperGraph* graph, HyperGraphElementAction* action, HyperGraphElementAction::Parameters* params, const std::string& typeName) { - for (HyperGraph::VertexIDMap::iterator it=graph->vertices().begin(); - it!=graph->vertices().end(); ++it){ - if ( typeName.empty() || typeid(*it->second).name()==typeName){ - (*action)(it->second, params); + for (const auto& it: graph->vertices()){ + if ( typeName.empty() || typeid(*it.second).name()==typeName){ + (*action)(it.second, params); } } - for (HyperGraph::EdgeSet::iterator it=graph->edges().begin(); - it!=graph->edges().end(); ++it){ - if ( typeName.empty() || typeid(**it).name()==typeName) - (*action)(*it, params); + for (const auto& it: graph->edges()){ + if ( typeName.empty() || typeid(*it).name()==typeName) + (*action)(it, params); } } diff --git a/thirdparty/g2o/g2o/core/optimizable_graph.cpp b/thirdparty/g2o/g2o/core/optimizable_graph.cpp index 8dc5e13..961b684 100644 --- a/thirdparty/g2o/g2o/core/optimizable_graph.cpp +++ b/thirdparty/g2o/g2o/core/optimizable_graph.cpp @@ -179,8 +179,9 @@ namespace g2o { for (size_t i=0; i<_parameters.size(); i++){ int index = _parameterIds[i]; *_parameters[i] = graph()->parameter(index); - if (typeid(**_parameters[i]).name()!=_parameterTypes[i]){ - cerr << __PRETTY_FUNCTION__ << ": FATAL, parameter type mismatch - encountered " << typeid(**_parameters[i]).name() << "; should be " << _parameterTypes[i] << endl; + const auto& ref_parameter = **_parameters[i]; + if (typeid(ref_parameter).name()!=_parameterTypes[i]){ + cerr << __PRETTY_FUNCTION__ << ": FATAL, parameter type mismatch - encountered " << typeid(ref_parameter).name() << "; should be " << _parameterTypes[i] << endl; } if (!*_parameters[i]) { cerr << __PRETTY_FUNCTION__ << ": FATAL, *_parameters[i] == 0" << endl;