Skip to content

Commit

Permalink
bugfix: NULL optimizer instance ...
Browse files Browse the repository at this point in the history
  • Loading branch information
feixh committed Sep 6, 2019
1 parent 19e071f commit ac67879
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mtune=native -march=native")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -funroll-loops")

set(CMAKE_BUILD_TYPE "Debug")
# set(CMAKE_BUILD_TYPE "Debug")
# set(CMAKE_BUILD_TYPE "RelWithDebInfo")
# set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_BUILD_TYPE "Release")
add_definitions(-DNDEBUG)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
Expand Down Expand Up @@ -55,6 +55,7 @@ include_directories(
${PROJECT_SOURCE_DIR}/thirdparty/jsoncpp/include
${PROJECT_SOURCE_DIR}/thirdparty/eigen-3.3.7/include/eigen3
${PROJECT_SOURCE_DIR}/thirdparty/gperftools/include
# ${PROJECT_SOURCE_DIR}/thirdparty/abseil-cpp

${PROJECT_SOURCE_DIR}/thirdparty/pybind11/include
${JSONCPP_INCLUDE_DIRS}
Expand Down
7 changes: 7 additions & 0 deletions src/estimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
#include "param.h"
#include "tracker.h"

#ifdef USE_G2O
#include "optimizer.h"
#endif

namespace xivo {

static const Mat3 I3{Mat3::Identity()};
Expand Down Expand Up @@ -291,6 +295,9 @@ Estimator::Estimator(const Json::Value &cfg)
// Initialize the visibility graph
// /////////////////////////////
Graph::Create();
#ifdef USE_G2O
Optimizer::Create(cfg_["optimizer"]);
#endif

// /////////////////////////////
// Load initial std on feature state
Expand Down
1 change: 1 addition & 0 deletions src/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ OptimizerPtr Optimizer::Create(const Json::Value &cfg) {
}

OptimizerPtr Optimizer::instance() {
CHECK(instance_ != nullptr);
return instance_.get();
}

Expand Down
6 changes: 2 additions & 4 deletions src/optimizer_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ struct GroupAdapter {
};

using ObsAdapterG = std::tuple<GroupAdapter, Vec2, Mat2>;
using VectorObsAdapterG = std::vector<ObsAdapterG,
Eigen::aligned_allocator<ObsAdapterG>>;
using VectorObsAdapterG = std::vector<ObsAdapterG>;
using ObsAdapterF = std::tuple<FeatureAdapter, Vec2, Mat2>;
using VectorObsAdapterF = std::vector<ObsAdapterF,
Eigen::aligned_allocator<ObsAdapterF>>;
using VectorObsAdapterF = std::vector<ObsAdapterF>;

} // namespace xivo

0 comments on commit ac67879

Please sign in to comment.