Skip to content

Commit

Permalink
Update CMakeLists.txt, build error persists.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilspin committed Mar 30, 2019
1 parent eed8386 commit fa4e0ac
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 34 deletions.
34 changes: 25 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,49 @@ set(CUHELPER_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/cuda_helper")
#Compile GladLib
set(GLAD_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/glad/include")
set(GLAD_SRC "${GLAD_INCLUDE_DIR}/../src/glad.c")
add_library("GladLib" ${GLAD_SRC})
target_include_directories("GladLib" PRIVATE "${GLAD_INCLUDE_DIR}")
add_library(GladLib ${GLAD_SRC})
target_include_directories(GladLib PRIVATE "${GLAD_INCLUDE_DIR}")

add_library(ShaderProgram STATIC ShaderProgram.hpp)
set_target_properties(ShaderProgram PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(ShaderProgram GladLib)

add_library(Window STATIC Window.cpp)
target_link_libraries(Window SDL2)

add_library(Camera STATIC camera.cpp)
target_link_libraries(Camera SDL2)

#Compile CameraTrackingUtils
#add_library(CameraTrackingUtils STATIC LinearSystem.cu CameraTrackingUtils.cu)
add_library(CameraTrackingUtils STATIC Solver.cu CameraTrackingUtils.cu)
add_library(CameraTrackingUtils STATIC SE3.hpp Solver.cpp Solver.cu CameraTracking.cpp CameraTrackingUtils.cu)
set_target_properties(CameraTrackingUtils PROPERTIES LINKER_LANGUAGE CUDA)
set_target_properties(CameraTrackingUtils PROPERTIES POSITION_INDEPENDENT_CODE ON)
#set_target_properties(CameraTrackingUtils PROPERTIES CUDA_SEPARABLE_COMPILATION ON)

add_library(Application STATIC Application.cpp)
target_link_libraries(Application Camera)
target_link_libraries(Application Window)
#target_link_libraries(Application ShaderProgram)
target_link_libraries(Application CameraTracking)

set(INCLUDE_DIRS ${INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS} ${CUHELPER_INCLUDE_DIR} ${EIGEN3_INCLUDE_DIR} ${GLM_INCLUDE_DIR}
${OPENGL_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS} ${GLAD_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}) #${ARMADILLO_INCLUDE_DIR}

set(LIBS ${LIBS} ${OPENGL_LIBRARY} ${CUDA_LIBRARIES} ${SDL2_LIBRARIES} ${Boost_LIBRARIES} ${GladLib}) #${ARMADILLO_LIBRARY}
set(LIBS ${LIBS} ${OPENGL_LIBRARY} ${CUDA_LIBRARIES} ${SDL2_LIBRARIES} ${Boost_LIBRARIES} ${GladLib} ${ShaderProgram}
${Window} ${Camera} ${Application}) #${ARMADILLO_LIBRARY}

#specify include directory
#include_directories(${CMAKE_SOURCE_DIR} )
include_directories(${INCLUDE_DIRS})

set(SOURCES common.h DepthMain.cpp camera.cpp Window.cpp Application.cpp Solver.cpp CameraTracking.cpp prereq.h ShaderProgram.hpp Frustum.cpp camera.h Window.h
Application.h Frustum.h CameraTracking.h Solver.h EigenUtil.h termcolor.hpp DebugHelper.hpp ${GLAD_SRC})
set(HEADERS prereq.h common.h camera.h Window.h ShaderProgram.hpp Solver.h CameraTracking.h Application.h EigenUtil.h termcolor.hpp DebugHelper.hpp)
set(SOURCES DepthMain.cpp ${GLAD_SRC}) #Frustum.cpp Frustum.h Application.cpp camera.cpp Window.cpp


add_executable(${PROJECT_NAME} ${SOURCES})
add_executable(${PROJECT_NAME} ${SOURCES} ) #${HEADERS}

#Link all obj files
target_link_libraries(${PROJECT_NAME} CameraTrackingUtils ${LIBS} SDL2 -lcublas) #SDL2::SDL2
target_link_libraries(${PROJECT_NAME} ${LIBS} Application CameraTrackingUtils SDL2 -lcublas) #SDL2::SDL2

#Now copy shaders to build directory

Expand Down
27 changes: 2 additions & 25 deletions EigenUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,12 @@
#include <unsupported/Eigen/MatrixFunctions>

using Matrix6x7f = Eigen::Matrix<float, 6, 7>;
using Matrix6x6f = Eigen::Matrix<float, 6, 6, Eigen::RowMajor>;
//using Matrix6x6f = Eigen::Matrix<float, 6, 6, Eigen::RowMajor>;
using Matrix6x6f = Eigen::Matrix<float, 6, 6>;
using Matrix4x4f = Eigen::Matrix<float, 4, 4>;
using Matrix3x3f = Eigen::Matrix<float, 3, 3>;
using Vector6f = Eigen::Matrix<float, 6, 1>;
using Vector4f = Eigen::Matrix<float, 4, 1>;

// Takes SE3 group object, linearly approximates rotation, returns projected matrix in real space
Matrix4x4f SE3Exp(const Vector6f& twist) {
Matrix4x4f M;
M << 0, -twist(5), twist(4), twist(0),
twist(5), 0, -twist(3), twist(1),
-twist(4), twist(3), 0, twist(2),
0, 0, 0, 0;
return M.exp();
}

// Takes SE3 Lie algebra, projects it to abstract SE3 space
Vector6f SE3Log(const Matrix4x4f& transform) {
Matrix4x4f M = transform.log();
Vector6f twist;
twist << M(0,3), M(1,3), M(2,3), M(2,1), M(0,2), M(1,0);
return twist;
}

// Notice. While we store rotation/translations as SE3 group elements, we need to
// project them back to real space in order to compute any meaningful transform between
// them because transform directly in abstract space is not possible
Vector6f updateTransform(const Vector6f& perturbation, const Vector6f prev_estimate) {
return SE3Log(SE3Exp(perturbation)*SE3Exp(prev_estimate));
}

#endif //EIGEN_UTIL
33 changes: 33 additions & 0 deletions SE3.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef SE3_HPP
#define SE3_HPP

#include "EigenUtil.h"

// Takes SE3 group object, linearly approximates rotation, returns projected matrix in real space
Matrix4x4f SE3Exp(const Vector6f& twist) {
Matrix4x4f M;
M << 0, -twist(5), twist(4), twist(0),
twist(5), 0, -twist(3), twist(1),
-twist(4), twist(3), 0, twist(2),
0, 0, 0, 0;
return M.exp();
}

// Takes SE3 Lie algebra, projects it to abstract SE3 space
Vector6f SE3Log(const Matrix4x4f& transform) {
Matrix4x4f M = transform.log();
Vector6f twist;
twist << M(0,3), M(1,3), M(2,3), M(2,1), M(0,2), M(1,0);
return twist;
}

// Notice. While we store rotation/translations as SE3 group elements, we need to
// project them back to real space in order to compute any meaningful transform between
// them because transform directly in abstract space is not possible
Vector6f updateTransform(const Vector6f& perturbation, const Vector6f prev_estimate) {
return SE3Log(SE3Exp(perturbation)*SE3Exp(prev_estimate));
}



#endif
2 changes: 2 additions & 0 deletions Solver.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "cuda_helper/helper_cuda.h"
#include <cublas_v2.h>
#include <cuda_runtime.h>
#include "SE3.hpp"

//#include <thrust/device_vector.h>
//#include <thrust/device_ptr.h>

Expand Down

0 comments on commit fa4e0ac

Please sign in to comment.