From 6860313d6e78a8dbe34819a39edf65613a09225b Mon Sep 17 00:00:00 2001 From: Nathan Hughes Date: Fri, 1 Aug 2025 20:09:19 +0000 Subject: [PATCH 1/3] fix missing setter for params in teaser --- teaser/include/teaser/registration.h | 125 +++++++++++---------------- 1 file changed, 51 insertions(+), 74 deletions(-) diff --git a/teaser/include/teaser/registration.h b/teaser/include/teaser/registration.h index a778f7f..fb20f5b 100644 --- a/teaser/include/teaser/registration.h +++ b/teaser/include/teaser/registration.h @@ -321,8 +321,9 @@ class FastGlobalRegistrationSolver : public GNCRotationSolver { * H. Lim et al., "A Single Correspondence Is Enough: Robust Global Registration * to Avoid Degeneracy in Urban Environments," in Robotics - ICRA 2022, * Accepted. To appear. arXiv:2203.06612 [cs], Mar. 2022. - * Quatro and TEASER++ differ in the estimation of rotation. Quatro forgoes roll and pitch estimation, - * yet it is empirically found that it makes the algorithm more robust against degeneracy. + * Quatro and TEASER++ differ in the estimation of rotation. Quatro forgoes roll and pitch + * estimation, yet it is empirically found that it makes the algorithm more robust against + * degeneracy. */ class QuatroSolver : public GNCRotationSolver { public: @@ -515,28 +516,21 @@ class RobustRegistrationSolver { RobustRegistrationSolver() = default; - /** * A constructor that takes in parameters and initialize the estimators * accordingly. If the parameters need to be reused consider instantiating * a Params struct. */ - RobustRegistrationSolver( - double noise_bound, - double cbar2, - bool estimate_scaling, - ROTATION_ESTIMATION_ALGORITHM rotation_estimation_algorithm, - double rotation_gnc_factor, - size_t rotation_max_iterations, - double rotation_cost_threshold, - INLIER_GRAPH_FORMULATION rotation_tim_graph, - INLIER_SELECTION_MODE inlier_selection_mode, - double kcore_heuristic_threshold, - bool use_max_clique, // deprecated - bool max_clique_exact_solution, // deprecated - double max_clique_time_limit, - int max_clique_num_threads = 0 - ); + RobustRegistrationSolver(double noise_bound, double cbar2, bool estimate_scaling, + ROTATION_ESTIMATION_ALGORITHM rotation_estimation_algorithm, + double rotation_gnc_factor, size_t rotation_max_iterations, + double rotation_cost_threshold, + INLIER_GRAPH_FORMULATION rotation_tim_graph, + INLIER_SELECTION_MODE inlier_selection_mode, + double kcore_heuristic_threshold, + bool use_max_clique, // deprecated + bool max_clique_exact_solution, // deprecated + double max_clique_time_limit, int max_clique_num_threads = 0); /** * A constructor that takes in parameters and initialize the estimators accordingly. @@ -827,55 +821,40 @@ class RobustRegistrationSolver { * Reset the solver using the provided params * @param params a Params struct */ - void reset( - const double noise_bound, - const double cbar2, - const bool estimate_scaling, - const ROTATION_ESTIMATION_ALGORITHM rotation_estimation_algorithm, - const double rotation_gnc_factor, - const size_t rotation_max_iterations, - const double rotation_cost_threshold, - const INLIER_GRAPH_FORMULATION rotation_tim_graph, - const INLIER_SELECTION_MODE inlier_selection_mode, - const double kcore_heuristic_threshold, - const bool use_max_clique , // deprecated - const bool max_clique_exact_solution, // deprecated - const double max_clique_time_limit, - const int max_clique_num_threads - ) { + void reset(const Params& params) { + params_ = params; // Initialize the scale estimator - if (estimate_scaling) { + if (params_.estimate_scaling) { setScaleEstimator( - std::make_unique(noise_bound, cbar2)); + std::make_unique(params_.noise_bound, params_.cbar2)); } else { setScaleEstimator( - std::make_unique(noise_bound, cbar2)); + std::make_unique(params_.noise_bound, params_.cbar2)); } // Initialize the rotation estimator - teaser::GNCRotationSolver::Params rotation_params { - rotation_max_iterations, rotation_cost_threshold, - rotation_gnc_factor, noise_bound - }; - - switch (rotation_estimation_algorithm) { - case ROTATION_ESTIMATION_ALGORITHM::GNC_TLS: { // GNC-TLS method - setRotationEstimator(std::make_unique(rotation_params)); - break; - } - case ROTATION_ESTIMATION_ALGORITHM::FGR: { // FGR method - setRotationEstimator(std::make_unique(rotation_params)); - break; - } - case ROTATION_ESTIMATION_ALGORITHM::QUATRO: { // Quatro method - setRotationEstimator(std::make_unique(rotation_params)); - break; - } + teaser::GNCRotationSolver::Params rotation_params{ + params_.rotation_max_iterations, params_.rotation_cost_threshold, + params_.rotation_gnc_factor, params_.noise_bound}; + + switch (params_.rotation_estimation_algorithm) { + case ROTATION_ESTIMATION_ALGORITHM::GNC_TLS: { // GNC-TLS method + setRotationEstimator(std::make_unique(rotation_params)); + break; + } + case ROTATION_ESTIMATION_ALGORITHM::FGR: { // FGR method + setRotationEstimator(std::make_unique(rotation_params)); + break; + } + case ROTATION_ESTIMATION_ALGORITHM::QUATRO: { // Quatro method + setRotationEstimator(std::make_unique(rotation_params)); + break; + } } // Initialize the translation estimator setTranslationEstimator( - std::make_unique(noise_bound, cbar2)); + std::make_unique(params_.noise_bound, params_.cbar2)); // Clear member variables max_clique_.clear(); @@ -888,23 +867,21 @@ class RobustRegistrationSolver { * Reset the solver using the provided params * @param params a Params struct */ - void reset(const Params& params) { - reset( - params.noise_bound, - params.cbar2, - params.estimate_scaling, - params.rotation_estimation_algorithm, - params.rotation_gnc_factor, - params.rotation_max_iterations, - params.rotation_cost_threshold, - params.rotation_tim_graph, - params.inlier_selection_mode, - params.kcore_heuristic_threshold, - params.use_max_clique, - params.max_clique_exact_solution, - params.max_clique_time_limit, - params.max_clique_num_threads - ); + void reset(const double noise_bound, const double cbar2, const bool estimate_scaling, + const ROTATION_ESTIMATION_ALGORITHM rotation_estimation_algorithm, + const double rotation_gnc_factor, const size_t rotation_max_iterations, + const double rotation_cost_threshold, + const INLIER_GRAPH_FORMULATION rotation_tim_graph, + const INLIER_SELECTION_MODE inlier_selection_mode, + const double kcore_heuristic_threshold, + const bool use_max_clique, // deprecated + const bool max_clique_exact_solution, // deprecated + const double max_clique_time_limit, const int max_clique_num_threads) { + reset(Params{noise_bound, cbar2, estimate_scaling, rotation_estimation_algorithm, + rotation_gnc_factor, rotation_max_iterations, rotation_cost_threshold, + rotation_tim_graph, inlier_selection_mode, kcore_heuristic_threshold, + use_max_clique, max_clique_exact_solution, max_clique_time_limit, + max_clique_num_threads}); } /** From 17c983be6a12387f6a6befc46c377777548bd9cc Mon Sep 17 00:00:00 2001 From: Nathan Hughes Date: Sat, 2 Aug 2025 00:01:43 +0000 Subject: [PATCH 2/3] explicitly use ctest and use build testing --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index be1e677..13b5c0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,6 @@ endif () # Options option(BUILD_SHARED_LIBS "Build shared libraries" ON) -option(BUILD_TESTS "Build tests" ON) option(BUILD_TEASER_FPFH "Build TEASER++ wrappers for PCL FPFH estimation." OFF) option(BUILD_MATLAB_BINDINGS "Build MATLAB bindings" OFF) option(BUILD_PYTHON_BINDINGS "Build Python bindings" OFF) @@ -78,7 +77,8 @@ endif () set(TEASERPP_ROOT ${CMAKE_CURRENT_LIST_DIR}) add_subdirectory(teaser) -if (BUILD_TESTS) +include(CTest) +if (BUILD_TESTING) enable_testing() add_subdirectory(test) endif () From d99a7427cd07fe42e0ce8ca9bdee6f2813a697a0 Mon Sep 17 00:00:00 2001 From: Nathan Hughes Date: Sat, 2 Aug 2025 15:29:35 +0000 Subject: [PATCH 3/3] fix python cmake option --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 80d6424..17b65aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,7 @@ wheel.install-dir = "teaserpp_python.libs" [tool.scikit-build.cmake.define] BUILD_PYTHON_BINDINGS = "ON" -BUILD_TESTS = "OFF" +BUILD_TESTING = "OFF" BUILD_SHARED_LIBS = "OFF" [tool.cibuildwheel]