mp2p_icp
src
Solver.cpp
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
* ------------------------------------------------------------------------- */
13
#include <
mp2p_icp/Solver.h
>
14
#include <mrpt/core/exceptions.h>
15
16
IMPLEMENTS_VIRTUAL_MRPT_OBJECT
(
Solver
, mrpt::rtti::CObject,
mp2p_icp
)
17
18
using namespace
mp2p_icp
;
19
20
void
Solver::initialize
(
const
mrpt::containers::yaml& params)
21
{
22
MCP_LOAD_OPT(params,
runFromIteration
);
23
MCP_LOAD_OPT(params,
runUpToIteration
);
24
MCP_LOAD_OPT(params,
enabled
);
25
MCP_LOAD_OPT(params,
runUntilTranslationCorrectionSmallerThan
);
26
}
27
28
bool
Solver::optimal_pose
(
29
const
Pairings
& pairings,
OptimalTF_Result
&
out
,
30
const
SolverContext
& sc)
const
31
{
32
if
(!
enabled
)
return
false
;
33
34
const
auto
iter = sc.
icpIteration
;
35
if
(iter.has_value() && *iter <
runFromIteration
)
return
false
;
36
if
(iter.has_value() &&
runUpToIteration
> 0 && *iter >
runUpToIteration
)
37
return
false
;
38
39
if
(
runUntilTranslationCorrectionSmallerThan
> 0)
40
{
41
// already fulfilled in past iters?
42
auto
& myData = sc.
perSolverPersistentData
[
this
];
43
if
(myData.count(
"finished"
) != 0)
return
false
;
44
45
// Detect threshold:
46
if
(sc.
lastIcpStepIncrement
&&
47
sc.
lastIcpStepIncrement
.value().translation().norm() <
48
runUntilTranslationCorrectionSmallerThan
)
49
{
50
// Yes, stop using this solver.
51
// Store the condition and quit.
52
std::any& value = myData[
"finished"
];
53
value =
true
;
54
return
false
;
55
}
56
}
57
58
return
impl_optimal_pose
(pairings,
out
, sc);
59
}
mp2p_icp::Solver::runFromIteration
uint32_t runFromIteration
Definition:
Solver.h:90
mp2p_icp::Solver::optimal_pose
virtual bool optimal_pose(const Pairings &pairings, OptimalTF_Result &out, const SolverContext &sc) const
Definition:
Solver.cpp:28
mp2p_icp
Definition:
covariance.h:17
mp2p_icp::SolverContext::perSolverPersistentData
std::map< const Solver *, std::map< std::string, std::any > > perSolverPersistentData
Definition:
Solver.h:53
mp2p_icp::Pairings
Definition:
Pairings.h:78
mp2p_icp::SolverContext
Definition:
Solver.h:36
mp2p_icp::OptimalTF_Result
Definition:
OptimalTF_Result.h:24
Solver.h
Virtual base class for optimal alignment solvers (one step in ICP).
mp2p_icp::SolverContext::icpIteration
std::optional< uint32_t > icpIteration
Definition:
Solver.h:55
kitti-batch-convert.out
string out
Definition:
kitti-batch-convert.py:7
mp2p_icp::SolverContext::lastIcpStepIncrement
std::optional< mrpt::poses::CPose3D > lastIcpStepIncrement
Definition:
Solver.h:42
mp2p_icp::Solver
Definition:
Solver.h:66
mp2p_icp::Solver::runUntilTranslationCorrectionSmallerThan
double runUntilTranslationCorrectionSmallerThan
Definition:
Solver.h:93
mp2p_icp::Solver::impl_optimal_pose
virtual bool impl_optimal_pose(const Pairings &pairings, OptimalTF_Result &out, const SolverContext &sc) const =0
mp2p_icp::Solver::initialize
virtual void initialize(const mrpt::containers::yaml ¶ms)
Definition:
Solver.cpp:20
IMPLEMENTS_VIRTUAL_MRPT_OBJECT
IMPLEMENTS_VIRTUAL_MRPT_OBJECT(FilterBase, mrpt::rtti::CObject, mp2p_icp_filters) using namespace mp2p_icp_filters
mp2p_icp::Solver::runUpToIteration
uint32_t runUpToIteration
0: no limit
Definition:
Solver.h:91
mp2p_icp::Solver::enabled
bool enabled
Definition:
Solver.h:96
mp2p_icp
Author(s):
autogenerated on Wed Oct 23 2024 02:45:41