diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ef04416a453111262294f4c1d85026bac986c821..7383cf8b87eebe8fddd44fc03ea0d039fdcd4914 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,9 @@ +stages: + - license + - build_and_test + - deploy + - final + ############ YAML ANCHORS ############ .preliminaries_template: &preliminaries_definition ## Install ssh-agent if not already installed, it is required by Docker. @@ -24,7 +30,8 @@ - cd $CI_PROJECT_DIR # configure git - - export CI_NEW_BRANCH=ci_processing$CI_COMMIT_SHORT_SHA + - export CI_NEW_BRANCH=ci_processing$RANDOM + - echo creating new temporary branch... $CI_NEW_BRANCH - git config --global user.email "${CI_EMAIL}" - git config --global user.name "${CI_USERNAME}" - git checkout -b $CI_NEW_BRANCH # temporary branch @@ -67,12 +74,7 @@ - ../bin/hello_wolf_autoconf - make install -stages: - - license - - build_and_test - - deploy - - final - +############ LICENSE HEADERS ############ license_header: stage: license image: labrobotica/wolf_deps:16.04 @@ -81,6 +83,7 @@ license_header: script: - *license_header_definition +############ UBUNTU 16.04 TESTS ############ build_and_test:xenial: stage: build_and_test image: labrobotica/wolf_deps:16.04 @@ -89,6 +92,7 @@ build_and_test:xenial: script: - *build_and_test_definition +############ UBUNTU 18.04 TESTS ############ build_and_test:bionic: stage: build_and_test image: labrobotica/wolf_deps:18.04 @@ -97,6 +101,7 @@ build_and_test:bionic: script: - *build_and_test_definition +############ DEPLOY PLUGINS ############ deploy_imu: stage: deploy variables: @@ -145,7 +150,8 @@ deploy_bodydynamics: project: mobile_robotics/wolf_projects/wolf_lib/plugins/bodydynamics strategy: depend +############ WAIT FOR PLUGINS ############ final_all: stage: final script: - - echo "ALL PLUGINS PIPELINES SUCCEED!!!" \ No newline at end of file + - echo "ALL PLUGINS PIPELINES SUCCEED!!!" diff --git a/CMakeLists.txt b/CMakeLists.txt index 59ac01c884611487db832e7019ff41c92ae7081a..32122e793bc0f69a9c41d941173862f4fe332468 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,6 @@ endif(COMMAND cmake_policy) # MAC OSX RPATH SET(CMAKE_MACOSX_RPATH 1) - # The project name PROJECT(core) set(PLUGIN_NAME "wolf${PROJECT_NAME}") @@ -88,27 +87,17 @@ IF(BUILD_DEMOS OR BUILD_TESTS) set(_WOLF_ROOT_DIR ${CMAKE_SOURCE_DIR}) ENDIF(BUILD_DEMOS OR BUILD_TESTS) - -#START_SRC -------------------------------------------------------------------------------------------------------------------------------- - #CMAKE modules - SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake_modules") MESSAGE(STATUS "Cmake modules at: " ${CMAKE_MODULE_PATH}) - -#find dependencies. - +#find dependencies FIND_PACKAGE(Threads REQUIRED) - -FIND_PACKAGE(Ceres REQUIRED) #Ceres is required - +FIND_PACKAGE(Ceres REQUIRED) FIND_PACKAGE(Eigen3 3.3 REQUIRED) if(${EIGEN3_VERSION_STRING} VERSION_LESS 3.3) message(FATAL_ERROR "Wolf requires Eigen >= 3.3. Found Eigen ${EIGEN3_VERSION_STRING}") endif() - -# YAML with yaml-cpp FIND_PACKAGE(YamlCpp REQUIRED) # Define the directory where will be the configured config.h @@ -138,7 +127,6 @@ ELSE (SPDLOG_INCLUDE_DIR) MESSAGE(FATAL_ERROR "Could not find spdlog") ENDIF (SPDLOG_INCLUDE_DIR) - # Includes INCLUDE_DIRECTORIES("include") # In this same project INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS}) @@ -146,63 +134,6 @@ INCLUDE_DIRECTORIES(${YAMLCPP_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${CERES_INCLUDE_DIRS}) #HEADERS - -SET(HDRS_COMMON - include/core/common/factory.h - include/core/common/node_base.h - include/core/common/time_stamp.h - include/core/common/wolf.h - include/core/common/params_base.h - ) -SET(HDRS_MATH - include/core/math/SE2.h - include/core/math/SE3.h - include/core/math/rotations.h - include/core/math/covariance.h - ) -SET(HDRS_UTILS - include/core/utils/check_log.h - include/core/utils/converter.h - include/core/utils/eigen_assert.h - include/core/utils/eigen_predicates.h - include/core/utils/graph_search.h - include/core/utils/loader.h - include/core/utils/logging.h - include/core/utils/make_unique.h - include/core/utils/params_server.h - include/core/utils/singleton.h - include/core/utils/utils_gtest.h - include/core/utils/converter_utils.h - ) -SET(HDRS_PROBLEM - include/core/problem/problem.h - ) -SET(HDRS_HARDWARE - include/core/hardware/hardware_base.h - ) -SET(HDRS_TRAJECTORY - include/core/trajectory/trajectory_base.h - ) -SET(HDRS_MAP - include/core/map/map_base.h - ) -SET(HDRS_FRAME - include/core/frame/frame_base.h - ) -SET(HDRS_STATE_BLOCK - include/core/state_block/factory_state_block.h - include/core/state_block/has_state_blocks.h - include/core/state_block/local_parametrization_angle.h - include/core/state_block/local_parametrization_base.h - include/core/state_block/local_parametrization_homogeneous.h - include/core/state_block/local_parametrization_quaternion.h - include/core/state_block/state_angle.h - include/core/state_block/state_block.h - include/core/state_block/state_composite.h - include/core/state_block/state_homogeneous_3d.h - include/core/state_block/state_quaternion.h - ) - SET(HDRS_CAPTURE include/core/capture/capture_base.h include/core/capture/capture_motion.h @@ -212,6 +143,13 @@ SET(HDRS_CAPTURE include/core/capture/capture_void.h include/core/capture/capture_diff_drive.h ) +SET(HDRS_COMMON + include/core/common/factory.h + include/core/common/node_base.h + include/core/common/time_stamp.h + include/core/common/wolf.h + include/core/common/params_base.h + ) SET(HDRS_FACTOR include/core/factor/factor_analytic.h include/core/factor/factor_autodiff.h @@ -236,10 +174,28 @@ SET(HDRS_FEATURE include/core/feature/feature_odom_2d.h include/core/feature/feature_pose.h ) +SET(HDRS_FRAME + include/core/frame/frame_base.h + ) +SET(HDRS_HARDWARE + include/core/hardware/hardware_base.h + ) SET(HDRS_LANDMARK include/core/landmark/landmark_base.h include/core/landmark/landmark_match.h ) +SET(HDRS_MATH + include/core/math/SE2.h + include/core/math/SE3.h + include/core/math/rotations.h + include/core/math/covariance.h + ) +SET(HDRS_MAP + include/core/map/map_base.h + ) +SET(HDRS_PROBLEM + include/core/problem/problem.h + ) SET(HDRS_PROCESSOR include/core/processor/is_motion.h include/core/processor/motion_buffer.h @@ -271,54 +227,48 @@ SET(HDRS_SOLVER include/core/solver/solver_manager.h include/core/solver/factory_solver.h ) +SET(HDRS_STATE_BLOCK + include/core/state_block/factory_state_block.h + include/core/state_block/has_state_blocks.h + include/core/state_block/local_parametrization_angle.h + include/core/state_block/local_parametrization_base.h + include/core/state_block/local_parametrization_homogeneous.h + include/core/state_block/local_parametrization_quaternion.h + include/core/state_block/state_angle.h + include/core/state_block/state_block.h + include/core/state_block/state_composite.h + include/core/state_block/state_homogeneous_3d.h + include/core/state_block/state_quaternion.h + ) +SET(HDRS_TRAJECTORY + include/core/trajectory/trajectory_base.h + ) SET(HDRS_TREE_MANAGER include/core/tree_manager/factory_tree_manager.h include/core/tree_manager/tree_manager_base.h include/core/tree_manager/tree_manager_sliding_window.h include/core/tree_manager/tree_manager_sliding_window_dual_rate.h ) +SET(HDRS_UTILS + include/core/utils/check_log.h + include/core/utils/converter.h + include/core/utils/eigen_assert.h + include/core/utils/eigen_predicates.h + include/core/utils/graph_search.h + include/core/utils/loader.h + include/core/utils/logging.h + include/core/utils/make_unique.h + include/core/utils/params_server.h + include/core/utils/singleton.h + include/core/utils/utils_gtest.h + include/core/utils/converter_utils.h + ) SET(HDRS_YAML include/core/yaml/parser_yaml.h include/core/yaml/yaml_conversion.h ) + #SOURCES -SET(SRCS_PROBLEM - src/problem/problem.cpp - ) -SET(SRCS_HARDWARE - src/hardware/hardware_base.cpp - ) -SET(SRCS_TRAJECTORY - src/trajectory/trajectory_base.cpp - ) -SET(SRCS_MAP - src/map/map_base.cpp - ) -SET(SRCS_FRAME - src/frame/frame_base.cpp - ) -SET(SRCS_STATE_BLOCK - src/state_block/has_state_blocks.cpp - src/state_block/local_parametrization_base.cpp - src/state_block/local_parametrization_homogeneous.cpp - src/state_block/local_parametrization_quaternion.cpp - src/state_block/state_block.cpp - src/state_block/state_composite.cpp - ) -SET(SRCS_COMMON - src/common/node_base.cpp - src/common/time_stamp.cpp - ) -SET(SRCS_MATH - ) -SET(SRCS_UTILS - src/utils/check_log.cpp - src/utils/converter_utils.cpp - src/utils/graph_search.cpp - src/utils/loader.cpp - src/utils/params_server.cpp - ) - SET(SRCS_CAPTURE src/capture/capture_base.cpp src/capture/capture_motion.cpp @@ -328,6 +278,10 @@ SET(SRCS_CAPTURE src/capture/capture_void.cpp src/capture/capture_diff_drive.cpp ) +SET(SRCS_COMMON + src/common/node_base.cpp + src/common/time_stamp.cpp + ) SET(SRCS_FACTOR src/factor/factor_analytic.cpp src/factor/factor_base.cpp @@ -338,9 +292,21 @@ SET(SRCS_FEATURE src/feature/feature_odom_2d.cpp src/feature/feature_pose.cpp ) +SET(SRCS_FRAME + src/frame/frame_base.cpp + ) +SET(SRCS_HARDWARE + src/hardware/hardware_base.cpp + ) SET(SRCS_LANDMARK src/landmark/landmark_base.cpp ) +SET(SRCS_MAP + src/map/map_base.cpp + ) +SET(SRCS_PROBLEM + src/problem/problem.cpp + ) SET(SRCS_PROCESSOR src/processor/is_motion.cpp src/processor/motion_buffer.cpp @@ -368,10 +334,28 @@ SET(SRCS_SENSOR SET(SRCS_SOLVER src/solver/solver_manager.cpp ) +SET(SRCS_STATE_BLOCK + src/state_block/has_state_blocks.cpp + src/state_block/local_parametrization_base.cpp + src/state_block/local_parametrization_homogeneous.cpp + src/state_block/local_parametrization_quaternion.cpp + src/state_block/state_block.cpp + src/state_block/state_composite.cpp + ) +SET(SRCS_TRAJECTORY + src/trajectory/trajectory_base.cpp + ) SET(SRCS_TREE_MANAGER src/tree_manager/tree_manager_sliding_window.cpp src/tree_manager/tree_manager_sliding_window_dual_rate.cpp ) +SET(SRCS_UTILS + src/utils/check_log.cpp + src/utils/converter_utils.cpp + src/utils/graph_search.cpp + src/utils/loader.cpp + src/utils/params_server.cpp + ) SET(SRCS_YAML src/yaml/parser_yaml.cpp src/yaml/processor_odom_3d_yaml.cpp @@ -379,10 +363,10 @@ SET(SRCS_YAML src/yaml/sensor_odom_3d_yaml.cpp src/yaml/sensor_pose_yaml.cpp ) + #OPTIONALS -#optional HDRS and SRCS IF (Ceres_FOUND) - SET(HDRS_WRAPPER + SET(HDRS_CERES_WRAPPER #ceres_wrapper/qr_manager.h include/core/ceres_wrapper/cost_function_wrapper.h include/core/ceres_wrapper/create_numeric_diff_cost_function.h @@ -392,32 +376,26 @@ IF (Ceres_FOUND) include/core/solver/solver_manager.h include/core/solver_suitesparse/sparse_utils.h ) - SET(SRCS_WRAPPER + SET(SRCS_CERES_WRAPPER #ceres_wrapper/qr_manager.cpp src/ceres_wrapper/solver_ceres.cpp src/ceres_wrapper/local_parametrization_wrapper.cpp src/solver/solver_manager.cpp ) ELSE(Ceres_FOUND) - SET(HDRS_WRAPPER) - SET(SRCS_WRAPPER) + SET(HDRS_CERES_WRAPPER) + SET(SRCS_CERES_WRAPPER) ENDIF(Ceres_FOUND) -IF (cereal_FOUND) -ADD_SUBDIRECTORY(serialization/cereal) -ENDIF(cereal_FOUND) - IF (Suitesparse_FOUND) - #DOES NOTHING?! #ADD_SUBDIRECTORY(solver_suitesparse) ENDIF(Suitesparse_FOUND) # create the shared library ADD_LIBRARY(${PLUGIN_NAME} SHARED - ${SRCS} - ${SRCS_BASE} ${SRCS_CAPTURE} + ${SRCS_CERES_WRAPPER} ${SRCS_COMMON} ${SRCS_FACTOR} ${SRCS_FEATURE} @@ -425,7 +403,6 @@ ADD_LIBRARY(${PLUGIN_NAME} ${SRCS_HARDWARE} ${SRCS_LANDMARK} ${SRCS_MAP} - ${SRCS_MATH} ${SRCS_PROBLEM} ${SRCS_PROCESSOR} ${SRCS_SENSOR} @@ -434,7 +411,6 @@ ADD_LIBRARY(${PLUGIN_NAME} ${SRCS_TRAJECTORY} ${SRCS_TREE_MANAGER} ${SRCS_UTILS} - ${SRCS_WRAPPER} ${SRCS_YAML} ) @@ -458,30 +434,33 @@ IF (Ceres_FOUND) TARGET_LINK_LIBRARIES(${PLUGIN_NAME} ${CERES_LIBRARIES}) ENDIF(Ceres_FOUND) +#Build tests +#===============EXAMPLE========================= IF(BUILD_TESTS) MESSAGE(STATUS "Will build tests.") add_subdirectory(test) ENDIF(BUILD_TESTS) +#Build demos +#===============EXAMPLE========================= IF(BUILD_DEMOS) - #Build demos MESSAGE(STATUS "Will build demos.") ADD_SUBDIRECTORY(demos) ENDIF(BUILD_DEMOS) - #install library - #============================================================= INSTALL(TARGETS ${PLUGIN_NAME} EXPORT ${PLUGIN_NAME}Targets RUNTIME DESTINATION bin - LIBRARY DESTINATION lib/iri-algorithms - ARCHIVE DESTINATION lib/iri-algorithms) + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) install(EXPORT ${PLUGIN_NAME}Targets DESTINATION lib/cmake/${PLUGIN_NAME}) #install headers INSTALL(FILES ${HDRS_CAPTURE} DESTINATION include/iri-algorithms/wolf/plugin_core/core/capture) +INSTALL(FILES ${HDRS_CERES_WRAPPER} + DESTINATION include/iri-algorithms/wolf/plugin_core/core/ceres_wrapper) INSTALL(FILES ${HDRS_COMMON} DESTINATION include/iri-algorithms/wolf/plugin_core/core/common) INSTALL(FILES ${HDRS_FACTOR} @@ -504,12 +483,10 @@ INSTALL(FILES ${HDRS_PROCESSOR} DESTINATION include/iri-algorithms/wolf/plugin_core/core/processor) INSTALL(FILES ${HDRS_SENSOR} DESTINATION include/iri-algorithms/wolf/plugin_core/core/sensor) -INSTALL(FILES ${HDRS_SERIALIZATION} - DESTINATION include/iri-algorithms/wolf/plugin_core/core/serialization) INSTALL(FILES ${HDRS_SOLVER} DESTINATION include/iri-algorithms/wolf/plugin_core/core/solver) -INSTALL(FILES ${HDRS_SOLVER_SUITESPARSE} - DESTINATION include/iri-algorithms/wolf/plugin_core/core/solver_suitesparse) +#INSTALL(FILES ${HDRS_SOLVER_SUITESPARSE} +# DESTINATION include/iri-algorithms/wolf/plugin_core/core/solver_suitesparse) INSTALL(FILES ${HDRS_STATE_BLOCK} DESTINATION include/iri-algorithms/wolf/plugin_core/core/state_block) INSTALL(FILES ${HDRS_TRAJECTORY} @@ -518,14 +495,14 @@ INSTALL(FILES ${HDRS_TREE_MANAGER} DESTINATION include/iri-algorithms/wolf/plugin_core/core/tree_manager) INSTALL(FILES ${HDRS_UTILS} DESTINATION include/iri-algorithms/wolf/plugin_core/core/utils) -INSTALL(FILES ${HDRS_WRAPPER} - DESTINATION include/iri-algorithms/wolf/plugin_core/core/ceres_wrapper) INSTALL(FILES ${HDRS_YAML} DESTINATION include/iri-algorithms/wolf/plugin_core/core/yaml) FILE(WRITE ${PLUGIN_NAME}.found "") INSTALL(FILES ${PLUGIN_NAME}.found DESTINATION include/iri-algorithms/wolf/plugin_core) +INSTALL(FILES "${WOLF_CONFIG_DIR}/config.h" + DESTINATION include/iri-algorithms/wolf/plugin_core/core/internal) #install Find*.cmake configure_file("${CMAKE_SOURCE_DIR}/cmake_modules/${PLUGIN_NAME}Config.cmake" @@ -534,9 +511,6 @@ configure_file("${CMAKE_SOURCE_DIR}/cmake_modules/${PLUGIN_NAME}Config.cmake" configure_file("${CMAKE_SOURCE_DIR}/cmake_modules/FindYamlCpp.cmake" "${CMAKE_BINARY_DIR}/FindYamlCpp.cmake" @ONLY) -INSTALL(FILES "${WOLF_CONFIG_DIR}/config.h" - DESTINATION include/iri-algorithms/wolf/plugin_core/core/internal) - INSTALL(FILES "${CMAKE_BINARY_DIR}/${PLUGIN_NAME}Config.cmake" DESTINATION "lib/cmake/${PLUGIN_NAME}") INSTALL(FILES "${CMAKE_BINARY_DIR}/FindYamlCpp.cmake" DESTINATION "lib/cmake/${PLUGIN_NAME}") @@ -544,8 +518,6 @@ INSTALL(DIRECTORY ${SPDLOG_INCLUDE_DIRS} DESTINATION "include/iri-algorithms/") export(PACKAGE ${PLUGIN_NAME}) -#-END_SRC -------------------------------------------------------------------------------------------------------------------------------- - FIND_PACKAGE(Doxygen) FIND_PATH(IRI_DOC_DIR doxygen.conf ${CMAKE_SOURCE_DIR}/doc/iri_doc/) diff --git a/cmake_modules/wolfcoreConfig.cmake b/cmake_modules/wolfcoreConfig.cmake index b4df7e15bab20bc8d1090ffbd5428ac7a3ab5cd6..5204cd493ca0740f38d99aef942a7df32ad7f71d 100644 --- a/cmake_modules/wolfcoreConfig.cmake +++ b/cmake_modules/wolfcoreConfig.cmake @@ -12,7 +12,7 @@ ENDIF(wolfcore_INCLUDE_DIRS) FIND_LIBRARY( wolfcore_LIBRARIES NAMES libwolfcore.so libwolfcore.dylib - PATHS /usr/local/lib/iri-algorithms) + PATHS /usr/local/lib) IF(wolfcore_LIBRARIES) MESSAGE("Found wolf core lib: ${wolfcore_LIBRARIES}") ELSE(wolfcore_LIBRARIES) @@ -97,3 +97,8 @@ else (NOT wolfcore_FOUND) list(APPEND wolfcore_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIRS}) endif(NOT wolfcore_FOUND) SET(CMAKE_MODULE_PATH ${BACKUP_MODULE_PATH}) + +# provide both INCLUDE_DIR and INCLUDE_DIRS +SET(wolfcore_INCLUDE_DIR ${wolfcore_INCLUDE_DIRS}) +# provide both LIBRARY and LIBRARIES +SET(wolfcore_LIBRARY ${wolfcore_LIBRARIES})