Skip to content

Commit e2f6f17

Browse files
fix missing setter for params in teaser (#208)
* fix missing setter for params in teaser * explicitly use ctest and use build testing * fix python cmake option
1 parent f91cfdb commit e2f6f17

File tree

3 files changed

+54
-77
lines changed

3 files changed

+54
-77
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ endif ()
1919

2020
# Options
2121
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
22-
option(BUILD_TESTS "Build tests" ON)
2322
option(BUILD_TEASER_FPFH "Build TEASER++ wrappers for PCL FPFH estimation." OFF)
2423
option(BUILD_MATLAB_BINDINGS "Build MATLAB bindings" OFF)
2524
option(BUILD_PYTHON_BINDINGS "Build Python bindings" OFF)
@@ -78,7 +77,8 @@ endif ()
7877
set(TEASERPP_ROOT ${CMAKE_CURRENT_LIST_DIR})
7978
add_subdirectory(teaser)
8079

81-
if (BUILD_TESTS)
80+
include(CTest)
81+
if (BUILD_TESTING)
8282
enable_testing()
8383
add_subdirectory(test)
8484
endif ()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ wheel.install-dir = "teaserpp_python.libs"
5252

5353
[tool.scikit-build.cmake.define]
5454
BUILD_PYTHON_BINDINGS = "ON"
55-
BUILD_TESTS = "OFF"
55+
BUILD_TESTING = "OFF"
5656
BUILD_SHARED_LIBS = "OFF"
5757

5858
[tool.cibuildwheel]

teaser/include/teaser/registration.h

Lines changed: 51 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,9 @@ class FastGlobalRegistrationSolver : public GNCRotationSolver {
321321
* H. Lim et al., "A Single Correspondence Is Enough: Robust Global Registration
322322
* to Avoid Degeneracy in Urban Environments," in Robotics - ICRA 2022,
323323
* Accepted. To appear. arXiv:2203.06612 [cs], Mar. 2022.
324-
* Quatro and TEASER++ differ in the estimation of rotation. Quatro forgoes roll and pitch estimation,
325-
* yet it is empirically found that it makes the algorithm more robust against degeneracy.
324+
* Quatro and TEASER++ differ in the estimation of rotation. Quatro forgoes roll and pitch
325+
* estimation, yet it is empirically found that it makes the algorithm more robust against
326+
* degeneracy.
326327
*/
327328
class QuatroSolver : public GNCRotationSolver {
328329
public:
@@ -515,28 +516,21 @@ class RobustRegistrationSolver {
515516

516517
RobustRegistrationSolver() = default;
517518

518-
519519
/**
520520
* A constructor that takes in parameters and initialize the estimators
521521
* accordingly. If the parameters need to be reused consider instantiating
522522
* a Params struct.
523523
*/
524-
RobustRegistrationSolver(
525-
double noise_bound,
526-
double cbar2,
527-
bool estimate_scaling,
528-
ROTATION_ESTIMATION_ALGORITHM rotation_estimation_algorithm,
529-
double rotation_gnc_factor,
530-
size_t rotation_max_iterations,
531-
double rotation_cost_threshold,
532-
INLIER_GRAPH_FORMULATION rotation_tim_graph,
533-
INLIER_SELECTION_MODE inlier_selection_mode,
534-
double kcore_heuristic_threshold,
535-
bool use_max_clique, // deprecated
536-
bool max_clique_exact_solution, // deprecated
537-
double max_clique_time_limit,
538-
int max_clique_num_threads = 0
539-
);
524+
RobustRegistrationSolver(double noise_bound, double cbar2, bool estimate_scaling,
525+
ROTATION_ESTIMATION_ALGORITHM rotation_estimation_algorithm,
526+
double rotation_gnc_factor, size_t rotation_max_iterations,
527+
double rotation_cost_threshold,
528+
INLIER_GRAPH_FORMULATION rotation_tim_graph,
529+
INLIER_SELECTION_MODE inlier_selection_mode,
530+
double kcore_heuristic_threshold,
531+
bool use_max_clique, // deprecated
532+
bool max_clique_exact_solution, // deprecated
533+
double max_clique_time_limit, int max_clique_num_threads = 0);
540534

541535
/**
542536
* A constructor that takes in parameters and initialize the estimators accordingly.
@@ -827,55 +821,40 @@ class RobustRegistrationSolver {
827821
* Reset the solver using the provided params
828822
* @param params a Params struct
829823
*/
830-
void reset(
831-
const double noise_bound,
832-
const double cbar2,
833-
const bool estimate_scaling,
834-
const ROTATION_ESTIMATION_ALGORITHM rotation_estimation_algorithm,
835-
const double rotation_gnc_factor,
836-
const size_t rotation_max_iterations,
837-
const double rotation_cost_threshold,
838-
const INLIER_GRAPH_FORMULATION rotation_tim_graph,
839-
const INLIER_SELECTION_MODE inlier_selection_mode,
840-
const double kcore_heuristic_threshold,
841-
const bool use_max_clique , // deprecated
842-
const bool max_clique_exact_solution, // deprecated
843-
const double max_clique_time_limit,
844-
const int max_clique_num_threads
845-
) {
824+
void reset(const Params& params) {
825+
params_ = params;
846826
// Initialize the scale estimator
847-
if (estimate_scaling) {
827+
if (params_.estimate_scaling) {
848828
setScaleEstimator(
849-
std::make_unique<teaser::TLSScaleSolver>(noise_bound, cbar2));
829+
std::make_unique<teaser::TLSScaleSolver>(params_.noise_bound, params_.cbar2));
850830
} else {
851831
setScaleEstimator(
852-
std::make_unique<teaser::ScaleInliersSelector>(noise_bound, cbar2));
832+
std::make_unique<teaser::ScaleInliersSelector>(params_.noise_bound, params_.cbar2));
853833
}
854834

855835
// Initialize the rotation estimator
856-
teaser::GNCRotationSolver::Params rotation_params {
857-
rotation_max_iterations, rotation_cost_threshold,
858-
rotation_gnc_factor, noise_bound
859-
};
860-
861-
switch (rotation_estimation_algorithm) {
862-
case ROTATION_ESTIMATION_ALGORITHM::GNC_TLS: { // GNC-TLS method
863-
setRotationEstimator(std::make_unique<teaser::GNCTLSRotationSolver>(rotation_params));
864-
break;
865-
}
866-
case ROTATION_ESTIMATION_ALGORITHM::FGR: { // FGR method
867-
setRotationEstimator(std::make_unique<teaser::FastGlobalRegistrationSolver>(rotation_params));
868-
break;
869-
}
870-
case ROTATION_ESTIMATION_ALGORITHM::QUATRO: { // Quatro method
871-
setRotationEstimator(std::make_unique<teaser::QuatroSolver>(rotation_params));
872-
break;
873-
}
836+
teaser::GNCRotationSolver::Params rotation_params{
837+
params_.rotation_max_iterations, params_.rotation_cost_threshold,
838+
params_.rotation_gnc_factor, params_.noise_bound};
839+
840+
switch (params_.rotation_estimation_algorithm) {
841+
case ROTATION_ESTIMATION_ALGORITHM::GNC_TLS: { // GNC-TLS method
842+
setRotationEstimator(std::make_unique<teaser::GNCTLSRotationSolver>(rotation_params));
843+
break;
844+
}
845+
case ROTATION_ESTIMATION_ALGORITHM::FGR: { // FGR method
846+
setRotationEstimator(std::make_unique<teaser::FastGlobalRegistrationSolver>(rotation_params));
847+
break;
848+
}
849+
case ROTATION_ESTIMATION_ALGORITHM::QUATRO: { // Quatro method
850+
setRotationEstimator(std::make_unique<teaser::QuatroSolver>(rotation_params));
851+
break;
852+
}
874853
}
875854

876855
// Initialize the translation estimator
877856
setTranslationEstimator(
878-
std::make_unique<teaser::TLSTranslationSolver>(noise_bound, cbar2));
857+
std::make_unique<teaser::TLSTranslationSolver>(params_.noise_bound, params_.cbar2));
879858

880859
// Clear member variables
881860
max_clique_.clear();
@@ -888,23 +867,21 @@ class RobustRegistrationSolver {
888867
* Reset the solver using the provided params
889868
* @param params a Params struct
890869
*/
891-
void reset(const Params& params) {
892-
reset(
893-
params.noise_bound,
894-
params.cbar2,
895-
params.estimate_scaling,
896-
params.rotation_estimation_algorithm,
897-
params.rotation_gnc_factor,
898-
params.rotation_max_iterations,
899-
params.rotation_cost_threshold,
900-
params.rotation_tim_graph,
901-
params.inlier_selection_mode,
902-
params.kcore_heuristic_threshold,
903-
params.use_max_clique,
904-
params.max_clique_exact_solution,
905-
params.max_clique_time_limit,
906-
params.max_clique_num_threads
907-
);
870+
void reset(const double noise_bound, const double cbar2, const bool estimate_scaling,
871+
const ROTATION_ESTIMATION_ALGORITHM rotation_estimation_algorithm,
872+
const double rotation_gnc_factor, const size_t rotation_max_iterations,
873+
const double rotation_cost_threshold,
874+
const INLIER_GRAPH_FORMULATION rotation_tim_graph,
875+
const INLIER_SELECTION_MODE inlier_selection_mode,
876+
const double kcore_heuristic_threshold,
877+
const bool use_max_clique, // deprecated
878+
const bool max_clique_exact_solution, // deprecated
879+
const double max_clique_time_limit, const int max_clique_num_threads) {
880+
reset(Params{noise_bound, cbar2, estimate_scaling, rotation_estimation_algorithm,
881+
rotation_gnc_factor, rotation_max_iterations, rotation_cost_threshold,
882+
rotation_tim_graph, inlier_selection_mode, kcore_heuristic_threshold,
883+
use_max_clique, max_clique_exact_solution, max_clique_time_limit,
884+
max_clique_num_threads});
908885
}
909886

910887
/**

0 commit comments

Comments
 (0)