gtsam  4.0.0
gtsam
SmartFactorParams.h
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
20 #pragma once
21 
23 
24 namespace gtsam {
25 
29 enum LinearizationMode {
31  HESSIAN, IMPLICIT_SCHUR, JACOBIAN_Q, JACOBIAN_SVD
32 };
33 
36  IGNORE_DEGENERACY, ZERO_ON_DEGENERACY, HANDLE_INFINITY
37 };
38 
39 /*
40  * Parameters for the smart (stereo) projection factors
41  */
43 
46 
49  TriangulationParameters triangulation;
51 
57 
59  // Constructor
60  SmartProjectionParams(LinearizationMode linMode = HESSIAN,
61  DegeneracyMode degMode = IGNORE_DEGENERACY, bool throwCheirality = false,
62  bool verboseCheirality = false, double retriangulationTh = 1e-5) :
66  }
67 
68  virtual ~SmartProjectionParams() {
69  }
70 
71  void print(const std::string& str = "") const {
72  std::cout << "linearizationMode: " << linearizationMode << "\n";
73  std::cout << " degeneracyMode: " << degeneracyMode << "\n";
74  std::cout << triangulation << std::endl;
75  }
76 
77  // get class variables
78  LinearizationMode getLinearizationMode() const {
79  return linearizationMode;
80  }
81  DegeneracyMode getDegeneracyMode() const {
82  return degeneracyMode;
83  }
84  TriangulationParameters getTriangulationParameters() const {
85  return triangulation;
86  }
87  bool getVerboseCheirality() const {
88  return verboseCheirality;
89  }
90  bool getThrowCheirality() const {
91  return throwCheirality;
92  }
93  double getRetriangulationThreshold() const {
95  }
96  // set class variables
97  void setLinearizationMode(LinearizationMode linMode) {
98  linearizationMode = linMode;
99  }
100  void setDegeneracyMode(DegeneracyMode degMode) {
101  degeneracyMode = degMode;
102  }
103  void setRetriangulationThreshold(double retriangulationTh) {
104  retriangulationThreshold = retriangulationTh;
105  }
106  void setRankTolerance(double rankTol) {
107  triangulation.rankTolerance = rankTol;
108  }
109  void setEnableEPI(bool enableEPI) {
110  triangulation.enableEPI = enableEPI;
111  }
112  void setLandmarkDistanceThreshold(double landmarkDistanceThreshold) {
113  triangulation.landmarkDistanceThreshold = landmarkDistanceThreshold;
114  }
115  void setDynamicOutlierRejectionThreshold(double dynOutRejectionThreshold) {
116  triangulation.dynamicOutlierRejectionThreshold = dynOutRejectionThreshold;
117  }
118 
119 private:
120 
123  template<class ARCHIVE>
124  void serialize(ARCHIVE & ar, const unsigned int version) {
125  ar & BOOST_SERIALIZATION_NVP(linearizationMode);
126  ar & BOOST_SERIALIZATION_NVP(degeneracyMode);
127  ar & BOOST_SERIALIZATION_NVP(triangulation);
128  ar & BOOST_SERIALIZATION_NVP(retriangulationThreshold);
129  ar & BOOST_SERIALIZATION_NVP(throwCheirality);
130  ar & BOOST_SERIALIZATION_NVP(verboseCheirality);
131  }
132 };
133 
134 } // \ namespace gtsam
Functions for triangulation.
DegeneracyMode
How to manage degeneracy.
Definition: SmartFactorParams.h:35
LinearizationMode linearizationMode
How to linearize the factor.
Definition: SmartFactorParams.h:44
DegeneracyMode degeneracyMode
How to linearize the factor.
Definition: SmartFactorParams.h:45
double dynamicOutlierRejectionThreshold
If this is nonnegative the we will check if the average reprojection error is smaller than this thres...
Definition: triangulation.h:343
bool verboseCheirality
If true, prints text for Cheirality exceptions (default: false)
Definition: SmartFactorParams.h:56
double landmarkDistanceThreshold
if the landmark is triangulated at distance larger than this, result is flagged as degenerate.
Definition: triangulation.h:336
double retriangulationThreshold
threshold to decide whether to re-triangulate
Definition: SmartFactorParams.h:50
Definition: triangulation.h:326
bool enableEPI
if set to true, will refine triangulation using LM
Definition: triangulation.h:330
LinearizationMode
SmartFactorParams: parameters and (linearization/degeneracy) modes for SmartProjection and SmartStere...
Definition: SmartFactorParams.h:30
Definition: SmartFactorParams.h:42
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
bool throwCheirality
If true, re-throws Cheirality exceptions (default: false)
Definition: SmartFactorParams.h:55
double rankTolerance
threshold to decide whether triangulation is result.degenerate
Definition: triangulation.h:328
friend class boost::serialization::access
Serialization function.
Definition: SmartFactorParams.h:122