GLIM
Loading...
Searching...
No Matches
sub_mapping.hpp
1#pragma once
2
3#include <any>
4#include <deque>
5#include <random>
6#include <memory>
7#include <glim/mapping/sub_mapping_base.hpp>
8
9namespace gtsam {
10class Values;
11class NonlinearFactorGraph;
12class PreintegratedImuMeasurements;
13} // namespace gtsam
14
15namespace glim {
16
17class IMUIntegration;
18class CloudDeskewing;
19class CloudCovarianceEstimation;
20
25public:
28
29public:
30 bool enable_gpu;
31 bool enable_imu;
32 bool enable_optimization;
33 // Keyframe update strategy params
34 int max_num_keyframes;
35 std::string keyframe_update_strategy;
36 int keyframe_update_min_points;
37 double keyframe_update_interval_rot;
38 double keyframe_update_interval_trans;
39 double max_keyframe_overlap;
40
41 bool create_between_factors;
42 std::string between_registration_type;
43
44 std::string registration_error_factor_type;
45 double keyframe_randomsampling_rate;
46 double keyframe_voxel_resolution;
47 int keyframe_voxelmap_levels;
48 double keyframe_voxelmap_scaling_factor;
49
50 double submap_downsample_resolution;
51 double submap_voxel_resolution;
52 int submap_target_num_points;
53};
54
58class SubMapping : public SubMappingBase {
59public:
61 virtual ~SubMapping() override;
62
63 virtual void insert_imu(const double stamp, const Eigen::Vector3d& linear_acc, const Eigen::Vector3d& angular_vel) override;
64 virtual void insert_frame(const EstimationFrame::ConstPtr& odom_frame) override;
65
66 virtual std::vector<SubMap::Ptr> get_submaps() override;
67
68 virtual std::vector<SubMap::Ptr> submit_end_of_sequence() override;
69
70private:
71 void insert_keyframe(const int current, const EstimationFrame::ConstPtr& odom_frame);
72
73 SubMap::Ptr create_submap(bool force_create = false) const;
74
75private:
77 Params params;
78
79 std::mt19937 mt;
80 int submap_count;
81
82 std::unique_ptr<IMUIntegration> imu_integration;
83 std::unique_ptr<CloudDeskewing> deskewing;
84 std::unique_ptr<CloudCovarianceEstimation> covariance_estimation;
85
86 std::shared_ptr<void> stream;
87 std::shared_ptr<void> stream_buffer_roundrobin;
88
89 std::deque<EstimationFrame::ConstPtr> delayed_input_queue;
90 std::vector<EstimationFrame::ConstPtr> odom_frames;
91
92 std::vector<int> keyframe_indices;
93 std::vector<EstimationFrame::Ptr> keyframes;
94
95 std::unique_ptr<gtsam::Values> values;
96 std::unique_ptr<gtsam::NonlinearFactorGraph> graph;
97
98 std::vector<SubMap::Ptr> submap_queue;
99
100 std::shared_ptr<void> tbb_task_arena;
101};
102
103} // namespace glim
Sub mapping base class.
Definition sub_mapping_base.hpp:22
Sub mapping.
Definition sub_mapping.hpp:58
virtual std::vector< SubMap::Ptr > submit_end_of_sequence() override
Submit the signal to tell end of sequence and collect the remaining submap data.
virtual void insert_imu(const double stamp, const Eigen::Vector3d &linear_acc, const Eigen::Vector3d &angular_vel) override
Insert an IMU data.
virtual void insert_frame(const EstimationFrame::ConstPtr &odom_frame) override
Insert an odometry estimation frame.
virtual std::vector< SubMap::Ptr > get_submaps() override
Get the created submaps.
Sub mapping parameters.
Definition sub_mapping.hpp:24