Landmark.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_TYPE_TYPE_LANDMARK_H
23 #define OV_TYPE_TYPE_LANDMARK_H
24 
25 #include "LandmarkRepresentation.h"
26 #include "Vec.h"
27 #include "utils/colors.h"
28 #include "utils/print.h"
29 
30 namespace ov_type {
31 
39 class Landmark : public Vec {
40 
41 public:
43  Landmark(int dim) : Vec(dim) {}
44 
46  size_t _featid;
47 
50 
52  int _anchor_cam_id = -1;
53 
56 
58  bool has_had_anchor_change = false;
59 
61  bool should_marg = false;
62 
65 
67  Eigen::Vector3d uv_norm_zero;
68 
70  Eigen::Vector3d uv_norm_zero_fej;
71 
74 
80  void update(const Eigen::VectorXd &dx) override {
81  // Update estimate
82  assert(dx.rows() == _size);
83  set_value(_value + dx);
84  // Ensure we are not near zero in the z-direction
85  // if (LandmarkRepresentation::is_relative_representation(_feat_representation) && _value(_value.rows() - 1) < 1e-8) {
86  // PRINT_DEBUG(YELLOW "WARNING DEPTH %.8f BECAME CLOSE TO ZERO IN UPDATE!!!\n" RESET, _value(_value.rows() - 1));
87  // should_marg = true;
88  // }
89  }
90 
96  Eigen::Matrix<double, 3, 1> get_xyz(bool getfej) const;
97 
103  void set_from_xyz(Eigen::Matrix<double, 3, 1> p_FinG, bool isfej);
104 };
105 } // namespace ov_type
106 
107 #endif // OV_TYPE_TYPE_LANDMARK_H
ov_type::Landmark::_featid
size_t _featid
Feature ID of this landmark (corresponds to frontend id)
Definition: Landmark.h:46
ov_type::Type::_size
int _size
Dimension of error state.
Definition: Type.h:132
ov_type::Type::set_value
virtual void set_value(const Eigen::MatrixXd &new_value)
Overwrite value of state's estimate.
Definition: Type.h:90
ov_type::Landmark::_anchor_cam_id
int _anchor_cam_id
What camera ID our pose is anchored in!! By default the first measurement is the anchor.
Definition: Landmark.h:52
ov_type::Landmark::uv_norm_zero
Eigen::Vector3d uv_norm_zero
First normalized uv coordinate bearing of this measurement (used for single depth representation)
Definition: Landmark.h:67
ov_type::Landmark
Type that implements a persistent SLAM feature.
Definition: Landmark.h:39
ov_type::Landmark::set_from_xyz
void set_from_xyz(Eigen::Matrix< double, 3, 1 > p_FinG, bool isfej)
Will set the current value based on the representation.
Definition: Landmark.cpp:65
ov_type::Landmark::Landmark
Landmark(int dim)
Default constructor (feature is a Vec of size 3 or Vec of size 1)
Definition: Landmark.h:43
ov_type::LandmarkRepresentation::Representation
Representation
What feature representation our state can use.
Definition: LandmarkRepresentation.h:38
ov_type::Landmark::_feat_representation
LandmarkRepresentation::Representation _feat_representation
What feature representation this feature currently has.
Definition: Landmark.h:73
ov_type::Landmark::_unique_camera_id
int _unique_camera_id
What unique camera stream this slam feature was observed from.
Definition: Landmark.h:49
Vec.h
ov_type::Landmark::should_marg
bool should_marg
Boolean if this landmark should be marginalized out.
Definition: Landmark.h:61
ov_type::Landmark::update
void update(const Eigen::VectorXd &dx) override
Overrides the default vector update rule We want to selectively update the FEJ value if we are using ...
Definition: Landmark.h:80
print.h
colors.h
ov_type
Dynamic type system types.
ov_type::Landmark::update_fail_count
int update_fail_count
Number of times the update has failed for this feature (we should remove if it fails a couple times!...
Definition: Landmark.h:64
ov_type::Landmark::_anchor_clone_timestamp
double _anchor_clone_timestamp
Timestamp of anchor clone.
Definition: Landmark.h:55
ov_type::Type::_value
Eigen::MatrixXd _value
Current best estimate.
Definition: Type.h:126
ov_type::Vec
Derived Type class that implements vector variables.
Definition: Vec.h:32
ov_type::Landmark::uv_norm_zero_fej
Eigen::Vector3d uv_norm_zero_fej
First estimate normalized uv coordinate bearing of this measurement (used for single depth representa...
Definition: Landmark.h:70
LandmarkRepresentation.h
ov_type::Landmark::has_had_anchor_change
bool has_had_anchor_change
Boolean if this landmark has had at least one anchor change.
Definition: Landmark.h:58
ov_type::Landmark::get_xyz
Eigen::Matrix< double, 3, 1 > get_xyz(bool getfej) const
Will return the position of the feature in the global frame of reference.
Definition: Landmark.cpp:26


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