GLIM
Loading...
Searching...
No Matches
manual_loop_close_modal.hpp
1#pragma once
2
3#include <spdlog/spdlog.h>
4#include <glim/mapping/sub_map.hpp>
5#include <gtsam/nonlinear/NonlinearFactor.h>
6#include <gtsam_points/types/point_cloud.hpp>
7#include <gtsam_points/types/point_cloud_cpu.hpp>
8#include <gtsam_points/ann/nearest_neighbor_search.hpp>
9#include <glk/drawable.hpp>
10
11namespace guik {
12class GLCanvas;
13class ModelControl;
14class ProgressModal;
15class ProgressInterface;
16} // namespace guik
17
18namespace glim {
19
24public:
25 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
26
27 ManualLoopCloseModal(const std::shared_ptr<spdlog::logger>& logger, int num_threads);
29
30 bool is_target_set() const;
31 bool is_source_set() const;
32
33 void set_target(const gtsam::Key target_key, const gtsam_points::PointCloud::ConstPtr& target, const Eigen::Isometry3d& target_pose);
34 void set_source(const gtsam::Key source_key, const gtsam_points::PointCloud::ConstPtr& source, const Eigen::Isometry3d& source_pose);
35
36 void set_submaps(const std::vector<SubMap::ConstPtr>& target_submaps, const std::vector<SubMap::ConstPtr>& source_submaps);
37
38 void clear();
39
40 gtsam::NonlinearFactor::shared_ptr run();
41
42private:
43 std::pair<gtsam_points::PointCloudCPU::Ptr, gtsam_points::PointCloudCPU::Ptr> preprocess_maps(guik::ProgressInterface& progress);
44
45 std::shared_ptr<Eigen::Isometry3d> align_global(guik::ProgressInterface& progress);
46
47 std::shared_ptr<Eigen::Isometry3d> align(guik::ProgressInterface& progress);
48 gtsam::NonlinearFactor::shared_ptr create_factor();
49 void draw_canvas();
50
51 bool show_note(const std::string& note);
52
53private:
54 const int num_threads;
55
56 bool request_to_open;
57 std::unique_ptr<guik::GLCanvas> canvas;
58 std::unique_ptr<guik::ProgressModal> progress_modal;
59 std::unique_ptr<guik::ModelControl> model_control;
60
61 int seed;
62
63 // Map preprocess params
64 float min_distance;
65
66 // Global registration params
67 float fpfh_radius;
68 int global_registration_type;
69 bool global_registration_4dof;
70
71 int ransac_max_iterations;
72 float ransac_early_stop_rate;
73 float ransac_inlier_voxel_resolution;
74
75 int gnc_max_samples;
76
77 // Scan matching and loop factor params
78 float information_scale;
79 float max_correspondence_distance;
80
81 gtsam::Key target_key;
82 gtsam::Key source_key;
83
84 Eigen::Isometry3d target_pose; // Target pose in world frame
85 Eigen::Isometry3d source_pose; // Source pose in world frame
86
87 gtsam_points::PointCloudCPU::Ptr target; // Gravity aligned target point cloud
88 gtsam_points::PointCloudCPU::Ptr source; // Gravity aligned source point cloud
89
90 glk::Drawable::ConstPtr target_drawable; // Gravity aligned target drawable
91 glk::Drawable::ConstPtr source_drawable; // Gravity aligned source drawable
92
93 gtsam_points::NearestNeighborSearch::Ptr target_fpfh_tree;
94 gtsam_points::NearestNeighborSearch::Ptr source_fpfh_tree;
95
96 std::vector<SubMap::ConstPtr> target_submaps;
97 std::vector<SubMap::ConstPtr> source_submaps;
98
99 std::shared_ptr<void> tbb_task_arena;
100
101 // Logging
102 std::shared_ptr<spdlog::logger> logger;
103};
104
105} // namespace glim
ImGUI modal for manually creating loop factors.
Definition manual_loop_close_modal.hpp:23