FeatureInitializer.h
Go to the documentation of this file.
1 /*
2  * OpenVINS: An Open Platform for Visual-Inertial Research
3  * Copyright (C) 2018-2023 Patrick Geneva
4  * Copyright (C) 2018-2023 Guoquan Huang
5  * Copyright (C) 2018-2023 OpenVINS Contributors
6  * Copyright (C) 2018-2019 Kevin Eckenhoff
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef OPEN_VINS_FEATUREINITIALIZER_H
23 #define OPEN_VINS_FEATUREINITIALIZER_H
24 
25 #include <unordered_map>
26 
28 
29 namespace ov_core {
30 
31 class Feature;
32 
43 
44 public:
51  struct ClonePose {
52 
54  Eigen::Matrix<double, 3, 3> _Rot;
55 
57  Eigen::Matrix<double, 3, 1> _pos;
58 
60  ClonePose(const Eigen::Matrix<double, 3, 3> &R, const Eigen::Matrix<double, 3, 1> &p) {
61  _Rot = R;
62  _pos = p;
63  }
64 
66  ClonePose(const Eigen::Matrix<double, 4, 1> &q, const Eigen::Matrix<double, 3, 1> &p) {
67  _Rot = quat_2_Rot(q);
68  _pos = p;
69  }
70 
73  _Rot = Eigen::Matrix<double, 3, 3>::Identity();
74  _pos = Eigen::Matrix<double, 3, 1>::Zero();
75  }
76 
78  const Eigen::Matrix<double, 3, 3> &Rot() { return _Rot; }
79 
81  const Eigen::Matrix<double, 3, 1> &pos() { return _pos; }
82  };
83 
89 
100  bool single_triangulation(std::shared_ptr<Feature> feat, std::unordered_map<size_t, std::unordered_map<double, ClonePose>> &clonesCAM);
101 
113  bool single_triangulation_1d(std::shared_ptr<Feature> feat, std::unordered_map<size_t, std::unordered_map<double, ClonePose>> &clonesCAM);
114 
122  bool single_gaussnewton(std::shared_ptr<Feature> feat, std::unordered_map<size_t, std::unordered_map<double, ClonePose>> &clonesCAM);
123 
129 
130 protected:
133 
142  double compute_error(std::unordered_map<size_t, std::unordered_map<double, ClonePose>> &clonesCAM, std::shared_ptr<Feature> feat,
143  double alpha, double beta, double rho);
144 };
145 
146 } // namespace ov_core
147 
148 #endif // OPEN_VINS_FEATUREINITIALIZER_H
ov_core::FeatureInitializer::ClonePose::_Rot
Eigen::Matrix< double, 3, 3 > _Rot
Rotation.
Definition: FeatureInitializer.h:54
FeatureInitializerOptions.h
ov_core::FeatureInitializer::single_triangulation_1d
bool single_triangulation_1d(std::shared_ptr< Feature > feat, std::unordered_map< size_t, std::unordered_map< double, ClonePose >> &clonesCAM)
Uses a linear triangulation to get initial estimate for the feature, treating the anchor observation ...
Definition: FeatureInitializer.cpp:114
ov_core::FeatureInitializer::ClonePose::ClonePose
ClonePose()
Default constructor.
Definition: FeatureInitializer.h:72
ov_core::FeatureInitializer::config
const FeatureInitializerOptions config()
Gets the current configuration of the feature initializer.
Definition: FeatureInitializer.h:128
ov_core::FeatureInitializer::ClonePose::Rot
const Eigen::Matrix< double, 3, 3 > & Rot()
Accessor for rotation.
Definition: FeatureInitializer.h:78
ov_core::FeatureInitializer::ClonePose::_pos
Eigen::Matrix< double, 3, 1 > _pos
Position.
Definition: FeatureInitializer.h:57
ov_core::FeatureInitializer::ClonePose
Structure which stores pose estimates for use in triangulation.
Definition: FeatureInitializer.h:51
ov_core::FeatureInitializer::single_triangulation
bool single_triangulation(std::shared_ptr< Feature > feat, std::unordered_map< size_t, std::unordered_map< double, ClonePose >> &clonesCAM)
Uses a linear triangulation to get initial estimate for the feature.
Definition: FeatureInitializer.cpp:30
ov_core::FeatureInitializerOptions
Struct which stores all our feature initializer options.
Definition: FeatureInitializerOptions.h:33
ov_core::FeatureInitializer::ClonePose::ClonePose
ClonePose(const Eigen::Matrix< double, 3, 3 > &R, const Eigen::Matrix< double, 3, 1 > &p)
Constructs pose from rotation and position.
Definition: FeatureInitializer.h:60
ov_core::quat_2_Rot
Eigen::Matrix< double, 3, 3 > quat_2_Rot(const Eigen::Matrix< double, 4, 1 > &q)
Converts JPL quaterion to SO(3) rotation matrix.
Definition: quat_ops.h:152
ov_core::FeatureInitializer::ClonePose::ClonePose
ClonePose(const Eigen::Matrix< double, 4, 1 > &q, const Eigen::Matrix< double, 3, 1 > &p)
Constructs pose from quaternion and position.
Definition: FeatureInitializer.h:66
ov_core::FeatureInitializer::FeatureInitializer
FeatureInitializer(FeatureInitializerOptions &options)
Default constructor.
Definition: FeatureInitializer.h:88
ov_core::FeatureInitializer::ClonePose::pos
const Eigen::Matrix< double, 3, 1 > & pos()
Accessor for position.
Definition: FeatureInitializer.h:81
ov_core::FeatureInitializer::_options
FeatureInitializerOptions _options
Contains options for the initializer process.
Definition: FeatureInitializer.h:132
ov_core::FeatureInitializer::single_gaussnewton
bool single_gaussnewton(std::shared_ptr< Feature > feat, std::unordered_map< size_t, std::unordered_map< double, ClonePose >> &clonesCAM)
Uses a nonlinear triangulation to refine initial linear estimate of the feature.
Definition: FeatureInitializer.cpp:197
ov_core
Core algorithms for OpenVINS.
Definition: CamBase.h:30
ov_core::FeatureInitializer::compute_error
double compute_error(std::unordered_map< size_t, std::unordered_map< double, ClonePose >> &clonesCAM, std::shared_ptr< Feature > feat, double alpha, double beta, double rho)
Helper function for the gauss newton method that computes error of the given estimate.
Definition: FeatureInitializer.cpp:377
ov_core::FeatureInitializer
Class that triangulates feature.
Definition: FeatureInitializer.h:42


ov_core
Author(s): Patrick Geneva , Kevin Eckenhoff , Guoquan Huang
autogenerated on Mon Dec 16 2024 03:06:46