From 2df0674802788c10b2590f50e0409ce2e3008b99 Mon Sep 17 00:00:00 2001 From: Windel Bouwman Date: Thu, 21 Nov 2024 11:47:50 -0800 Subject: [PATCH] {rolling} rtabmap: Allow rtabmap to be build without graphic support. Signed-off-by: Windel Bouwman Signed-off-by: Rob Woolley --- ...-package-to-find-proper-threading-li.patch | 51 +++ .../fixed-build-with-latest-g2o-cpp17.patch | 328 ++++++++++++++++++ ...fixed-g2o-version-not-correctly-used.patch | 64 ++++ .../rtabmap/rtabmap_0.21.5-1.bbappend | 55 +++ 4 files changed, 498 insertions(+) create mode 100644 meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/0001-Use-cmake-Thread-package-to-find-proper-threading-li.patch create mode 100644 meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/fixed-build-with-latest-g2o-cpp17.patch create mode 100644 meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/fixed-g2o-version-not-correctly-used.patch create mode 100644 meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap_0.21.5-1.bbappend diff --git a/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/0001-Use-cmake-Thread-package-to-find-proper-threading-li.patch b/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/0001-Use-cmake-Thread-package-to-find-proper-threading-li.patch new file mode 100644 index 0000000000..56b3520c7d --- /dev/null +++ b/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/0001-Use-cmake-Thread-package-to-find-proper-threading-li.patch @@ -0,0 +1,51 @@ +Upstream-Status: Pending + +Signed-off-by: Windel Bouwman + +From 3c219390cf625a8c838c42151f86098559030dfb Mon Sep 17 00:00:00 2001 +From: Windel Bouwman +Date: Fri, 13 May 2022 13:44:09 +0200 +Subject: [PATCH] Use cmake Thread package to find proper threading library. + +--- + utilite/CMakeLists.txt | 2 +- + utilite/src/CMakeLists.txt | 5 ++--- + 2 files changed, 3 insertions(+), 4 deletions(-) + +Index: git/utilite/CMakeLists.txt +=================================================================== +--- git.orig/utilite/CMakeLists.txt ++++ git/utilite/CMakeLists.txt +@@ -2,7 +2,7 @@ SET(UTILITE_VERSION "0.3.0") + ADD_DEFINITIONS(-DUTILITE_VERSION="${UTILITE_VERSION}") + + if(UNIX AND NOT ANDROID) +- FIND_PACKAGE(Pthreads REQUIRED) ++ FIND_PACKAGE(Threads REQUIRED) + ENDIF(UNIX AND NOT ANDROID) + + ADD_SUBDIRECTORY( src ) +Index: git/utilite/src/CMakeLists.txt +=================================================================== +--- git.orig/utilite/src/CMakeLists.txt ++++ git/utilite/src/CMakeLists.txt +@@ -20,16 +20,16 @@ generate_export_header(rtabmap_utilite + BASE_NAME utilite) + + target_include_directories(rtabmap_utilite PUBLIC +- "$" ++ "$" + "$") + + IF(MINGW) +- TARGET_LINK_LIBRARIES(rtabmap_utilite PRIVATE ${PTHREADS_LIBRARY} "-lpsapi") ++ TARGET_LINK_LIBRARIES(rtabmap_utilite Threads::Threads "-lpsapi") + ELSEIF(WIN32 OR MSVC) + FIND_LIBRARY(PSAPI_LIBRARIES NAMES psapi libpsapi.dll.a libpsapi.a libpsapi.lib ) + TARGET_LINK_LIBRARIES(rtabmap_utilite PRIVATE ${PSAPI_LIBRARIES}) + ELSE() +- TARGET_LINK_LIBRARIES(rtabmap_utilite PRIVATE ${PTHREADS_LIBRARY}) ++ TARGET_LINK_LIBRARIES(rtabmap_utilite Threads::Threads) + ENDIF() + + SET_TARGET_PROPERTIES( diff --git a/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/fixed-build-with-latest-g2o-cpp17.patch b/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/fixed-build-with-latest-g2o-cpp17.patch new file mode 100644 index 0000000000..774ee7d34e --- /dev/null +++ b/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/fixed-build-with-latest-g2o-cpp17.patch @@ -0,0 +1,328 @@ +From 85cc6fe3c742855ad16c8442895e12dbb10b6e8b Mon Sep 17 00:00:00 2001 +From: matlabbe +Date: Wed, 22 Mar 2023 20:42:33 -0700 +Subject: [PATCH] fixed build with latest g2o c++17 (#999) + +--- + CMakeLists.txt | 130 ++++++++++++------------- + corelib/src/optimizer/OptimizerG2O.cpp | 31 +++--- + 2 files changed, 80 insertions(+), 81 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 047c2f38e7..4d78f05904 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -314,8 +314,8 @@ IF(WITH_QT) + IF("${VTK_MAJOR_VERSION}" GREATER 5) + IF(RTABMAP_QT_VERSION STREQUAL "AUTO" OR RTABMAP_QT_VERSION STREQUAL "5") + FIND_PACKAGE(Qt5 COMPONENTS Widgets Core Gui OpenGL PrintSupport QUIET OPTIONAL_COMPONENTS Svg) +- ENDIF(RTABMAP_QT_VERSION STREQUAL "AUTO" OR RTABMAP_QT_VERSION STREQUAL "5") +- ENDIF("${VTK_MAJOR_VERSION}" GREATER 5) ++ ENDIF(RTABMAP_QT_VERSION STREQUAL "AUTO" OR RTABMAP_QT_VERSION STREQUAL "5") ++ ENDIF("${VTK_MAJOR_VERSION}" GREATER 5) + + IF(NOT Qt5_FOUND) + IF(RTABMAP_QT_VERSION STREQUAL "AUTO" OR RTABMAP_QT_VERSION STREQUAL "4") +@@ -328,8 +328,8 @@ IF(WITH_QT) + IF("${VTK_MAJOR_VERSION}" EQUAL 5) + FIND_PACKAGE(QVTK REQUIRED) # only for VTK 5 + ELSE() +- list(FIND PCL_LIBRARIES VTK::GUISupportQt value) +- IF(value EQUAL -1) ++ list(FIND PCL_LIBRARIES VTK::GUISupportQt value) ++ IF(value EQUAL -1) + list(FIND PCL_LIBRARIES vtkGUISupportQt value) + IF(value EQUAL -1) + IF(NOT(${VTK_MAJOR_VERSION} LESS 9)) +@@ -339,8 +339,8 @@ IF(WITH_QT) + ENDIF() + SET(ADD_VTK_GUI_SUPPORT_QT_TO_CONF TRUE) + ENDIF(value EQUAL -1) +- ENDIF(value EQUAL -1) +- ++ ENDIF(value EQUAL -1) ++ + MESSAGE(STATUS "VTK_RENDERING_BACKEND=${VTK_RENDERING_BACKEND}") + + IF(VTK_RENDERING_BACKEND STREQUAL "OpenGL2") +@@ -358,12 +358,12 @@ IF(WITH_QT) + ENDIF(value EQUAL -1) + ELSEIF("${VTK_MAJOR_VERSION}" EQUAL 9) + list(FIND PCL_LIBRARIES VTK::RenderingOpenGL2 value) +- IF(NOT value EQUAL -1) +- list(FIND PCL_LIBRARIES VTK::RenderingVolumeOpenGL2 value) ++ IF(NOT value EQUAL -1) ++ list(FIND PCL_LIBRARIES VTK::RenderingVolumeOpenGL2 value) + IF(value EQUAL -1) + SET(PCL_LIBRARIES "${PCL_LIBRARIES};VTK::RenderingVolumeOpenGL2") + ENDIF(value EQUAL -1) +- ENDIF(NOT value EQUAL -1) ++ ENDIF(NOT value EQUAL -1) + ENDIF() + + ENDIF() +@@ -426,7 +426,7 @@ ENDIF(WITH_FREENECT2) + + IF(WITH_K4W2 AND WIN32) + FIND_PACKAGE(KinectSDK2 QUIET) +- IF(KinectSDK2_FOUND) ++ IF(KinectSDK2_FOUND) + MESSAGE(STATUS "Found Kinect for Windows 2: ${KinectSDK2_INCLUDE_DIRS}") + ENDIF(KinectSDK2_FOUND) + ENDIF(WITH_K4W2 AND WIN32) +@@ -441,7 +441,7 @@ IF(WITH_K4A) + SET(k4a_FOUND FALSE) + ENDIF(NOT (k4a_FOUND AND k4arecord_FOUND)) + ENDIF() +- IF(k4a_FOUND) ++ IF(k4a_FOUND) + MESSAGE(STATUS "Found Kinect for Azure: ${k4a_INCLUDE_DIRS}") + ENDIF(k4a_FOUND) + ENDIF(WITH_K4A) +@@ -465,10 +465,10 @@ IF(WITH_G2O) + FIND_PACKAGE(g2o NO_MODULE) + IF(g2o_FOUND) + MESSAGE(STATUS "Found g2o (targets)") +- SET(G2O_FOUND ${g2o_FOUND}) +- get_target_property(G2O_INCLUDES g2o::core INTERFACE_INCLUDE_DIRECTORIES) +- MESSAGE(STATUS "g2o include dir: ${G2O_INCLUDES}") +- FIND_FILE(G2O_FACTORY_FILE g2o/core/factory.h ++ SET(G2O_FOUND ${g2o_FOUND}) ++ get_target_property(G2O_INCLUDES g2o::core INTERFACE_INCLUDE_DIRECTORIES) ++ MESSAGE(STATUS "g2o include dir: ${G2O_INCLUDES}") ++ FIND_FILE(G2O_FACTORY_FILE g2o/core/factory.h + PATHS ${G2O_INCLUDES} + NO_DEFAULT_PATH) + FILE(READ ${G2O_FACTORY_FILE} TMPTXT) +@@ -528,8 +528,8 @@ IF(libpointmatcher_FOUND OR GTSAM_FOUND) + find_package(Boost COMPONENTS thread filesystem system program_options date_time chrono timer serialization REQUIRED) + ENDIF(Boost_MINOR_VERSION GREATER 47) + IF(WIN32) +- MESSAGE(STATUS "Boost_LIBRARY_DIRS=${Boost_LIBRARY_DIRS}") +- link_directories(${Boost_LIBRARY_DIRS}) ++ MESSAGE(STATUS "Boost_LIBRARY_DIRS=${Boost_LIBRARY_DIRS}") ++ link_directories(${Boost_LIBRARY_DIRS}) + ENDIF(WIN32) + ENDIF(libpointmatcher_FOUND OR GTSAM_FOUND) + +@@ -766,57 +766,57 @@ IF(WITH_ORB_SLAM AND NOT G2O_FOUND) + ENDIF(WITH_ORB_SLAM AND NOT G2O_FOUND) + + IF(NOT MSVC) +- IF(Qt6_FOUND) ++ IF(Qt6_FOUND OR (G2O_FOUND AND ${G2O_CPP11} EQUAL 1)) + # Qt6 requires c++17 + include(CheckCXXCompilerFlag) +- CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17) +- IF(COMPILER_SUPPORTS_CXX17) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") +- set(CMAKE_CXX_STANDARD 17) +- ELSE() +- message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler if you want to use Qt6.") +- ENDIF() ++ CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17) ++ IF(COMPILER_SUPPORTS_CXX17) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") ++ set(CMAKE_CXX_STANDARD 17) ++ ELSE() ++ message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support. Please use a different C++ compiler if you want to use Qt6.") ++ ENDIF() ++ ENDIF() ++ IF((NOT (${CMAKE_CXX_STANDARD} STREQUAL "17")) AND ((NOT WITH_MSCKF_VIO OR NOT msckf_vio_FOUND) AND (loam_velodyne_FOUND OR floam_FOUND OR PCL_VERSION VERSION_GREATER "1.9.1" OR TORCH_FOUND OR G2O_FOUND OR CCCoreLib_FOUND OR Open3D_FOUND))) ++ #LOAM, PCL>=1.10, latest g2o and CCCoreLib require c++14, but MSCKF_VIO requires c++11 ++ include(CheckCXXCompilerFlag) ++ CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) ++ IF(COMPILER_SUPPORTS_CXX14) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") ++ set(CMAKE_CXX_STANDARD 14) ++ ELSE() ++ message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler if you want to use LOAM, latest PCL or g2o.") ++ ENDIF() ++ ENDIF() ++ ++ IF( (NOT (${CMAKE_CXX_STANDARD} STREQUAL "17") AND NOT (${CMAKE_CXX_STANDARD} STREQUAL "14")) AND ( ++ G2O_FOUND OR ++ GTSAM_FOUND OR ++ CERES_FOUND OR ++ ZED_FOUND OR ++ ZEDOC_FOUND OR ++ ANDROID OR ++ RealSense_FOUND OR ++ realsense2_FOUND OR ++ ORB_SLAM_FOUND OR ++ okvis_FOUND OR ++ open_chisel_FOUND OR ++ msckf_vio_FOUND OR ++ vins_FOUND OR ++ ov_msckf_FOUND OR ++ libpointmatcher_FOUND)) ++ #Newest versions require std11 ++ include(CheckCXXCompilerFlag) ++ CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) ++ CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) ++ IF(COMPILER_SUPPORTS_CXX11) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") ++ ELSEIF(COMPILER_SUPPORTS_CXX0X) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") ++ ELSE() ++ message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") ++ ENDIF() + ENDIF() +- IF((NOT (${CMAKE_CXX_STANDARD} STREQUAL "17")) AND ((NOT WITH_MSCKF_VIO OR NOT msckf_vio_FOUND) AND (loam_velodyne_FOUND OR floam_FOUND OR PCL_VERSION VERSION_GREATER "1.9.1" OR TORCH_FOUND OR G2O_FOUND OR CCCoreLib_FOUND OR Open3D_FOUND))) +- #LOAM, PCL>=1.10, latest g2o and CCCoreLib require c++14, but MSCKF_VIO requires c++11 +- include(CheckCXXCompilerFlag) +- CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14) +- IF(COMPILER_SUPPORTS_CXX14) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") +- set(CMAKE_CXX_STANDARD 14) +- ELSE() +- message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support. Please use a different C++ compiler if you want to use LOAM, latest PCL or g2o.") +- ENDIF() +- ENDIF() +- +- IF( (NOT (${CMAKE_CXX_STANDARD} STREQUAL "17") AND NOT (${CMAKE_CXX_STANDARD} STREQUAL "14")) AND ( +- G2O_FOUND OR +- GTSAM_FOUND OR +- CERES_FOUND OR +- ZED_FOUND OR +- ZEDOC_FOUND OR +- ANDROID OR +- RealSense_FOUND OR +- realsense2_FOUND OR +- ORB_SLAM_FOUND OR +- okvis_FOUND OR +- open_chisel_FOUND OR +- msckf_vio_FOUND OR +- vins_FOUND OR +- ov_msckf_FOUND OR +- libpointmatcher_FOUND)) +- #Newest versions require std11 +- include(CheckCXXCompilerFlag) +- CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +- CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) +- IF(COMPILER_SUPPORTS_CXX11) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +- ELSEIF(COMPILER_SUPPORTS_CXX0X) +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +- ELSE() +- message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +- ENDIF() +- ENDIF() + ENDIF() + + ####### OSX BUNDLE CMAKE_INSTALL_PREFIX ####### +diff --git a/corelib/src/optimizer/OptimizerG2O.cpp b/corelib/src/optimizer/OptimizerG2O.cpp +index 405882e4b1..dfcfdb1f05 100644 +--- a/corelib/src/optimizer/OptimizerG2O.cpp ++++ b/corelib/src/optimizer/OptimizerG2O.cpp +@@ -1,4 +1,3 @@ +-/* + Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke + All rights reserved. + +@@ -154,7 +153,7 @@ OptimizerG2O::OptimizerG2O(const ParametersMap & parameters) : + if(!g2o::Factory::instance()->knowsTag("CACHE_SE3_OFFSET")) + { + #if defined(RTABMAP_G2O_CPP11) && RTABMAP_G2O_CPP11 == 1 +- g2o::Factory::instance()->registerType("CACHE_SE3_OFFSET", g2o::make_unique >()); ++ g2o::Factory::instance()->registerType("CACHE_SE3_OFFSET", std::make_unique >()); + #else + g2o::Factory::instance()->registerType("CACHE_SE3_OFFSET", new g2o::HyperGraphElementCreator); + #endif +@@ -250,17 +249,17 @@ std::map OptimizerG2O::optimize( + if(solver_ == 3) + { + //eigen +- auto linearSolver = g2o::make_unique(); ++ auto linearSolver = std::make_unique(); + linearSolver->setBlockOrdering(false); +- blockSolver = g2o::make_unique(std::move(linearSolver)); ++ blockSolver = std::make_unique(std::move(linearSolver)); + } + #ifdef G2O_HAVE_CHOLMOD + else if(solver_ == 2) + { + //chmold +- auto linearSolver = g2o::make_unique(); ++ auto linearSolver = std::make_unique(); + linearSolver->setBlockOrdering(false); +- blockSolver = g2o::make_unique(std::move(linearSolver)); ++ blockSolver = std::make_unique(std::move(linearSolver)); + } + #endif + #ifdef G2O_HAVE_CSPARSE +@@ -268,16 +267,16 @@ std::map OptimizerG2O::optimize( + { + + //csparse +- auto linearSolver = g2o::make_unique(); ++ auto linearSolver = std::make_unique(); + linearSolver->setBlockOrdering(false); +- blockSolver = g2o::make_unique(std::move(linearSolver)); ++ blockSolver = std::make_unique(std::move(linearSolver)); + } + #endif + else + { + //pcg +- auto linearSolver = g2o::make_unique(); +- blockSolver = g2o::make_unique(std::move(linearSolver)); ++ auto linearSolver = std::make_unique(); ++ blockSolver = std::make_unique(std::move(linearSolver)); + } + + if(optimizer_ == 1) +@@ -1427,7 +1426,7 @@ std::map OptimizerG2O::optimizeBA( + { + //eigen + #ifdef RTABMAP_G2O_CPP11 +- linearSolver = g2o::make_unique >(); ++ linearSolver = std::make_unique >(); + #else + linearSolver = new g2o::LinearSolverEigen(); + #endif +@@ -1437,7 +1436,7 @@ std::map OptimizerG2O::optimizeBA( + { + //chmold + #ifdef RTABMAP_G2O_CPP11 +- linearSolver = g2o::make_unique >(); ++ linearSolver = std::make_unique >(); + #else + linearSolver = new g2o::LinearSolverCholmod(); + #endif +@@ -1448,7 +1447,7 @@ std::map OptimizerG2O::optimizeBA( + { + //csparse + #ifdef RTABMAP_G2O_CPP11 +- linearSolver = g2o::make_unique >(); ++ linearSolver = std::make_unique >(); + #else + linearSolver = new g2o::LinearSolverCSparse(); + #endif +@@ -1458,7 +1457,7 @@ std::map OptimizerG2O::optimizeBA( + { + //pcg + #ifdef RTABMAP_G2O_CPP11 +- linearSolver = g2o::make_unique >(); ++ linearSolver = std::make_unique >(); + #else + linearSolver = new g2o::LinearSolverPCG(); + #endif +@@ -1470,7 +1469,7 @@ std::map OptimizerG2O::optimizeBA( + { + #ifdef RTABMAP_G2O_CPP11 + optimizer.setAlgorithm(new g2o::OptimizationAlgorithmGaussNewton( +- g2o::make_unique(std::move(linearSolver)))); ++ std::make_unique(std::move(linearSolver)))); + #else + optimizer.setAlgorithm(new g2o::OptimizationAlgorithmGaussNewton(new g2o::BlockSolver_6_3(linearSolver))); + #endif +@@ -1480,7 +1479,7 @@ std::map OptimizerG2O::optimizeBA( + { + #if defined(RTABMAP_G2O_CPP11) && !defined(RTABMAP_ORB_SLAM) + optimizer.setAlgorithm(new g2o::OptimizationAlgorithmLevenberg( +- g2o::make_unique(std::move(linearSolver)))); ++ std::make_unique(std::move(linearSolver)))); + #else + optimizer.setAlgorithm(new g2o::OptimizationAlgorithmLevenberg(new g2o::BlockSolver_6_3(linearSolver))); + #endif diff --git a/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/fixed-g2o-version-not-correctly-used.patch b/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/fixed-g2o-version-not-correctly-used.patch new file mode 100644 index 0000000000..e77bc0794e --- /dev/null +++ b/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap/fixed-g2o-version-not-correctly-used.patch @@ -0,0 +1,64 @@ +From 6fe5e6375f3f18dd9715b1f98c2617b3599547ad Mon Sep 17 00:00:00 2001 +From: matlabbe +Date: Mon, 13 Mar 2023 22:10:24 -0700 +Subject: [PATCH] Fixed g2o version not correctly used, D400: set default to + IR+Depth + +--- + corelib/src/optimizer/OptimizerG2O.cpp | 6 +++--- + guilib/src/PreferencesDialog.cpp | 6 +++++- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/corelib/src/optimizer/OptimizerG2O.cpp b/corelib/src/optimizer/OptimizerG2O.cpp +index 753e548f94..405882e4b1 100644 +--- a/corelib/src/optimizer/OptimizerG2O.cpp ++++ b/corelib/src/optimizer/OptimizerG2O.cpp +@@ -153,7 +153,7 @@ OptimizerG2O::OptimizerG2O(const ParametersMap & parameters) : + // Issue on android, have to explicitly register this type when using fixed root prior below + if(!g2o::Factory::instance()->knowsTag("CACHE_SE3_OFFSET")) + { +-#if defined(RTABMAP_G2O_CPP11) and RTABMAP_G2O_CPP11 == 1 ++#if defined(RTABMAP_G2O_CPP11) && RTABMAP_G2O_CPP11 == 1 + g2o::Factory::instance()->registerType("CACHE_SE3_OFFSET", g2o::make_unique >()); + #else + g2o::Factory::instance()->registerType("CACHE_SE3_OFFSET", new g2o::HyperGraphElementCreator); +@@ -1414,7 +1414,7 @@ std::map OptimizerG2O::optimizeBA( + { + g2o::SparseOptimizer optimizer; + //optimizer.setVerbose(ULogger::level()==ULogger::kDebug); +-#if defined(RTABMAP_G2O_CPP11) and not defined(RTABMAP_ORB_SLAM) ++#if defined(RTABMAP_G2O_CPP11) && !defined(RTABMAP_ORB_SLAM) + std::unique_ptr linearSolver; + #else + g2o::BlockSolver_6_3::LinearSolverType * linearSolver = 0; +@@ -1478,7 +1478,7 @@ std::map OptimizerG2O::optimizeBA( + else + #endif + { +-#if defined(RTABMAP_G2O_CPP11) and not defined(RTABMAP_ORB_SLAM) ++#if defined(RTABMAP_G2O_CPP11) && !defined(RTABMAP_ORB_SLAM) + optimizer.setAlgorithm(new g2o::OptimizationAlgorithmLevenberg( + g2o::make_unique(std::move(linearSolver)))); + #else +diff --git a/guilib/src/PreferencesDialog.cpp b/guilib/src/PreferencesDialog.cpp +index fed95e7892..4910410e6c 100644 +--- a/guilib/src/PreferencesDialog.cpp ++++ b/guilib/src/PreferencesDialog.cpp +@@ -3921,12 +3921,16 @@ void PreferencesDialog::selectSourceDriver(Src src, int variant) + _ui->spinBox_rs2_width->setValue(1280); + _ui->spinBox_rs2_height->setValue(720); + _ui->spinBox_rs2_rate->setValue(30); ++ _ui->checkbox_rs2_irMode->setChecked(false); ++ _ui->checkbox_rs2_emitter->setChecked(true); + } +- else ++ else // D400 + { + _ui->spinBox_rs2_width->setValue(848); + _ui->spinBox_rs2_height->setValue(480); + _ui->spinBox_rs2_rate->setValue(60); ++ _ui->checkbox_rs2_irMode->setChecked(true); ++ _ui->checkbox_rs2_emitter->setChecked(false); + } + } + } diff --git a/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap_0.21.5-1.bbappend b/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap_0.21.5-1.bbappend new file mode 100644 index 0000000000..9104904f21 --- /dev/null +++ b/meta-ros2-rolling/recipes-bbappends/rtabmap/rtabmap_0.21.5-1.bbappend @@ -0,0 +1,55 @@ +LICENSE = "BSD-3-Clause" + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" +SRC_URI += "file://0001-Use-cmake-Thread-package-to-find-proper-threading-li.patch" + +# Remove some dependencies we do not need: +DEPENDS:remove = "${ROS_UNRESOLVED_DEP-libopenni-dev} libfreenect qt-gui-cpp qtbase" +RDEPENDS:${PN}:remove = "${ROS_UNRESOLVED_DEP-libopenni-dev} libfreenect qt-gui-cpp qtbase" + +# the native package only builds the res-tool +DEPENDS:remove:class-native = "octomap libg2o cv-bridge pcl proj" +RDEPENDS:${PN}:remove:class-native = "octomap libg2o cv-bridge pcl proj" + +# When we build for the target, we require a native build +DEPENDS:append:class-target = " ${BPN}-native" + +# only build res-tool for native variant +OECMAKE_TARGET_COMPILE:class-native = "res_tool" + +# Define was removed from PCL library in version 1.10: +CXXFLAGS += "-DDISABLE_VTK" + +# Build without Qt, examples and tools +# Build as release +EXTRA_OECMAKE += " \ + -DBUILD_TOOLS=OFF \ + -DBUILD_EXAMPLES=OFF \ + -DWITH_QT=OFF \ + -DWITH_FREENECT=OFF \ + -DWITH_FREENECT2=OFF \ + -DCMAKE_BUILD_TYPE=Release \ + -DCOMPILER_SUPPORTS_CXX17=ON \ +" + +EXTRA_OECMAKE:class-native += " \ + -DUNIX=ON \ + -DANDROID_PREBUILD=ON \ +" + +export LD_LIBRARY_PATH="${RECIPE_SYSROOT_NATIVE}/${ros_libdir}" + +# ERROR: rtabmap-0.21.5-1-r0 do_package_qa: QA Issue: non -dev/-dbg/nativesdk- package rtabmap contains symlink .so '/opt/ros/rolling/lib/librtabmap_core.so' [dev-so] +# ERROR: rtabmap-0.21.5-1-r0 do_package_qa: QA Issue: non -dev/-dbg/nativesdk- package rtabmap contains symlink .so '/opt/ros/rolling/lib/librtabmap_utilite.so' [dev-so] +# Undo ros_faulty_solibs and include uncommon cmake config path: +FILES:${PN}-dev += " \ + ${ros_libdir}/${PN}-0.20/ \ + ${ros_libdir}/lib*${SOLIBSDEV} \ +" + +# ERROR: rtabmap-0.21.5-1-r0 do_package_qa: QA Issue: File /opt/ros/rolling/lib/rtabmap-0.21/RTABMap_coreTargets.cmake in package rtabmap contains reference to TMPDIR [buildpaths] +do_install:append:class-target() { + sed -i -e "s#${RECIPE_SYSROOT}##g" ${D}${ros_libdir}/rtabmap-0.21/RTABMap_coreTargets.cmake +} + +BBCLASSEXTEND="native"