iterative closest points
CEV ICP algorithm library
Loading...
Searching...
No Matches
driver.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <optional>
9#include <chrono>
10#include "icp.h"
11
12namespace icp {
13
17 class ICPDriver {
18 public:
30
36 ICPDriver(std::unique_ptr<ICP> icp);
37
47 ConvergenceState converge(const std::vector<Vector>& a, const std::vector<Vector>& b,
48 RBTransform t);
49
56 void set_min_iterations(uint64_t min_iterations);
57
63 void set_max_iterations(uint64_t max_iterations);
64
71 void set_stop_cost(double stop_cost);
72
73 // TODO: fix docs to use math once doxygen is fixed
81 void set_relative_cost_tolerance(double relative_cost_tolerance);
82
90 void set_absolute_cost_tolerance(double absolute_cost_tolerance);
91
102 void set_transform_tolerance(double angle_tolerance, double translation_tolerance);
103
110 void set_time_limit(std::chrono::duration<double> time_limit);
111
112 private:
113 bool should_terminate(ConvergenceState current_state,
114 std::optional<ConvergenceState> last_state);
115
116 std::unique_ptr<ICP> icp_;
117
118 std::optional<uint64_t> min_iterations_;
119 std::optional<uint64_t> max_iterations_;
120 std::optional<double> stop_cost_;
121 std::optional<double> relative_cost_tolerance_;
122 std::optional<double> absolute_cost_tolerance_;
123 std::optional<double> angle_tolerance_rad_;
124 std::optional<double> translation_tolerance_;
125 std::optional<std::chrono::duration<double>> time_limit_;
126
127 std::chrono::time_point<std::chrono::steady_clock> start_time_;
128 };
129}
Driver for running ICP to convergence.
Definition driver.h:17
void set_min_iterations(uint64_t min_iterations)
Sets the minimum number of iterations to run.
Definition driver.cpp:93
void set_transform_tolerance(double angle_tolerance, double translation_tolerance)
Set the transform tolerance.
Definition driver.cpp:115
void set_absolute_cost_tolerance(double absolute_cost_tolerance)
Set the absolute cost tolerance.
Definition driver.cpp:111
void set_relative_cost_tolerance(double relative_cost_tolerance)
Sets the relative cost tolerance.
Definition driver.cpp:107
void set_time_limit(std::chrono::duration< double > time_limit)
Set the time limit for converge.
Definition driver.cpp:120
void set_stop_cost(double stop_cost)
Sets the cost at which to stop ICP.
Definition driver.cpp:103
void set_max_iterations(uint64_t max_iterations)
Sets the maximum number of iterations to run.
Definition driver.cpp:98
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:14
Definition driver.h:12
The result of running ICPDriver::converge.
Definition driver.h:20
double cost
The cost achieved.
Definition driver.h:22
size_t iteration_count
The number of iterations performed.
Definition driver.h:25
RBTransform transform
The transform.
Definition driver.h:28
Rigid-body transformation.
Definition geo.h:19