diff --git a/distros/humble/patch/ros2-rtabmap-util.patch b/distros/humble/patch/ros2-rtabmap-util.patch new file mode 100644 index 00000000..d295dbbd --- /dev/null +++ b/distros/humble/patch/ros2-rtabmap-util.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9104af7..b0c0be8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -28,7 +28,8 @@ find_package(rtabmap_msgs REQUIRED) + find_package(rtabmap_conversions REQUIRED) + find_package(rtabmap_sync REQUIRED) + +-find_package(RTABMap COMPONENTS gui REQUIRED) ++# nothing here uses rtabmap's GUI, and humble's rtabmap is built without Qt ++find_package(RTABMap REQUIRED) + + # Optional components + find_package(octomap_msgs) diff --git a/distros/humble/vinca.yaml b/distros/humble/vinca.yaml index 6ddebe7c..1283b494 100644 --- a/distros/humble/vinca.yaml +++ b/distros/humble/vinca.yaml @@ -12,6 +12,8 @@ mutex_package: version: "0.10.0" packages_exclude: + - rtabmap_rviz_plugins # links PCL, whose VTK is Qt 6 on conda-forge, into a Qt 5 RViz plugin (humble's RViz is Qt 5) + - rtabmap_viz # needs rtabmap's GUI, which follows VTK's Qt 6, while humble's RViz is Qt 5 (rtabmap is built without Qt here) - if: not linux then: diff --git a/distros/jazzy/vinca.yaml b/distros/jazzy/vinca.yaml index 2488b5a7..6a91a438 100644 --- a/distros/jazzy/vinca.yaml +++ b/distros/jazzy/vinca.yaml @@ -12,3 +12,6 @@ mutex_package: # new build without run_constraints (same version as the published ones) build_number: 26 version: "0.19.0" + +packages_exclude: + - rtabmap_rviz_plugins # links PCL, whose VTK is Qt 6 on conda-forge, into a Qt 5 RViz plugin (jazzy's RViz is Qt 5); rtabmap_viz is fine, it uses only rtabmap's Qt 6 diff --git a/shared/patch/ros2-rtabmap-conversions.patch b/shared/patch/ros2-rtabmap-conversions.patch new file mode 100644 index 00000000..ed9d61a0 --- /dev/null +++ b/shared/patch/ros2-rtabmap-conversions.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4dc4190..ed08e21 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,8 +9,7 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + # issues #1285 #1288 + find_library( + builtin_interfaces__rosidl_generator_c_LIB NAMES builtin_interfaces__rosidl_generator_c +- PATHS "/opt/ros/$ENV{ROS_DISTRO}/lib" +- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH REQUIRED ++ REQUIRED + ) + endif() + +diff --git a/include/rtabmap_conversions/MsgConversion.h b/include/rtabmap_conversions/MsgConversion.h +index 4e82e38..6f657f3 100644 +--- a/include/rtabmap_conversions/MsgConversion.h ++++ b/include/rtabmap_conversions/MsgConversion.h +@@ -39,7 +39,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include + + #include ++#if CV_MAJOR_VERSION < 5 + #include ++#else ++#include ++#endif + #ifdef PRE_ROS_IRON + #include + #else diff --git a/shared/patch/ros2-rtabmap-odom.patch b/shared/patch/ros2-rtabmap-odom.patch new file mode 100644 index 00000000..787c9e90 --- /dev/null +++ b/shared/patch/ros2-rtabmap-odom.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7b10ad2..6ef5020 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,8 +14,7 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + # issues #1285 #1288 + find_library( + builtin_interfaces__rosidl_generator_c_LIB NAMES builtin_interfaces__rosidl_generator_c +- PATHS "/opt/ros/$ENV{ROS_DISTRO}/lib" +- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH REQUIRED ++ REQUIRED + ) + endif() + diff --git a/shared/patch/ros2-rtabmap-rviz-plugins.patch b/shared/patch/ros2-rtabmap-rviz-plugins.patch new file mode 100644 index 00000000..69e452c3 --- /dev/null +++ b/shared/patch/ros2-rtabmap-rviz-plugins.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4e47a68..c8eb361 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,8 +9,7 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + # issues #1285 #1288 + find_library( + message_filters_LIB NAMES message_filters +- PATHS "/opt/ros/$ENV{ROS_DISTRO}/lib" +- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH REQUIRED ++ REQUIRED + ) + endif() + diff --git a/shared/patch/ros2-rtabmap-slam.patch b/shared/patch/ros2-rtabmap-slam.patch new file mode 100644 index 00000000..24b821e9 --- /dev/null +++ b/shared/patch/ros2-rtabmap-slam.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6107b23..97ea89f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,8 +14,7 @@ if(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + # issues #1285 #1288 + find_library( + builtin_interfaces__rosidl_generator_c_LIB NAMES builtin_interfaces__rosidl_generator_c +- PATHS "/opt/ros/$ENV{ROS_DISTRO}/lib" +- NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH REQUIRED ++ REQUIRED + ) + endif() + +diff --git a/src/CoreWrapper.cpp b/src/CoreWrapper.cpp +index c1fb75b..bb732d6 100644 +--- a/src/CoreWrapper.cpp ++++ b/src/CoreWrapper.cpp +@@ -1474,7 +1474,7 @@ void CoreWrapper::commonMultiCameraCallbackImpl( + cv::Mat leftMono; + if(rgb.channels() == 3) + { +- cv::cvtColor(rgb, leftMono, CV_BGR2GRAY); ++ cv::cvtColor(rgb, leftMono, cv::COLOR_BGR2GRAY); + } + else + { diff --git a/shared/patch/ros2-rtabmap-viz.patch b/shared/patch/ros2-rtabmap-viz.patch new file mode 100644 index 00000000..b5c695de --- /dev/null +++ b/shared/patch/ros2-rtabmap-viz.patch @@ -0,0 +1,30 @@ +diff --git a/src/GuiNode.cpp b/src/GuiNode.cpp +index 88895ed..e62af21 100644 +--- a/src/GuiNode.cpp ++++ b/src/GuiNode.cpp +@@ -32,6 +32,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + #include + #include + #include ++#include ++#include ++#if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION==9 && VTK_MINOR_VERSION >= 1) ++#include ++#endif + + QApplication * app = 0; + +@@ -49,6 +54,13 @@ int main(int argc, char** argv) + + rclcpp::init(argc, argv); + ++#if VTK_MAJOR_VERSION > 9 || (VTK_MAJOR_VERSION==9 && VTK_MINOR_VERSION >= 1) ++ // needed to ensure appropriate OpenGL context is created for VTK rendering ++ // (without it, macOS creates a legacy OpenGL 2.1 context and VTK crashes). ++ QSurfaceFormat::setDefaultFormat(QVTKRenderWidget::defaultFormat()); ++#endif ++ QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); ++ + app = new QApplication(argc, argv); + app->connect( app, SIGNAL( lastWindowClosed() ), app, SLOT( quit() ) ); + diff --git a/shared/tests/ros2-rtabmap-slam.yaml b/shared/tests/ros2-rtabmap-slam.yaml new file mode 100644 index 00000000..3ee7169a --- /dev/null +++ b/shared/tests/ros2-rtabmap-slam.yaml @@ -0,0 +1,6 @@ +tests: + # Smoke test: `rtabmap_slam/rtabmap` (the SLAM node) starts (loads its libraries and the RMW) and is still running after 5 s. + - if: unix + then: + script: + - python -c "import os, subprocess, sys, time; p = subprocess.Popen([os.path.join(os.environ['PREFIX'], 'lib', 'rtabmap_slam', 'rtabmap')]); time.sleep(5); r = p.poll(); p.terminate(); sys.exit(0 if r is None else 1)" diff --git a/shared/vinca.yaml b/shared/vinca.yaml index c93bc085..35408804 100644 --- a/shared/vinca.yaml +++ b/shared/vinca.yaml @@ -581,6 +581,7 @@ packages_select_by_deps: - rqt_reconfigure - rqt_tf_tree - rslidar_sdk # rs_driver's Windows socket code has multiple pre-existing min/max-macro and getsockopt/setsockopt type bugs; not pursuing further + - rtabmap_ros # Windows not tried yet; requested in https://github.com/RoboStack/ros-lyrical/pull/83 - rviz_2d_overlay_plugins - rviz_satellite - smacc2