From 5baec3e4c2e51a9d683b52b1177434cbe38a3cac Mon Sep 17 00:00:00 2001
From: solomonhe <solomonhe@zhaoxin.com>
Date: Wed, 20 Sep 2017 18:10:09 +0800
Subject: [PATCH] remove catkin_make manchanism

---
 camera_model/CMakeLists.txt                | 20 +++---
 camera_model/CMakeLists.txt.back           | 67 ++++++++++++++++++
 camera_model/CMakeLists.txt.new            | 82 ++++++++++++++++++++++
 config/euroc/vins_result.csv               | 54 ++++++--------
 generate.sh                                | 13 ++++
 vins_estimator/CMakeLists.txt              | 14 ++--
 vins_estimator/src/utility/visualization.h |  6 +-
 7 files changed, 201 insertions(+), 55 deletions(-)
 create mode 100644 camera_model/CMakeLists.txt.back
 create mode 100644 camera_model/CMakeLists.txt.new
 create mode 100755 generate.sh

diff --git a/camera_model/CMakeLists.txt b/camera_model/CMakeLists.txt
index 0775f0a..7d53fa4 100644
--- a/camera_model/CMakeLists.txt
+++ b/camera_model/CMakeLists.txt
@@ -5,10 +5,10 @@ set(CMAKE_BUILD_TYPE "Release")
 set(CMAKE_CXX_FLAGS "-std=c++11")
 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fPIC")
 
-find_package(catkin REQUIRED COMPONENTS
+#find_package(catkin REQUIRED COMPONENTS
    # roscpp
    # std_msgs
-    )
+#    )
 
 find_package(Boost REQUIRED COMPONENTS filesystem program_options system)
 include_directories(${Boost_INCLUDE_DIRS})
@@ -20,16 +20,16 @@ find_package(Ceres REQUIRED)
 include_directories(${CERES_INCLUDE_DIRS})
 
 
-catkin_package(
-    INCLUDE_DIRS include
-    LIBRARIES camera_model
+#catkin_package(
+#   INCLUDE_DIRS include
+#   LIBRARIES camera_model
    # CATKIN_DEPENDS roscpp std_msgs
 #    DEPENDS system_lib
-    )
+#   )
 
-include_directories(
-    ${catkin_INCLUDE_DIRS}
-    )
+#include_directories(
+#   ${catkin_INCLUDE_DIRS}
+#    )
 
 include_directories("include")
 
@@ -49,7 +49,7 @@ include_directories("include")
 #     src/gpl/gpl.cc
 #     src/gpl/EigenQuaternionParameterization.cc)
 
-add_library(camera_model
+add_library(camera_model STATIC
     src/chessboard/Chessboard.cc
     src/calib/CameraCalibration.cc
     src/camera_models/Camera.cc
diff --git a/camera_model/CMakeLists.txt.back b/camera_model/CMakeLists.txt.back
new file mode 100644
index 0000000..0775f0a
--- /dev/null
+++ b/camera_model/CMakeLists.txt.back
@@ -0,0 +1,67 @@
+cmake_minimum_required(VERSION 2.8.3)
+project(camera_model)
+
+set(CMAKE_BUILD_TYPE "Release")
+set(CMAKE_CXX_FLAGS "-std=c++11")
+set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fPIC")
+
+find_package(catkin REQUIRED COMPONENTS
+   # roscpp
+   # std_msgs
+    )
+
+find_package(Boost REQUIRED COMPONENTS filesystem program_options system)
+include_directories(${Boost_INCLUDE_DIRS})
+
+find_package(OpenCV REQUIRED)
+
+# set(EIGEN_INCLUDE_DIR "/usr/local/include/eigen3")
+find_package(Ceres REQUIRED)
+include_directories(${CERES_INCLUDE_DIRS})
+
+
+catkin_package(
+    INCLUDE_DIRS include
+    LIBRARIES camera_model
+   # CATKIN_DEPENDS roscpp std_msgs
+#    DEPENDS system_lib
+    )
+
+include_directories(
+    ${catkin_INCLUDE_DIRS}
+    )
+
+include_directories("include")
+
+
+# add_executable(Calibration 
+#     src/intrinsic_calib.cc
+#     src/chessboard/Chessboard.cc
+#     src/calib/CameraCalibration.cc
+#     src/camera_models/Camera.cc
+#     src/camera_models/CameraFactory.cc
+#     src/camera_models/CostFunctionFactory.cc
+#     src/camera_models/PinholeCamera.cc
+#     src/camera_models/CataCamera.cc
+#     src/camera_models/EquidistantCamera.cc
+#     src/camera_models/ScaramuzzaCamera.cc
+#     src/sparse_graph/Transform.cc
+#     src/gpl/gpl.cc
+#     src/gpl/EigenQuaternionParameterization.cc)
+
+add_library(camera_model
+    src/chessboard/Chessboard.cc
+    src/calib/CameraCalibration.cc
+    src/camera_models/Camera.cc
+    src/camera_models/CameraFactory.cc
+    src/camera_models/CostFunctionFactory.cc
+    src/camera_models/PinholeCamera.cc
+    src/camera_models/CataCamera.cc
+    src/camera_models/EquidistantCamera.cc
+    src/camera_models/ScaramuzzaCamera.cc
+    src/sparse_graph/Transform.cc
+    src/gpl/gpl.cc
+    src/gpl/EigenQuaternionParameterization.cc)
+
+# target_link_libraries(Calibration ${Boost_LIBRARIES} ${OpenCV_LIBS} ${CERES_LIBRARIES})
+target_link_libraries(camera_model ${Boost_LIBRARIES} ${OpenCV_LIBS} ${CERES_LIBRARIES})
diff --git a/camera_model/CMakeLists.txt.new b/camera_model/CMakeLists.txt.new
new file mode 100644
index 0000000..a3d6ecc
--- /dev/null
+++ b/camera_model/CMakeLists.txt.new
@@ -0,0 +1,82 @@
+cmake_minimum_required(VERSION 2.8.3)
+project(camera_model)
+
+set(CMAKE_BUILD_TYPE "Release")
+set(CMAKE_CXX_FLAGS "-std=c++11")
+set(CMAKE_CXX_FLAGS_RELEASE "-O3 -fPIC")
+set(Boost_INCLUDE_DIRS "/usr/include/")
+set(CERES_INCLUDE_DIRS "/usr/local/include/")
+set(EIGEN_INCLUDE_DIRS "/usr/include/eigen3/")
+
+find_package(catkin REQUIRED COMPONENTS
+   # roscpp
+   # std_msgs
+    )
+
+#find_package(Boost REQUIRED COMPONENTS filesystem program_options system)
+include_directories(${Boost_INCLUDE_DIRS})
+
+#find_package(OpenCV REQUIRED)
+
+# set(EIGEN_INCLUDE_DIR "/usr/local/include/eigen3")
+#find_package(Ceres REQUIRED)
+include_directories(${CERES_INCLUDE_DIRS})
+include_directories(${EIGEN_INCLUDE_DIRS})
+include_directories("/home/solomon/merge_vins_version/src/camera_model/include")
+	
+LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu/")
+LINK_DIRECTORIES("/usr/local/lib/")
+
+
+catkin_package(
+    INCLUDE_DIRS include
+    LIBRARIES camera_model
+   # CATKIN_DEPENDS roscpp std_msgs
+    DEPENDS system_lib
+    )
+
+include_directories(
+    ${catkin_INCLUDE_DIRS}
+    )
+
+message ( ${Boost_INCLUDE_DIRS} " " ${OpenCV_INCLUDE_DIRS} " " ${CERES_INCLUDE_DIRS})
+include_directories("include")
+
+
+# add_executable(Calibration 
+#     src/intrinsic_calib.cc
+#     src/chessboard/Chessboard.cc
+#     src/calib/CameraCalibration.cc
+#     src/camera_models/Camera.cc
+#     src/camera_models/CameraFactory.cc
+#     src/camera_models/CostFunctionFactory.cc
+#     src/camera_models/PinholeCamera.cc
+#     src/camera_models/CataCamera.cc
+#     src/camera_models/EquidistantCamera.cc
+#     src/camera_models/ScaramuzzaCamera.cc
+#     src/sparse_graph/Transform.cc
+#     src/gpl/gpl.cc
+#     src/gpl/EigenQuaternionParameterization.cc)
+
+add_library(camera_model
+    src/chessboard/Chessboard.cc
+    src/calib/CameraCalibration.cc
+    src/camera_models/Camera.cc
+    src/camera_models/CameraFactory.cc
+    src/camera_models/CostFunctionFactory.cc
+    src/camera_models/PinholeCamera.cc
+    src/camera_models/CataCamera.cc
+    src/camera_models/EquidistantCamera.cc
+    src/camera_models/ScaramuzzaCamera.cc
+    src/sparse_graph/Transform.cc
+    src/gpl/gpl.cc
+    src/gpl/EigenQuaternionParameterization.cc)
+
+# target_link_libraries(Calibration ${Boost_LIBRARIES} ${OpenCV_LIBS} ${CERES_LIBRARIES})
+message (${catkin_LIBRARIES}  ${OpenCV_LIBRARIES} " " ${CERES_LIBRARIES})
+target_link_libraries(camera_model 
+		boost_filesystem boost_program_options boost_system
+	 	opencv_calib3d opencv_core opencv_features2d  opencv_flann opencv_highgui opencv_imgcodecs opencv_imgproc opencv_ml opencv_objdetect   opencv_photo  opencv_shape opencv_stitching opencv_superres  opencv_video opencv_videoio opencv_videostab	
+		ceres
+		)
+#target_link_libraries(camera_model ${Boost_LIBRARIES} ${OpenCV_LIBS} ${CERES_LIBRARIES})
diff --git a/config/euroc/vins_result.csv b/config/euroc/vins_result.csv
index 0b2d2d9..92ca44d 100644
--- a/config/euroc/vins_result.csv
+++ b/config/euroc/vins_result.csv
@@ -1,33 +1,21 @@
-1403636580863555328,-0.00803,0.01404,-0.10554,-0.03047,0.83609,0.03787,0.54643,0.08553,0.00236,0.78173,
-1403636580963555584,-0.00023,0.01560,-0.02811,-0.02236,0.82764,0.03815,0.55952,0.06424,0.02455,0.74397,
-1403636581063555584,0.00563,0.01780,0.04182,-0.02333,0.81990,0.03888,0.57071,0.05342,0.01281,0.65223,
-1403636581163555328,0.01035,0.01788,0.10184,-0.02545,0.81167,0.03497,0.58251,0.03820,-0.00889,0.54040,
-1403636581263555584,0.01215,0.01651,0.14870,-0.02823,0.80180,0.03075,0.59613,0.00004,-0.01710,0.39110,
-1403636581363555328,0.01045,0.01536,0.17341,-0.02793,0.79408,0.03090,0.60638,-0.02189,-0.01629,0.08044,
-1403636581463555584,0.00862,0.01312,0.16633,-0.02199,0.79466,0.03323,0.60575,-0.02103,-0.02351,-0.27572,
-1403636581563555584,0.00580,0.01096,0.13048,-0.01928,0.80145,0.03360,0.59680,-0.00737,-0.00925,-0.53646,
-1403636581663555328,0.00392,0.00840,0.07198,-0.02240,0.80819,0.03217,0.58761,-0.00683,-0.02862,-0.64024,
-1403636581763555584,0.00175,0.00395,0.00790,-0.02405,0.81119,0.03346,0.58332,-0.02685,-0.02759,-0.66670,
-1403636581863555328,-0.00316,0.00148,-0.05932,-0.02781,0.81330,0.03544,0.58010,-0.05484,-0.01280,-0.67446,
-1403636581963555584,-0.00899,0.00102,-0.12504,-0.02922,0.82003,0.03270,0.57064,-0.05727,0.00298,-0.61760,
-1403636582063555584,-0.01348,0.00132,-0.18243,-0.02653,0.82963,0.03022,0.55686,-0.04993,0.01151,-0.48820,
-1403636582163555328,-0.01750,0.00416,-0.22119,-0.02726,0.83838,0.03177,0.54348,-0.04183,0.02990,-0.24124,
-1403636582263555584,-0.01952,0.00682,-0.22919,-0.02849,0.84347,0.03399,0.53535,0.00961,0.02492,0.09813,
-1403636582363555328,-0.01739,0.01017,-0.20012,-0.03071,0.84276,0.03438,0.53632,0.02572,0.03946,0.43852,
-1403636582463555584,-0.01435,0.01307,-0.14673,-0.03167,0.83513,0.03362,0.54811,0.04119,0.02455,0.59625,
-1403636582563555584,-0.00998,0.01437,-0.08289,-0.02797,0.82877,0.03317,0.55791,0.04166,0.00638,0.65668,
-1403636582663555328,-0.00638,0.01384,-0.01593,-0.02191,0.82579,0.03149,0.56267,0.02779,-0.00932,0.66361,
-1403636582763555584,-0.00248,0.01143,0.05041,-0.02080,0.82269,0.02733,0.56745,0.04713,-0.03348,0.65288,
-1403636582863555328,0.00305,0.00708,0.11520,-0.01762,0.81638,0.01860,0.57695,0.03959,-0.04492,0.63288,
-1403636582963555584,0.00610,0.00300,0.17202,-0.01600,0.80677,0.01321,0.59050,0.00652,-0.03174,0.48584,
-1403636583063555584,0.00677,0.00081,0.20573,-0.01467,0.79867,0.01267,0.60145,-0.00442,-0.01574,0.19336,
-1403636583163555328,0.00724,-0.00145,0.20787,-0.01084,0.79721,0.01367,0.60345,-0.00523,-0.01612,-0.15293,
-1403636583263555584,0.00757,-0.00162,0.17900,-0.00964,0.79899,0.01634,0.60105,0.00808,-0.00397,-0.42203,
-1403636583363555328,0.00826,-0.00300,0.12903,-0.01106,0.80150,0.01821,0.59761,0.00372,-0.01837,-0.59630,
-1403636583463555584,0.00773,-0.00562,0.06580,-0.01445,0.80470,0.02224,0.59309,-0.01485,-0.01437,-0.67946,
-1403636583563555584,0.00711,-0.00741,-0.00382,-0.01476,0.80909,0.02575,0.58693,-0.01344,-0.01828,-0.70470,
-1403636583663555328,0.00371,-0.01035,-0.07432,-0.01533,0.81713,0.02656,0.57564,-0.04043,0.00787,-0.69073,
-1403636583763555584,-0.00064,-0.01048,-0.13820,-0.02237,0.82978,0.02329,0.55715,-0.04853,-0.00262,-0.58733,
-1403636583863555328,-0.00522,-0.01017,-0.19120,-0.02380,0.83966,0.02150,0.54216,-0.05338,-0.00580,-0.46944,
-1403636583963555584,-0.01064,-0.00999,-0.22970,-0.02053,0.84401,0.02731,0.53523,-0.06048,0.01127,-0.28283,
-1403636584063555584,-0.01519,-0.00699,-0.24521,-0.02423,0.84462,0.03322,0.53379,-0.03199,0.02921,-0.02543,
+1403636580863555328,-0.00682,0.01361,-0.10559,-0.03014,0.83605,0.03655,0.54660,0.08347,-0.00007,0.78361,
+1403636580963555584,0.00063,0.01544,-0.02783,-0.02147,0.82770,0.03682,0.55955,0.06403,0.02669,0.74688,
+1403636581063555584,0.00615,0.01809,0.04191,-0.02227,0.81983,0.03778,0.57093,0.05168,0.01699,0.65374,
+1403636581163555328,0.01111,0.01832,0.10225,-0.02462,0.81161,0.03404,0.58269,0.03790,-0.00546,0.54246,
+1403636581263555584,0.01280,0.01693,0.15032,-0.02759,0.80171,0.02989,0.59633,-0.00011,-0.01448,0.39584,
+1403636581363555328,0.01139,0.01555,0.17670,-0.02755,0.79400,0.03025,0.60654,-0.02140,-0.01516,0.08846,
+1403636581463555584,0.00908,0.01307,0.17128,-0.02164,0.79456,0.03262,0.60593,-0.02207,-0.02356,-0.26511,
+1403636581563555584,0.00549,0.00999,0.13216,-0.01908,0.80127,0.03309,0.59708,-0.00963,-0.01141,-0.53333,
+1403636581663555328,0.00425,0.00813,0.07301,-0.02201,0.80807,0.03159,0.58783,-0.00746,-0.02882,-0.63866,
+1403636581763555584,0.00224,0.00486,0.00733,-0.02349,0.81096,0.03284,0.58371,-0.02661,-0.02463,-0.66817,
+1403636581863555328,-0.00138,0.00367,-0.06040,-0.02713,0.81300,0.03475,0.58059,-0.05044,-0.00807,-0.67626,
+1403636581963555584,-0.00817,0.00223,-0.12536,-0.02875,0.81964,0.03210,0.57126,-0.05571,0.00334,-0.61787,
+1403636582063555584,-0.01213,0.00277,-0.18242,-0.02620,0.82923,0.02980,0.55750,-0.04757,0.01217,-0.48734,
+1403636582163555328,-0.01622,0.00515,-0.22037,-0.02718,0.83794,0.03162,0.54417,-0.04202,0.02804,-0.23759,
+1403636582263555584,-0.01772,0.00836,-0.22837,-0.02825,0.84309,0.03385,0.53596,0.00988,0.02487,0.10118,
+1403636582363555328,-0.01587,0.01169,-0.20023,-0.03057,0.84238,0.03442,0.53691,0.02481,0.03975,0.43828,
+1403636582463555584,-0.01297,0.01503,-0.14738,-0.03150,0.83479,0.03368,0.54864,0.04002,0.02633,0.59434,
+1403636582563555584,-0.00857,0.01659,-0.08374,-0.02783,0.82850,0.03326,0.55831,0.04103,0.00831,0.65473,
+1403636582663555328,-0.00482,0.01614,-0.01704,-0.02198,0.82559,0.03169,0.56295,0.02796,-0.00796,0.66134,
+1403636582763555584,-0.00074,0.01393,0.04883,-0.02104,0.82247,0.02764,0.56775,0.04750,-0.03124,0.64922,
+1403636582863555328,0.00401,0.00921,0.11337,-0.01810,0.81604,0.01893,0.57741,0.03674,-0.04480,0.62943,
diff --git a/generate.sh b/generate.sh
new file mode 100755
index 0000000..78d0a66
--- /dev/null
+++ b/generate.sh
@@ -0,0 +1,13 @@
+#/bin/bash
+cd camera_model
+mkdir -p build
+cd build
+cmake ..
+make 
+
+cd ../../vins_estimator
+mkdir -p build
+cd build 
+cmake ..
+make
+
diff --git a/vins_estimator/CMakeLists.txt b/vins_estimator/CMakeLists.txt
index 73e1ffa..cf72665 100644
--- a/vins_estimator/CMakeLists.txt
+++ b/vins_estimator/CMakeLists.txt
@@ -6,26 +6,22 @@ set(CMAKE_CXX_FLAGS "-std=c++11")
 #-DEIGEN_USE_MKL_ALL")
 set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g")
 
-find_package(catkin REQUIRED COMPONENTS
-  camera_model
-#  cv_bridge
-   
-    )
+include_directories(${CMAKE_SOURCE_DIR}/../camera_model/include)
+add_library( lib_camera_model STATIC IMPORTED )
+set_target_properties(lib_camera_model PROPERTIES IMPORTED_LOCATION  ${CMAKE_SOURCE_DIR}/../camera_model/build/libcamera_model.a)
 
 find_package(OpenCV REQUIRED)
 
 find_package(Ceres REQUIRED)
 
-include_directories(${catkin_INCLUDE_DIRS} ${CERES_INCLUDE_DIRS})
+include_directories(${CERES_INCLUDE_DIRS})
 
 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
 find_package(Eigen3  REQUIRED)
 include_directories(
-  ${catkin_INCLUDE_DIRS}
   ${EIGEN3_INCLUDE_DIR}
 )
 
-catkin_package()
 
 add_executable(vins_estimator
     src/estimator_node.cpp
@@ -59,6 +55,6 @@ add_executable(vins_estimator
     )
 
 
-target_link_libraries(vins_estimator ${catkin_LIBRARIES} ${OpenCV_LIBS} ${CERES_LIBRARIES}) 
+target_link_libraries(vins_estimator lib_camera_model ${OpenCV_LIBS} ${CERES_LIBRARIES}) 
 
 
diff --git a/vins_estimator/src/utility/visualization.h b/vins_estimator/src/utility/visualization.h
index 3e5da48..0686c65 100644
--- a/vins_estimator/src/utility/visualization.h
+++ b/vins_estimator/src/utility/visualization.h
@@ -3,8 +3,8 @@
 #include <eigen3/Eigen/Dense>
 #include "../estimator.h"
 #include "../parameters.h"
-#include "../../include/Vector3.h"
-#include "../../include/Quaternion.h"
+#include "../../../include/Vector3.h"
+#include "../../../include/Quaternion.h"
 #include <fstream>
 
 
@@ -70,4 +70,4 @@ void updateLoopPath(nav_msgs::Path _loop_path);
 
 void pubTF(const Estimator &estimator, const std_msgs::Header &header, Eigen::Vector3d loop_correct_t,
                    Eigen::Matrix3d loop_correct_r);
-#endif
\ No newline at end of file
+#endif