Matcher.h
Go to the documentation of this file.
1 /* -------------------------------------------------------------------------
2  * A repertory of multi primitive-to-primitive (MP2P) ICP algorithms in C++
3  * Copyright (C) 2018-2024 Jose Luis Blanco, University of Almeria
4  * See LICENSE for license information.
5  * ------------------------------------------------------------------------- */
12 #pragma once
13 
14 #include <mp2p_icp/Pairings.h>
16 #include <mp2p_icp/metricmap.h>
18 #include <mrpt/containers/yaml.h>
19 #include <mrpt/rtti/CObject.h>
20 #include <mrpt/system/COutputLogger.h>
21 #include <mrpt/version.h>
22 
23 namespace mp2p_icp
24 {
30 {
31  MatchContext() = default;
32 
34  uint32_t icpIteration = 0;
35 };
36 
37 struct MatchState
38 {
39  MatchState(const metric_map_t& pcGlobal, const metric_map_t& pcLocal)
40  : pcGlobal_(pcGlobal), pcLocal_(pcLocal)
41  {
42  initialize();
43  }
44 
48 
51 
54  void initialize()
55  {
58  }
59 
60  private:
63 };
64 
73 class Matcher : public mrpt::system::COutputLogger,
74  public mrpt::rtti::CObject,
76 {
77 #if MRPT_VERSION < 0x020e00
78  DEFINE_VIRTUAL_MRPT_OBJECT(Matcher)
79 #else
80  DEFINE_VIRTUAL_MRPT_OBJECT(Matcher, mp2p_icp)
81 #endif
82 
83  public:
85  virtual void initialize(const mrpt::containers::yaml& params);
86 
91  virtual bool match(
92  const metric_map_t& pcGlobal, const metric_map_t& pcLocal,
93  const mrpt::poses::CPose3D& localPose, const MatchContext& mc,
94  MatchState& ms, Pairings& out) const;
95 
96  uint32_t runFromIteration = 0;
97  uint32_t runUpToIteration = 0;
98  bool enabled = true;
99 
100  protected:
102  virtual bool impl_match(
103  const metric_map_t& pcGlobal, const metric_map_t& pcLocal,
104  const mrpt::poses::CPose3D& localPose, const MatchContext& mc,
105  MatchState& ms, Pairings& out) const = 0;
106 };
107 
108 using matcher_list_t = std::vector<mp2p_icp::Matcher::Ptr>;
109 
118  const matcher_list_t& matchers, const metric_map_t& pcGlobal,
119  const metric_map_t& pcLocal, const mrpt::poses::CPose3D& local_wrt_global,
120  const MatchContext& mc,
121  const mrpt::optional_ref<MatchState>& userProvidedMS = std::nullopt);
122 
123 } // namespace mp2p_icp
mp2p_icp
Definition: covariance.h:17
mp2p_icp::Matcher
Definition: Matcher.h:73
mp2p_icp::Matcher::runUpToIteration
uint32_t runUpToIteration
0: no limit
Definition: Matcher.h:97
mp2p_icp::Pairings
Definition: Pairings.h:78
mp2p_icp::MatchState::MatchState
MatchState(const metric_map_t &pcGlobal, const metric_map_t &pcLocal)
Definition: Matcher.h:39
mp2p_icp::pointcloud_bitfield_t::initialize_from
void initialize_from(const metric_map_t &pc)
Definition: pointcloud_bitfield.h:87
mp2p_icp::MatchContext::MatchContext
MatchContext()=default
mp2p_icp::Matcher::match
virtual bool match(const metric_map_t &pcGlobal, const metric_map_t &pcLocal, const mrpt::poses::CPose3D &localPose, const MatchContext &mc, MatchState &ms, Pairings &out) const
Definition: mp2p_icp/src/Matcher.cpp:27
mp2p_icp::Matcher::enabled
bool enabled
Definition: Matcher.h:98
mp2p_icp::MatchState::initialize
void initialize()
Definition: Matcher.h:54
mp2p_icp::MatchState
Definition: Matcher.h:37
kitti-batch-convert.out
string out
Definition: kitti-batch-convert.py:7
mp2p_icp::Matcher::runFromIteration
uint32_t runFromIteration
Definition: Matcher.h:96
mp2p_icp::Parameterizable
Definition: Parameterizable.h:85
mp2p_icp::MatchContext
Definition: Matcher.h:29
Pairings.h
Common types for all SE(3) optimal transformation methods.
mp2p_icp::MatchState::pcLocal_
const metric_map_t & pcLocal_
Definition: Matcher.h:62
Parameterizable.h
mp2p_icp::MatchState::globalPairedBitField
pointcloud_bitfield_t globalPairedBitField
Like localPairedBitField for the global map.
Definition: Matcher.h:50
mp2p_icp::Matcher::impl_match
virtual bool impl_match(const metric_map_t &pcGlobal, const metric_map_t &pcLocal, const mrpt::poses::CPose3D &localPose, const MatchContext &mc, MatchState &ms, Pairings &out) const =0
mp2p_icp::run_matchers
Pairings run_matchers(const matcher_list_t &matchers, const metric_map_t &pcGlobal, const metric_map_t &pcLocal, const mrpt::poses::CPose3D &local_wrt_global, const MatchContext &mc, const mrpt::optional_ref< MatchState > &userProvidedMS=std::nullopt)
Definition: mp2p_icp/src/Matcher.cpp:39
metricmap.h
Generic representation of pointcloud(s) and/or extracted features.
mp2p_icp::metric_map_t
Generic container of pointcloud(s), extracted features and other maps.
Definition: metricmap.h:49
mp2p_icp::MatchState::pcGlobal_
const metric_map_t & pcGlobal_
Definition: Matcher.h:61
mp2p_icp::MatchState::localPairedBitField
pointcloud_bitfield_t localPairedBitField
Definition: Matcher.h:47
pointcloud_bitfield.h
A bit field with a bool for each metric_map_t entity.
mp2p_icp::pointcloud_bitfield_t
Definition: pointcloud_bitfield.h:34
mp2p_icp::matcher_list_t
std::vector< mp2p_icp::Matcher::Ptr > matcher_list_t
Definition: Matcher.h:108
mp2p_icp::Matcher::initialize
virtual void initialize(const mrpt::containers::yaml &params)
Definition: mp2p_icp/src/Matcher.cpp:20
mp2p_icp::MatchContext::icpIteration
uint32_t icpIteration
The ICP iteration number we are in:
Definition: Matcher.h:34


mp2p_icp
Author(s):
autogenerated on Fri Dec 20 2024 03:45:59