rtabmap_demos tests and docs (#1462)

* rtabmap_demos tests and docs

* added bag testing

* added rtabmap_examples launch tests

* updating demo bag download paths

* added netherdrone demo

* Fixed rgb-only callback with lidar rejected.  Updated lidar params

* Added back OrbitOriented rviz view to ros2, with optional octomap wll clipping

* fixing ci

* lidar demo added intermediate_nodes option

* added netherdrone as demo test

* running rtabmap_demos tests on ci

* added rtabmap_launch tests, fixed ground_truth_base_frame_id usage

* ficing rolling

* updating demo test harnest

* densify golden trajectories to avoid tf missing

* fixing tf steps

* updated min icp ratio for netherdrone demo

* fixing image_transport arg->params

* export pose opt=0

* lets process all frames

* updated netherdrone golden

* fixing publishers queue size just for tests

* added playdback demo doc

* Adding more logs to debug ci

* Fixing QOS for CI to reliable, added find-object demo test

* name threads

* fixing camera info expected transient on lyrical/rolling. Fixing find_object not appearing idle

* 30 Hz polling backward comp

* fixing test tf sim lock

* fixing lyrical qos bag parsing

* faster replay

* lockstep

* fixing clock deadlock

* Added test on shutdown

* updated netherdrone golden poses

* Extended stereo outdoor test

* updated shutdown test

* updated test

* multi-thread flaky test

* adding backtrace when test fails

* increased closure slack for netherdrone

* g2o gauss newton on stereo

* adjusted maximum optimizer iterations

* updated default iterations

* Added netherdrone in list of demos
This commit is contained in:
matlabbe
2026-10-10 12:23:49 -07:00
committed by GitHub
parent cb2117f1ed
commit 82f0754bf7
80 changed files with 18405 additions and 98 deletions
+63
View File
@@ -0,0 +1,63 @@
"""
Dry-run every launch file of a package, with its default arguments and with each of its
switches flipped, and check what it would start. See launch_dry_run.py, next to this file.
Installed with rtabmap_launch, and run by each package whose launch files it checks,
which names itself in RTABMAP_LAUNCH_TEST_PACKAGE (see their CMakeLists.txt): the
installed launch files of that package are the ones checked.
A launch file is only checked as far as this machine can resolve it: the drivers or
simulators that are not installed are stubbed, and the test says which.
"""
import os
import warnings
from pathlib import Path
import pytest
from ament_index_python.packages import get_package_share_directory
from launch_dry_run import check_launch_file, declared_arguments, dry_run, launch_files
PACKAGE = os.environ.get('RTABMAP_LAUNCH_TEST_PACKAGE', 'rtabmap_launch')
LAUNCH_DIR = Path(get_package_share_directory(PACKAGE)) / 'launch'
LAUNCH_FILES = launch_files(LAUNCH_DIR)
@pytest.mark.parametrize('launch_file', LAUNCH_FILES)
def test_launch_file(launch_file):
failures, stubbed = check_launch_file(PACKAGE, launch_file)
if stubbed:
warnings.warn(f'{launch_file}: not installed, stubbed: {", ".join(sorted(stubbed))}')
assert not failures, f'{launch_file}:\n ' + '\n '.join(failures)
def _with_ground_truth_arguments(launch_file: str) -> bool:
names = {a.name for a in declared_arguments(str(LAUNCH_DIR / launch_file))}
return {'frame_id', 'ground_truth_frame_id', 'ground_truth_base_frame_id'} <= names
GROUND_TRUTH_LAUNCH_FILES = [f for f in LAUNCH_FILES if _with_ground_truth_arguments(f)]
# Where a launch file declares frame_id and the ground truth's frames, the robot frame of
# the ground truth defaults to frame_id + "_gt", as in the nodes; set empty, it reaches the
# nodes empty, which turns the ground truth off. Defined only where there is one: an empty
# parametrization would be reported as skipped.
if GROUND_TRUTH_LAUNCH_FILES:
@pytest.mark.parametrize('launch_file', GROUND_TRUTH_LAUNCH_FILES)
@pytest.mark.parametrize('arguments, expected', [
({}, 'base_footprint_gt'),
({'ground_truth_base_frame_id': 'tracker'}, 'tracker'),
({'ground_truth_base_frame_id': ''}, ''),
], ids=['default', 'set', 'empty'])
def test_ground_truth_base_frame_id(launch_file, arguments, expected):
arguments = dict(arguments, frame_id='base_footprint', ground_truth_frame_id='world')
result = dry_run(str(LAUNCH_DIR / launch_file), arguments)
assert not result.problems, '\n'.join(result.problems)
given = {s.describe(): s.parameters.get('ground_truth_base_frame_id')
for s in result.started if 'ground_truth_frame_id' in s.parameters}
assert given, f'{launch_file} starts no node with a ground truth'
for node, value in given.items():
assert value == expected, \
f'{node}: ground_truth_base_frame_id={value!r}, expected {expected!r}'