test(rtabmap_slam): cover scan transform recovery in native tests

Replace the standalone reproducer with registered C++ GoogleTests for 2D and 3D scan recovery. Use real ROS inputs, separate DDS domains and bounded timeouts, and include rtabmap_slam in supported CI and coverage jobs.

Validated on Jazzy with RTAB-Map core 9ed83a7: both negative controls fail map recovery without the unlocks; both pass with the fix, followed by five repeated runs per case (10/10 passed). Broader distro CI has not been run locally.
This commit is contained in:
Matthew Kotara
2026-09-22 17:33:01 +01:00
parent adef11e0f9
commit 254ca3b667
7 changed files with 233 additions and 204 deletions
+20
View File
@@ -240,4 +240,24 @@ install(DIRECTORY include/
FILES_MATCHING PATTERN "*.h"
)
if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
find_package(rcl_interfaces REQUIRED)
ament_add_gtest_executable(test_scan_tf_recovery test/test_scan_tf_recovery.cpp)
if(TARGET test_scan_tf_recovery)
target_link_libraries(test_scan_tf_recovery rtabmap_slam_plugins)
if("$ENV{ROS_DISTRO}" STRLESS "lyrical")
ament_target_dependencies(test_scan_tf_recovery ${AmentLibraries} rcl_interfaces)
else()
target_link_libraries(test_scan_tf_recovery ${Libraries} rcl_interfaces::rcl_interfaces)
endif()
# Separate processes/domains keep either deadlock from hiding the other case.
# Existing util, sync and odom tests use domains starting at 30, 50 and 70.
ament_add_gtest_test(test_scan_tf_recovery TEST_NAME test_scan_tf_recovery_2d
ENV ROS_DOMAIN_ID=90 GTEST_FILTER=ScanTfRecovery.Recovers2D TIMEOUT 45)
ament_add_gtest_test(test_scan_tf_recovery TEST_NAME test_scan_tf_recovery_3d
ENV ROS_DOMAIN_ID=91 GTEST_FILTER=ScanTfRecovery.Recovers3D TIMEOUT 45)
endif()
endif()
ament_package()