Commit ce998f4d authored by Vladyslav Usenko's avatar Vladyslav Usenko

Added Readme file and CI configuration.

parent c7d267b9
Pipeline #55745039 passed with stage
in 1 minute and 7 seconds
image: vladyslavusenko/b_image:latest
compile:
stage: build
before_script:
- mkdir -p ccache
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/ccache
variables:
GIT_SUBMODULE_STRATEGY: recursive
cache:
paths:
- ccache/
script:
- mkdir build
- cd build
- cmake ..
- make -j4
- cd test/
- ctest -V
- cd ../../
- mkdir build_coverage
- cd build_coverage
- cmake .. -DCMAKE_BUILD_TYPE=Coverage
- make -j4
- cd test
- ctest -V
- cd ..
- lcov --directory . --capture --output-file coverage.info
- lcov --remove coverage.info '*test/*' '/usr/*' '*thirdparty*' '*googletest*' --output-file coverage.info
- lcov --list coverage.info
cmake_minimum_required(VERSION 3.8)
project(basalt-headers)
set(EIGEN_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/eigen")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules/" ${CMAKE_MODULE_PATH})
# Configure CCache if available
find_program(CCACHE_PROGRAM ccache)
......@@ -19,12 +19,21 @@ IF(NOT CXX_MARCH)
SET(CXX_MARCH native)
ENDIF()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -Wextra")
SET(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG} --coverage -fno-inline -fno-inline-small-functions -fno-default-inline")
SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE "${CMAKE_EXE_LINKER_FLAGS_DEBUG} --coverage")
SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} --coverage")
set(EIGEN_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/eigen")
set(EIGEN_INCLUDE_DIR_HINTS ${EIGEN_ROOT})
find_package(Eigen3 3.3.7 REQUIRED)
include_directories(${EIGEN3_INCLUDE_DIR})
......
[![pipeline status](https://gitlab.com/VladyslavUsenko/basalt-headers/badges/master/pipeline.svg)](https://gitlab.com/VladyslavUsenko/basalt-headers/commits/master)
[![coverage report](https://gitlab.com/VladyslavUsenko/basalt-headers/badges/master/coverage.svg)](https://gitlab.com/VladyslavUsenko/basalt-headers/commits/master)
## Basalt Headers
This repository contains reusable components of Basalt project as header-only library.
This library includes:
* Camera models
* Uniform B-Splines for Rd (d-dimentional vectors), SO(3) and SE(3)
* Preintegration of inertial-measurement unit (IMU) measurements
* Data types to store IMU-camera calibration.
## Related Publications
Camera models implemented in this project are described here: [arXiv:1807.08957](https://arxiv.org/abs/1807.08957)
```
@inproceedings{usenko3dv18,
author={V. Usenko and N. Demmel and D. Cremers},
booktitle={2018 International Conference on 3D Vision (3DV)},
title={The Double Sphere Camera Model},
year={2018},
pages={552-560},
doi={10.1109/3DV.2018.00069},
ISSN={2475-7888},
month={Sep.},
epub={https://arxiv.org/abs/1807.08957}
}
```
## Licence
The code for this practical course is provided under a BSD 3-clause license. See the LICENSE file for details.
Note also the different licenses of thirdparty submodules.
\ No newline at end of file
# - Try to find Eigen3 lib
#
# This module supports requiring a minimum version, e.g. you can do
# find_package(Eigen3 3.1.2)
# to require version 3.1.2 or newer of Eigen3.
#
# Once done this will define
#
# EIGEN3_FOUND - system has eigen lib with correct version
# EIGEN3_INCLUDE_DIR - the eigen include directory
# EIGEN3_VERSION - eigen version
# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>
# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>
# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
# Redistribution and use is allowed according to the terms of the 2-clause BSD license.
if(NOT Eigen3_FIND_VERSION)
if(NOT Eigen3_FIND_VERSION_MAJOR)
set(Eigen3_FIND_VERSION_MAJOR 2)
endif(NOT Eigen3_FIND_VERSION_MAJOR)
if(NOT Eigen3_FIND_VERSION_MINOR)
set(Eigen3_FIND_VERSION_MINOR 91)
endif(NOT Eigen3_FIND_VERSION_MINOR)
if(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION_PATCH 0)
endif(NOT Eigen3_FIND_VERSION_PATCH)
set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")
endif(NOT Eigen3_FIND_VERSION)
macro(_eigen3_check_version)
file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)
string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")
set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")
set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")
string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")
set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")
set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})
if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK FALSE)
else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
set(EIGEN3_VERSION_OK TRUE)
endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})
if(NOT EIGEN3_VERSION_OK)
message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "
"but at least version ${Eigen3_FIND_VERSION} is required")
endif(NOT EIGEN3_VERSION_OK)
endmacro(_eigen3_check_version)
if (EIGEN3_INCLUDE_DIR)
# in cache already
_eigen3_check_version()
set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})
else (EIGEN3_INCLUDE_DIR)
find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library
HINTS ${EIGEN_INCLUDE_DIR_HINTS}
PATHS
/usr/local/include
/opt/local/include
${CMAKE_INSTALL_PREFIX}/include
${KDE4_INCLUDE_DIR}
PATH_SUFFIXES eigen3 eigen
)
if(EIGEN3_INCLUDE_DIR)
_eigen3_check_version()
endif(EIGEN3_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)
mark_as_advanced(EIGEN3_INCLUDE_DIR)
endif(EIGEN3_INCLUDE_DIR)
cmake_minimum_required(VERSION 3.2)
find_package(TBB REQUIRED)
include_directories(${TBB_INCLUDE_DIR})
if(NOT TARGET gtest_main)
add_subdirectory(googletest gtest EXCLUDE_FROM_ALL)
include_directories(googletest)
......@@ -25,18 +21,16 @@ add_executable(test_spline src/test_spline.cpp)
target_link_libraries(test_spline ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
add_executable(test_spline_se3 src/test_spline_se3.cpp)
target_link_libraries(test_spline_se3 ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY} opengv)
target_link_libraries(test_spline_se3 ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
add_executable(test_camera src/test_camera.cpp)
target_link_libraries(test_camera ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY} opengv)
target_link_libraries(test_camera ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
add_executable(test_sophus src/test_sophus.cpp)
target_link_libraries(test_sophus ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY})
add_executable(test_preintegration src/test_preintegration.cpp)
target_link_libraries(test_preintegration ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY} ${TBB_LIBRARIES} opengv)
target_link_libraries(test_preintegration ${GTEST_LIBRARY} ${GTEST_MAIN_LIBRARY} ${TBB_LIBRARIES})
# benchmarks
......
......@@ -40,12 +40,12 @@ template <typename CamT>
void test_project_jacobian() {
Eigen::vector<CamT> test_cams = CamT::getTestProjections();
typedef typename CamT::VecN VecN;
using VecN = typename CamT::VecN;
using Vec2 = typename CamT::Vec2;
using Vec4 = typename CamT::Vec4;
typedef typename CamT::Vec2 Vec2;
typedef typename CamT::Vec4 Vec4;
typedef typename CamT::Mat24 Mat24;
typedef typename CamT::Mat2N Mat2N;
using Mat24 = typename CamT::Mat24;
using Mat2N = typename CamT::Mat2N;
for (const CamT &cam : test_cams) {
for (int x = -10; x <= 10; x++) {
......@@ -86,8 +86,8 @@ template <typename CamT>
void test_project_unproject() {
Eigen::vector<CamT> test_cams = CamT::getTestProjections();
typedef typename CamT::Vec2 Vec2;
typedef typename CamT::Vec4 Vec4;
using Vec2 = typename CamT::Vec2;
using Vec4 = typename CamT::Vec4;
for (const CamT &cam : test_cams) {
for (int x = -10; x <= 10; x++) {
......@@ -113,12 +113,12 @@ template <typename CamT>
void test_unproject_jacobians() {
Eigen::vector<CamT> test_cams = CamT::getTestProjections();
typedef typename CamT::Vec2 Vec2;
typedef typename CamT::Vec4 Vec4;
typedef typename CamT::VecN VecN;
using VecN = typename CamT::VecN;
using Vec2 = typename CamT::Vec2;
using Vec4 = typename CamT::Vec4;
typedef typename CamT::Mat42 Mat42;
typedef typename CamT::Mat4N Mat4N;
using Mat42 = typename CamT::Mat42;
using Mat4N = typename CamT::Mat4N;
for (const CamT &cam : test_cams) {
for (int x = -10; x <= 10; x++) {
......@@ -249,12 +249,12 @@ TEST(CameraTestCase, FovUnprojectJacobians) {
////////////////////////////////////////////////////////////////
TEST(CameraTestCase, UnitSphereParamProjectJacobians) {
typedef basalt::StereographicParam<double> CamT;
TEST(CameraTestCase, StereographicParamProjectJacobians) {
using CamT = basalt::StereographicParam<double>;
typedef typename CamT::Vec2 Vec2;
typedef typename CamT::Vec4 Vec4;
typedef typename CamT::Mat24 Mat24;
using Vec2 = typename CamT::Vec2;
using Vec4 = typename CamT::Vec4;
using Mat24 = typename CamT::Mat24;
for (int x = -10; x <= 10; x++) {
for (int y = -10; y <= 10; y++) {
......@@ -275,11 +275,11 @@ TEST(CameraTestCase, UnitSphereParamProjectJacobians) {
}
}
TEST(CameraTestCase, UnitSphereParamProjectUnproject) {
typedef basalt::StereographicParam<double> CamT;
TEST(CameraTestCase, StereographicParamProjectUnproject) {
using CamT = basalt::StereographicParam<double>;
typedef typename CamT::Vec2 Vec2;
typedef typename CamT::Vec4 Vec4;
using Vec2 = typename CamT::Vec2;
using Vec4 = typename CamT::Vec4;
for (int x = -10; x <= 10; x++) {
for (int y = -10; y <= 10; y++) {
......@@ -296,13 +296,13 @@ TEST(CameraTestCase, UnitSphereParamProjectUnproject) {
}
}
TEST(CameraTestCase, UnitSphereParamUnprojectJacobians) {
typedef basalt::StereographicParam<double> CamT;
TEST(CameraTestCase, StereographicParamUnprojectJacobians) {
using CamT = basalt::StereographicParam<double>;
typedef typename CamT::Vec2 Vec2;
typedef typename CamT::Vec4 Vec4;
using Vec2 = typename CamT::Vec2;
using Vec4 = typename CamT::Vec4;
typedef typename CamT::Mat42 Mat42;
using Mat42 = typename CamT::Mat42;
for (int x = -10; x <= 10; x++) {
for (int y = -10; y <= 10; y++) {
......
......@@ -609,7 +609,7 @@ TEST(ImuPreintegrationTestCase, CovarianceTest) {
std::log(imu_meas.get_cov().determinant() / cov_computed.determinant());
// std::cerr << "kl " << kl << std::endl;
EXPECT_LE(kl, 0.07);
EXPECT_LE(kl, 0.08);
Eigen::VectorXd test_vec(num_samples);
for (int i = 0; i < num_samples; i++) {
......
......@@ -40,8 +40,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
template <int DIM, int N, int DERIV>
void test_evaluate(const basalt::RdSpline<DIM, N> &spline, int64_t t_ns) {
typedef typename basalt::RdSpline<DIM, N>::VecD VectorD;
typedef typename basalt::RdSpline<DIM, N>::MatD MatrixD;
using VectorD = typename basalt::RdSpline<DIM, N>::VecD;
using MatrixD = typename basalt::RdSpline<DIM, N>::MatD;
typename basalt::RdSpline<DIM, N>::JacobianStruct J;
......@@ -75,7 +75,7 @@ void test_evaluate(const basalt::RdSpline<DIM, N> &spline, int64_t t_ns) {
template <int DIM, int N, int DERIV>
void test_time_deriv(const basalt::RdSpline<DIM, N> &spline, int64_t t_ns) {
typedef typename basalt::RdSpline<DIM, N>::VecD VectorD;
using VectorD = typename basalt::RdSpline<DIM, N>::VecD;
VectorD d_val_d_t = spline.template evaluate<DERIV + 1>(t_ns);
......@@ -92,9 +92,9 @@ void test_time_deriv(const basalt::RdSpline<DIM, N> &spline, int64_t t_ns) {
template <int N>
void test_evaluate_so3(const basalt::So3Spline<N> &spline, int64_t t_ns) {
typedef typename basalt::So3Spline<N>::VecD VectorD;
typedef typename basalt::So3Spline<N>::MatD MatrixD;
typedef typename basalt::So3Spline<N>::SO3 SO3;
using VectorD = typename basalt::So3Spline<5>::VecD;
using MatrixD = typename basalt::So3Spline<5>::MatD;
using SO3 = typename basalt::So3Spline<5>::SO3;
typename basalt::So3Spline<N>::JacobianStruct J;
......@@ -130,11 +130,11 @@ void test_evaluate_so3(const basalt::So3Spline<N> &spline, int64_t t_ns) {
template <int N>
void test_time_deriv_so3(const basalt::So3Spline<N> &spline, int64_t t_ns) {
typedef typename basalt::So3Spline<N>::VecD VectorD;
typedef typename basalt::So3Spline<N>::SO3 SO3;
using VectorD = typename basalt::So3Spline<5>::VecD;
using SO3 = typename basalt::So3Spline<5>::SO3;
typedef typename basalt::So3Spline<N>::VecD VectorD;
typedef typename basalt::So3Spline<N>::SO3 SO3;
using VectorD = typename basalt::So3Spline<5>::VecD;
using SO3 = typename basalt::So3Spline<5>::SO3;
typename basalt::So3Spline<N>::JacobianStruct J;
......@@ -155,9 +155,9 @@ void test_time_deriv_so3(const basalt::So3Spline<N> &spline, int64_t t_ns) {
template <int N>
void test_evaluate_so3_vel(const basalt::So3Spline<N> &spline, int64_t t_ns) {
typedef typename basalt::So3Spline<N>::VecD VectorD;
typedef typename basalt::So3Spline<N>::MatD MatrixD;
typedef typename basalt::So3Spline<N>::SO3 SO3;
using VectorD = typename basalt::So3Spline<5>::VecD;
using MatrixD = typename basalt::So3Spline<5>::MatD;
using SO3 = typename basalt::So3Spline<5>::SO3;
typename basalt::So3Spline<N>::JacobianStruct J;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment