From ba388061b0f9ed9584e57d6019c30b044a657c3e Mon Sep 17 00:00:00 2001 From: Markus Vieth Date: Sat, 8 Jan 2022 16:28:28 +0100 Subject: [PATCH] Improve correspondence rejector test So far, the test was only run for one specific seed, for which the test passes. But for other seeds, the test failed roughly 50% of the time. Now the seed is varied (for better test coverage), and the parameters are adapted so that the test passes for all seeds. --- test/registration/test_correspondence_rejectors.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/registration/test_correspondence_rejectors.cpp b/test/registration/test_correspondence_rejectors.cpp index 651a080a8c6..739e626664f 100644 --- a/test/registration/test_correspondence_rejectors.cpp +++ b/test/registration/test_correspondence_rejectors.cpp @@ -104,14 +104,15 @@ TEST (CorrespondenceRejectors, CorrespondenceRejectionPoly) point.z += nd.run(); } - // Ensure deterministic sampling inside the rejector - std::srand (1e6); + // Test rejector with varying seeds + const unsigned int seed = std::time(nullptr); + std::srand (seed); // Create a rejection object pcl::registration::CorrespondenceRejectorPoly reject; - reject.setIterations (10000); + reject.setIterations (20000); reject.setCardinality (3); - reject.setSimilarityThreshold (0.75f); + reject.setSimilarityThreshold (0.8f); reject.setInputSource (cloud.makeShared ()); reject.setInputTarget (target.makeShared ());