iterative closest points
CEV ICP algorithm library
Loading...
Searching...
No Matches
driver.h
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4#include <chrono>
5#include "icp.h"
6
7namespace icp {
8
12 class ICPDriver {
13 public:
25
31 ICPDriver(std::unique_ptr<ICP> icp);
32
42 ConvergenceState converge(const std::vector<Vector>& a, const std::vector<Vector>& b,
43 RBTransform t);
44
51 void set_min_iterations(uint64_t min_iterations);
52
58 void set_max_iterations(uint64_t max_iterations);
59
66 void set_stop_cost(double stop_cost);
67
68 // TODO: fix docs to use math once doxygen is fixed
76 void set_relative_cost_tolerance(double relative_cost_tolerance);
77
85 void set_absolute_cost_tolerance(double absolute_cost_tolerance);
86
97 void set_transform_tolerance(double angle_tolerance, double translation_tolerance);
98
105 void set_time_limit(std::chrono::duration<double> time_limit);
106
107 private:
108 bool should_terminate(ConvergenceState current_state,
109 std::optional<ConvergenceState> last_state);
110
111 std::unique_ptr<ICP> icp_;
112
113 std::optional<uint64_t> min_iterations_;
114 std::optional<uint64_t> max_iterations_;
115 std::optional<double> stop_cost_;
116 std::optional<double> relative_cost_tolerance_;
117 std::optional<double> absolute_cost_tolerance_;
118 std::optional<double> angle_tolerance_rad_;
119 std::optional<double> translation_tolerance_;
120 std::optional<std::chrono::duration<double>> time_limit_;
121
122 std::chrono::time_point<std::chrono::steady_clock> start_time_;
123 };
124}
Driver for running ICP to convergence.
Definition driver.h:12
void set_min_iterations(uint64_t min_iterations)
Sets the minimum number of iterations to run.
Definition driver.cpp:88
void set_transform_tolerance(double angle_tolerance, double translation_tolerance)
Set the transform tolerance.
Definition driver.cpp:110
void set_absolute_cost_tolerance(double absolute_cost_tolerance)
Set the absolute cost tolerance.
Definition driver.cpp:106
void set_relative_cost_tolerance(double relative_cost_tolerance)
Sets the relative cost tolerance.
Definition driver.cpp:102
void set_time_limit(std::chrono::duration< double > time_limit)
Set the time limit for converge.
Definition driver.cpp:115
void set_stop_cost(double stop_cost)
Sets the cost at which to stop ICP.
Definition driver.cpp:98
void set_max_iterations(uint64_t max_iterations)
Sets the maximum number of iterations to run.
Definition driver.cpp:93
ConvergenceState converge(const std::vector< Vector > &a, const std::vector< Vector > &b, RBTransform t)
Runs ICP to convergence based on the termination conditions set.
Definition driver.cpp:9
Definition driver.h:7
The result of running ICPDriver::converge.
Definition driver.h:15
double cost
The cost achieved.
Definition driver.h:17
size_t iteration_count
The number of iterations performed.
Definition driver.h:20
RBTransform transform
The transform.
Definition driver.h:23
Rigid-body transformation.
Definition geo.h:19