GLIM
Loading...
Searching...
No Matches
odometry_estimation_imu.hpp
1#pragma once
2
3#include <map>
4#include <memory>
5#include <random>
6
7#include <glim/odometry/odometry_estimation_base.hpp>
8#include <gtsam_points/util/gtsam_migration.hpp>
9#include <gtsam_points/util/indexed_sliding_window.hpp>
10
11namespace gtsam {
12class Pose3;
13class Values;
14class ImuFactor;
15class NonlinearFactorGraph;
16} // namespace gtsam
17
18namespace gtsam_points {
19class IncrementalFixedLagSmootherExt;
20class IncrementalFixedLagSmootherExtWithFallback;
21} // namespace gtsam_points
22
23namespace glim {
24
25class IMUIntegration;
26class CloudDeskewing;
27class CloudCovarianceEstimation;
28class InitialStateEstimation;
29
34public:
35 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
36
39
40public:
41 // Sensor params;
42 bool fix_imu_bias;
43 double imu_bias_noise;
44 Eigen::Isometry3d T_lidar_imu;
45 Eigen::Matrix<double, 6, 1> imu_bias;
46
47 // Init state
48 std::string initialization_mode;
49 bool estimate_init_state;
50 Eigen::Isometry3d init_T_world_imu;
51 Eigen::Vector3d init_v_world_imu;
52 double init_pose_damping_scale;
53
54 // Optimization params
55 double smoother_lag;
56 bool use_isam2_dogleg;
57 double isam2_relinearize_skip;
58 double isam2_relinearize_thresh;
59
60 // Logging params
61 bool save_imu_rate_trajectory;
62
63 int num_threads; // Number of threads for preprocessing and per-factor parallelism
64 int num_smoother_update_threads; // Number of threads for TBB parallelism in smoother update (should be kept 1)
65};
66
71public:
72 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
73
74 OdometryEstimationIMU(std::unique_ptr<OdometryEstimationIMUParams>&& params);
75 virtual ~OdometryEstimationIMU() override;
76
77 virtual void insert_imu(const double stamp, const Eigen::Vector3d& linear_acc, const Eigen::Vector3d& angular_vel) override;
78 virtual EstimationFrame::ConstPtr insert_frame(const PreprocessedFrame::Ptr& frame, std::vector<EstimationFrame::ConstPtr>& marginalized_frames) override;
79 virtual std::vector<EstimationFrame::ConstPtr> get_remaining_frames() override;
80
81protected:
82 virtual void create_frame(EstimationFrame::Ptr& frame) {}
83 virtual gtsam::NonlinearFactorGraph create_factors(const int current, const gtsam_points::shared_ptr<gtsam::ImuFactor>& imu_factor, gtsam::Values& new_values) = 0;
84
85 virtual void fallback_smoother() {}
86 virtual void update_frames(const int current, const gtsam::NonlinearFactorGraph& new_factors);
87
88 virtual void
89 update_smoother(const gtsam::NonlinearFactorGraph& new_factors, const gtsam::Values& new_values, const std::map<std::uint64_t, double>& new_stamp, int update_count = 0);
90 virtual void update_smoother(int update_count = 1);
91
92protected:
93 std::unique_ptr<OdometryEstimationIMUParams> params;
94
95 // Sensor extrinsic params
96 Eigen::Isometry3d T_lidar_imu;
97 Eigen::Isometry3d T_imu_lidar;
98
99 // Frames & keyframes
100 int marginalized_cursor;
102
103 // Utility classes
104 std::unique_ptr<InitialStateEstimation> init_estimation;
105 std::unique_ptr<IMUIntegration> imu_integration;
106 std::unique_ptr<CloudDeskewing> deskewing;
107 std::unique_ptr<CloudCovarianceEstimation> covariance_estimation;
108
109 // Optimizer
111 std::unique_ptr<FixedLagSmootherExt> smoother;
112
113 std::shared_ptr<void> tbb_task_arena;
114};
115
116} // namespace glim
Odometry estimation base class.
Definition odometry_estimation_base.hpp:22
Base class for LiDAR-IMU odometry estimation.
Definition odometry_estimation_imu.hpp:70
virtual EstimationFrame::ConstPtr insert_frame(const PreprocessedFrame::Ptr &frame, std::vector< EstimationFrame::ConstPtr > &marginalized_frames) override
Insert a point cloud.
virtual void insert_imu(const double stamp, const Eigen::Vector3d &linear_acc, const Eigen::Vector3d &angular_vel) override
Insert an IMU data.
virtual std::vector< EstimationFrame::ConstPtr > get_remaining_frames() override
Pop out the remaining non-marginalized frames (called at the end of the sequence)
Definition loose_initial_state_estimation.hpp:9
Parameters for OdometryEstimationIMU.
Definition odometry_estimation_imu.hpp:33