StateHelper.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 OV_MSCKF_STATE_HELPER_H
23 #define OV_MSCKF_STATE_HELPER_H
24 
25 #include <Eigen/Eigen>
26 #include <memory>
27 
28 namespace ov_type {
29 class Type;
30 } // namespace ov_type
31 
32 namespace ov_msckf {
33 
34 class State;
35 
45 class StateHelper {
46 
47 public:
76  static void EKFPropagation(std::shared_ptr<State> state, const std::vector<std::shared_ptr<ov_type::Type>> &order_NEW,
77  const std::vector<std::shared_ptr<ov_type::Type>> &order_OLD, const Eigen::MatrixXd &Phi,
78  const Eigen::MatrixXd &Q);
79 
88  static void EKFUpdate(std::shared_ptr<State> state, const std::vector<std::shared_ptr<ov_type::Type>> &H_order, const Eigen::MatrixXd &H,
89  const Eigen::VectorXd &res, const Eigen::MatrixXd &R);
90 
98  static void set_initial_covariance(std::shared_ptr<State> state, const Eigen::MatrixXd &covariance,
99  const std::vector<std::shared_ptr<ov_type::Type>> &order);
100 
112  static Eigen::MatrixXd get_marginal_covariance(std::shared_ptr<State> state,
113  const std::vector<std::shared_ptr<ov_type::Type>> &small_variables);
114 
125  static Eigen::MatrixXd get_full_covariance(std::shared_ptr<State> state);
126 
139  static void marginalize(std::shared_ptr<State> state, std::shared_ptr<ov_type::Type> marg);
140 
146  static std::shared_ptr<ov_type::Type> clone(std::shared_ptr<State> state, std::shared_ptr<ov_type::Type> variable_to_clone);
147 
165  static bool initialize(std::shared_ptr<State> state, std::shared_ptr<ov_type::Type> new_variable,
166  const std::vector<std::shared_ptr<ov_type::Type>> &H_order, Eigen::MatrixXd &H_R, Eigen::MatrixXd &H_L,
167  Eigen::MatrixXd &R, Eigen::VectorXd &res, double chi_2_mult);
168 
183  static void initialize_invertible(std::shared_ptr<State> state, std::shared_ptr<ov_type::Type> new_variable,
184  const std::vector<std::shared_ptr<ov_type::Type>> &H_order, const Eigen::MatrixXd &H_R,
185  const Eigen::MatrixXd &H_L, const Eigen::MatrixXd &R, const Eigen::VectorXd &res);
186 
213  static void augment_clone(std::shared_ptr<State> state, Eigen::Matrix<double, 3, 1> last_w);
214 
224  static void marginalize_old_clone(std::shared_ptr<State> state);
225 
230  static void marginalize_slam(std::shared_ptr<State> state);
231 
232 private:
238 };
239 
240 } // namespace ov_msckf
241 
242 #endif // OV_MSCKF_STATE_HELPER_H
ov_msckf::StateHelper::augment_clone
static void augment_clone(std::shared_ptr< State > state, Eigen::Matrix< double, 3, 1 > last_w)
Augment the state with a stochastic copy of the current IMU pose.
Definition: StateHelper.cpp:579
ov_msckf::StateHelper::initialize_invertible
static void initialize_invertible(std::shared_ptr< State > state, std::shared_ptr< ov_type::Type > new_variable, const std::vector< std::shared_ptr< ov_type::Type >> &H_order, const Eigen::MatrixXd &H_R, const Eigen::MatrixXd &H_L, const Eigen::MatrixXd &R, const Eigen::VectorXd &res)
Initializes new variable into covariance (H_L must be invertible)
Definition: StateHelper.cpp:484
ov_msckf
Extended Kalman Filter estimator.
Definition: VioManager.h:46
ov_msckf::StateHelper::initialize
static bool initialize(std::shared_ptr< State > state, std::shared_ptr< ov_type::Type > new_variable, const std::vector< std::shared_ptr< ov_type::Type >> &H_order, Eigen::MatrixXd &H_R, Eigen::MatrixXd &H_L, Eigen::MatrixXd &R, Eigen::VectorXd &res, double chi_2_mult)
Initializes new variable into covariance.
Definition: StateHelper.cpp:393
ov_msckf::StateHelper::marginalize_slam
static void marginalize_slam(std::shared_ptr< State > state)
Marginalize bad SLAM features.
Definition: StateHelper.cpp:631
ov_msckf::StateHelper::StateHelper
StateHelper()
Definition: StateHelper.h:237
ov_msckf::StateHelper::EKFUpdate
static void EKFUpdate(std::shared_ptr< State > state, const std::vector< std::shared_ptr< ov_type::Type >> &H_order, const Eigen::MatrixXd &H, const Eigen::VectorXd &res, const Eigen::MatrixXd &R)
Performs EKF update of the state (see Linear Measurement Update page)
Definition: StateHelper.cpp:116
ov_msckf::StateHelper::clone
static std::shared_ptr< ov_type::Type > clone(std::shared_ptr< State > state, std::shared_ptr< ov_type::Type > variable_to_clone)
Clones "variable to clone" and places it at end of covariance.
Definition: StateHelper.cpp:341
ov_msckf::StateHelper::get_marginal_covariance
static Eigen::MatrixXd get_marginal_covariance(std::shared_ptr< State > state, const std::vector< std::shared_ptr< ov_type::Type >> &small_variables)
For a given set of variables, this will this will calculate a smaller covariance.
Definition: StateHelper.cpp:226
ov_msckf::StateHelper::set_initial_covariance
static void set_initial_covariance(std::shared_ptr< State > state, const Eigen::MatrixXd &covariance, const std::vector< std::shared_ptr< ov_type::Type >> &order)
This will set the initial covaraince of the specified state elements. Will also ensure that proper cr...
Definition: StateHelper.cpp:199
ov_msckf::StateHelper::marginalize_old_clone
static void marginalize_old_clone(std::shared_ptr< State > state)
Remove the oldest clone, if we have more then the max clone count!!
Definition: StateHelper.cpp:618
ov_msckf::StateHelper::EKFPropagation
static void EKFPropagation(std::shared_ptr< State > state, const std::vector< std::shared_ptr< ov_type::Type >> &order_NEW, const std::vector< std::shared_ptr< ov_type::Type >> &order_OLD, const Eigen::MatrixXd &Phi, const Eigen::MatrixXd &Q)
Performs EKF propagation of the state covariance.
Definition: StateHelper.cpp:36
ov_msckf::StateHelper
Helper which manipulates the State and its covariance.
Definition: StateHelper.h:45
ov_type
ov_msckf::StateHelper::get_full_covariance
static Eigen::MatrixXd get_full_covariance(std::shared_ptr< State > state)
This gets the full covariance matrix.
Definition: StateHelper.cpp:256
ov_msckf::StateHelper::marginalize
static void marginalize(std::shared_ptr< State > state, std::shared_ptr< ov_type::Type > marg)
Marginalizes a variable, properly modifying the ordering/covariances in the state.
Definition: StateHelper.cpp:271


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