base_binary_edge.h
Go to the documentation of this file.
1 // g2o - General Graph Optimization
2 // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, H. Strasdat, W. Burgard
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright notice,
10 // this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 //
15 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
16 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18 // PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 // HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21 // TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 #ifndef G2O_BASE_BINARY_EDGE_H
28 #define G2O_BASE_BINARY_EDGE_H
29 
30 #include <iostream>
31 #include <limits>
32 
33 #include "base_edge.h"
34 #include "robust_kernel.h"
35 #include "../../config.h"
36 
37 namespace g2o {
38 
39  using namespace Eigen;
40 
41  template <int D, typename E, typename VertexXi, typename VertexXj>
42  class BaseBinaryEdge : public BaseEdge<D, E>
43  {
44  public:
45 
46  typedef VertexXi VertexXiType;
47  typedef VertexXj VertexXjType;
48 
49  static const int Di = VertexXiType::Dimension;
50  static const int Dj = VertexXjType::Dimension;
51 
52  static const int Dimension = BaseEdge<D, E>::Dimension;
54  typedef typename Matrix<double, D, Di>::AlignedMapType JacobianXiOplusType;
55  typedef typename Matrix<double, D, Dj>::AlignedMapType JacobianXjOplusType;
58 
59  typedef Eigen::Map<Matrix<double, Di, Dj>, Matrix<double, Di, Dj>::Flags & AlignedBit ? Aligned : Unaligned > HessianBlockType;
60  typedef Eigen::Map<Matrix<double, Dj, Di>, Matrix<double, Dj, Di>::Flags & AlignedBit ? Aligned : Unaligned > HessianBlockTransposedType;
61 
63  _hessianRowMajor(false),
64  _hessian(0, VertexXiType::Dimension, VertexXjType::Dimension), // HACK we map to the null pointer for initializing the Maps
65  _hessianTransposed(0, VertexXjType::Dimension, VertexXiType::Dimension),
66  _jacobianOplusXi(0, D, Di), _jacobianOplusXj(0, D, Dj)
67  {
68  _vertices.resize(2);
69  }
70 
71  virtual OptimizableGraph::Vertex* createFrom();
72  virtual OptimizableGraph::Vertex* createTo();
73 
74  virtual void resize(size_t size);
75 
76  virtual bool allVerticesFixed() const;
77 
78  virtual void linearizeOplus(JacobianWorkspace& jacobianWorkspace);
79 
84  virtual void linearizeOplus();
85 
87  const JacobianXiOplusType& jacobianOplusXi() const { return _jacobianOplusXi;}
89  const JacobianXjOplusType& jacobianOplusXj() const { return _jacobianOplusXj;}
90 
91  virtual void constructQuadraticForm() ;
92 
93  virtual void mapHessianMemory(double* d, int i, int j, bool rowMajor);
94 
97 
98  protected:
101  using BaseEdge<D,E>::_error;
104 
106  HessianBlockType _hessian;
107  HessianBlockTransposedType _hessianTransposed;
108  JacobianXiOplusType _jacobianOplusXi;
109  JacobianXjOplusType _jacobianOplusXj;
110 
111  public:
112  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
113  };
114 
115 #include "base_binary_edge.hpp"
116 
117 } // end namespace g2o
118 
119 #endif
d
const JacobianXjOplusType & jacobianOplusXj() const
returns the result of the linearization in the manifold space for the node xj
BaseEdge< D, E >::ErrorVector ErrorVector
BaseEdge< D, E >::Measurement Measurement
JacobianXiOplusType _jacobianOplusXi
Eigen::Map< Matrix< double, Dj, Di >, Matrix< double, Dj, Di >::Flags &AlignedBit?Aligned:Unaligned > HessianBlockTransposedType
Matrix< double, D, Dj >::AlignedMapType JacobianXjOplusType
Matrix< double, D, 1 > ErrorVector
Definition: base_edge.h:48
A general case Vertex for optimization.
virtual void resize(size_t size)
Definition: hyper_graph.cpp:50
BaseEdge< D, E >::InformationType InformationType
Eigen::Map< Matrix< double, Di, Dj >, Matrix< double, Di, Dj >::Flags &AlignedBit?Aligned:Unaligned > HessianBlockType
HessianBlockTransposedType _hessianTransposed
JacobianXjOplusType _jacobianOplusXj
HessianBlockType _hessian
provide memory workspace for computing the Jacobians
Matrix< double, D, Di >::AlignedMapType JacobianXiOplusType
Matrix< double, D, D > InformationType
Definition: base_edge.h:49
const JacobianXiOplusType & jacobianOplusXi() const
returns the result of the linearization in the manifold space for the node xi


orb_slam2_with_maps_odom
Author(s): teng zhang
autogenerated on Fri Sep 25 2020 03:24:47