g2o
base_unary_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_UNARY_EDGE_H
28 #define G2O_BASE_UNARY_EDGE_H
29 
30 #include <iostream>
31 #include <cassert>
32 #include <limits>
33 
34 #include "base_edge.h"
35 #include "robust_kernel.h"
36 #include "g2o/config.h"
37 
38 namespace g2o {
39 
40 
41  template <int D, typename E, typename VertexXi>
42  class BaseUnaryEdge : public BaseEdge<D,E>
43  {
44  public:
47  typedef VertexXi VertexXiType;
48  typedef typename Eigen::Matrix<double, D, VertexXiType::Dimension, D==1?Eigen::RowMajor:Eigen::ColMajor>::AlignedMapType JacobianXiOplusType;
51 
52  BaseUnaryEdge() : BaseEdge<D,E>(),
53  _jacobianOplusXi(0, D, VertexXiType::Dimension)
54  {
55  _vertices.resize(1);
56  }
57 
58  virtual void resize(size_t size);
59 
60  virtual bool allVerticesFixed() const;
61 
62  virtual void linearizeOplus(JacobianWorkspace& jacobianWorkspace);
63 
64  virtual OptimizableGraph::Vertex* createVertex(int i);
65 
70  virtual void linearizeOplus();
71 
73  const JacobianXiOplusType& jacobianOplusXi() const { return _jacobianOplusXi;}
74 
75  virtual void constructQuadraticForm();
76 
78 
79  virtual void mapHessianMemory(double*, int, int, bool) {assert(0 && "BaseUnaryEdge does not map memory of the Hessian");}
80 
83 
84  protected:
90 
91  JacobianXiOplusType _jacobianOplusXi;
92 
93  public:
94  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
95  };
96 
97 #include "base_unary_edge.hpp"
98 
99 } // end namespace g2o
100 
101 #endif
Eigen::Matrix< double, D, VertexXiType::Dimension, D==1?Eigen::RowMajor:Eigen::ColMajor >::AlignedMapType JacobianXiOplusType
virtual bool allVerticesFixed() const
BaseEdge< D, E >::ErrorVector ErrorVector
const JacobianXiOplusType & jacobianOplusXi() const
returns the result of the linearization in the manifold space for the node xi
static const int Dimension
std::set< Vertex * > VertexSet
Definition: hyper_graph.h:136
virtual void constructQuadraticForm()
Eigen::Matrix< double, D, D, Eigen::ColMajor > InformationType
Definition: base_edge.h:47
virtual void initialEstimate(const OptimizableGraph::VertexSet &from, OptimizableGraph::Vertex *to)
JacobianXiOplusType _jacobianOplusXi
Eigen::Matrix< double, D, 1, Eigen::ColMajor > ErrorVector
Definition: base_edge.h:46
BaseEdge< D, E >::InformationType InformationType
virtual void resize(size_t size)
virtual void linearizeOplus()
BaseEdge< D, E >::Measurement Measurement
A general case Vertex for optimization.
virtual void mapHessianMemory(double *, int, int, bool)
provide memory workspace for computing the Jacobians
virtual OptimizableGraph::Vertex * createVertex(int i)
VertexContainer _vertices
Definition: hyper_graph.h:202