fixed some flaky tests

This commit is contained in:
matlabbe
2026-05-27 20:41:22 -07:00
parent 499e4796ae
commit 4c5bdffe76
4 changed files with 198 additions and 37 deletions
+19 -11
View File
@@ -541,11 +541,13 @@ TEST_F(RtabmapIntegrationFixture, NetherdroneLidar3D)
#ifdef RTABMAP_OCTOMAP
// Grid/RayTracing requires OctoMap support; verify the 3D map was
// actually assembled when the build has it. ICP-only replay is fully
// deterministic so the leaf counts are exact across runs.
EXPECT_EQ(21372, result.octomapNodes);
EXPECT_EQ(16178, result.octomapEmptyCells);
EXPECT_EQ(1845, result.octomapObstacleCells);
// actually assembled when the build has it. ICP-only replay is
// deterministic on a given platform but absolute leaf counts can shift
// slightly across PCL/Eigen/OpenMP configurations, so use a small
// tolerance (~1-3%) rather than exact equality.
EXPECT_NEAR(21372, result.octomapNodes, 300);
EXPECT_NEAR(16178, result.octomapEmptyCells, 300);
EXPECT_NEAR(1845, result.octomapObstacleCells, 50);
#endif
// Replay is deterministic; matching golden GT was captured from a clean
@@ -585,11 +587,14 @@ TEST_F(RtabmapIntegrationFixture, PR2_Scan2D_Stereo)
EXPECT_GE(result.gridObstacleCells, 4900);
EXPECT_LE(result.gridObstacleCells, 5300);
#ifdef RTABMAP_OCTOMAP
// Observed across 5 runs: empty 1834-1857, obstacle 21502-21671.
// Observed: empty 1805-1902, obstacle 21502-22383. Bounds are wide
// because without g2o (OdomF2M/BundleAdjustment disabled) visual
// odometry drifts a bit differently run-to-run, which propagates into
// the assembled occupancy grid.
EXPECT_GE(result.octomapEmptyCells, 1700);
EXPECT_LE(result.octomapEmptyCells, 2000);
EXPECT_LE(result.octomapEmptyCells, 2100);
EXPECT_GE(result.octomapObstacleCells, 21000);
EXPECT_LE(result.octomapObstacleCells, 22000);
EXPECT_LE(result.octomapObstacleCells, 23000);
#endif
// Stereo F2M visual odom + visual loop closure -- observed RMSE ~3 cm,
// 5 cm bound gives ~50% headroom for run-to-run feature variance.
@@ -628,10 +633,13 @@ TEST_F(RtabmapIntegrationFixture, PR2_Scan2D_RGBD)
EXPECT_GE(result.gridObstacleCells, 4400);
EXPECT_LE(result.gridObstacleCells, 4900);
#ifdef RTABMAP_OCTOMAP
// Observed across 5 runs: empty 6452-7474, obstacle 41125-42883.
EXPECT_GE(result.octomapEmptyCells, 6000);
// Observed: empty 6072-7474, obstacle 39924-42883. Bounds are wide
// because without g2o (OdomF2M/BundleAdjustment disabled) visual
// odometry drifts a bit differently run-to-run, which propagates into
// the assembled occupancy grid.
EXPECT_GE(result.octomapEmptyCells, 5500);
EXPECT_LE(result.octomapEmptyCells, 8000);
EXPECT_GE(result.octomapObstacleCells, 40000);
EXPECT_GE(result.octomapObstacleCells, 38000);
EXPECT_LE(result.octomapObstacleCells, 44000);
#endif
// RGB-D F2M visual odom + visual loop closure -- observed RMSE ~13 cm