test-mp2p_matcher_pt2pt_parameterizable.cpp
Go to the documentation of this file.
1 /* -------------------------------------------------------------------------
2  * A Modular Optimization framework for Localization and mApping (MOLA)
3  * Copyright (C) 2018-2024 Jose Luis Blanco, University of Almeria
4  * See LICENSE for license information.
5  * ------------------------------------------------------------------------- */
6 
15 
16 int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv)
17 {
18  try
19  {
20  {
22  mrpt::containers::yaml p;
23  p["threshold"] = "MATCH_THRESHOLD*2.0"; // Define as an expr.
24  p["thresholdAngularDeg"] = .0;
25 
26  m.initialize(p);
27 
28  mp2p_icp::ParameterSource globalParams;
29  globalParams.attach(m);
30 
31  // v1:
32  globalParams.updateVariable("MATCH_THRESHOLD", 1.5);
33  globalParams.realize();
34 
35  ASSERT_NEAR_(m.threshold, 3.0, 1e-4);
36  ASSERT_NEAR_(m.thresholdAngularDeg, .0, 1e-4);
37 
38  // v2:
39  globalParams.updateVariable("MATCH_THRESHOLD", 0.5);
40  globalParams.realize();
41 
42  ASSERT_NEAR_(m.threshold, 1.0, 1e-4);
43  ASSERT_NEAR_(m.thresholdAngularDeg, .0, 1e-4);
44  }
45  }
46  catch (std::exception& e)
47  {
48  std::cerr << mrpt::exception_to_str(e) << "\n";
49  return 1;
50  }
51 }
mp2p_icp::Matcher_Points_DistanceThreshold::initialize
void initialize(const mrpt::containers::yaml &params) override
Definition: Matcher_Points_DistanceThreshold.cpp:33
mp2p_icp::ParameterSource
Definition: Parameterizable.h:42
mp2p_icp::ParameterSource::attach
void attach(Parameterizable &obj)
Definition: Parameterizable.cpp:15
mp2p_icp::Matcher_Points_DistanceThreshold::thresholdAngularDeg
double thresholdAngularDeg
Definition: Matcher_Points_DistanceThreshold.h:54
mp2p_icp::Matcher_Points_DistanceThreshold
Definition: Matcher_Points_DistanceThreshold.h:30
mp2p_icp::Matcher_Points_DistanceThreshold::threshold
double threshold
Definition: Matcher_Points_DistanceThreshold.h:53
mp2p_icp::ParameterSource::realize
void realize()
Definition: Parameterizable.cpp:37
mp2p_icp::ParameterSource::updateVariable
void updateVariable(const std::string &variable, double value)
Definition: Parameterizable.h:51
Matcher_Points_DistanceThreshold.h
Pointcloud matcher: fixed distance thresholds.
main
int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
Definition: test-mp2p_matcher_pt2pt_parameterizable.cpp:16


mp2p_icp
Author(s):
autogenerated on Thu Dec 26 2024 03:48:12