g2o
Loading...
Searching...
No Matches
base_variable_sized_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_VARIABLE_SIZED_EDGE_H
28#define G2O_BASE_VARIABLE_SIZED_EDGE_H
29
30#include <iomanip>
31#include <iostream>
32#include <limits>
33
34#include "base_edge.h"
36#include "g2o/config.h"
37#include "g2o/stuff/misc.h"
38#include "robust_kernel.h"
39
40namespace g2o {
41
49template <int D, typename E>
50class BaseVariableSizedEdge : public BaseEdge<D, E> {
51 public:
56 Eigen::Map<MatrixX> matrix;
58 HessianHelper() : matrix(0, 0, 0), transposed(false) {}
59 };
60
61 public:
62 static constexpr int Dimension = BaseEdge<D, E>::Dimension;
64 typedef MatrixX::MapType JacobianType;
67 typedef Eigen::Map<MatrixX, MatrixX::Flags & Eigen::PacketAccessBit
68 ? Eigen::Aligned
69 : Eigen::Unaligned>
71
73
74 virtual void linearizeOplus(JacobianWorkspace& jacobianWorkspace);
75
80 virtual void linearizeOplus();
81
82 virtual void resize(size_t size);
83
84 virtual bool allVerticesFixed() const;
85
86 virtual void constructQuadraticForm();
87
88 virtual void mapHessianMemory(double* d, int i, int j, bool rowMajor);
89
90 using BaseEdge<D, E>::computeError;
91
92 protected:
93 using BaseEdge<D, E>::_measurement;
94 using BaseEdge<D, E>::_information;
95 using BaseEdge<D, E>::_error;
96 using BaseEdge<D, E>::_vertices;
97 using BaseEdge<D, E>::_dimension;
98
99 std::vector<HessianHelper> _hessian;
100 std::vector<JacobianType>
102
103 void computeQuadraticForm(const InformationType& omega,
104 const ErrorVector& weightedError);
105
106 public:
107 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
108};
109
111
112} // end namespace g2o
113
114#endif
InformationType _information
Definition base_edge.h:147
internal::BaseEdgeTraits< D >::ErrorVector ErrorVector
Definition base_edge.h:90
internal::BaseEdgeTraits< D >::InformationType InformationType
Definition base_edge.h:91
Measurement _measurement
the measurement of the edge
Definition base_edge.h:146
ErrorVector _error
Definition base_edge.h:149
base class to represent an edge connecting an arbitrary number of nodes
Eigen::Map< MatrixX, MatrixX::Flags &Eigen::PacketAccessBit ? Eigen::Aligned :Eigen::Unaligned > HessianBlockType
virtual void mapHessianMemory(double *d, int i, int j, bool rowMajor)
BaseEdge< D, E >::ErrorVector ErrorVector
BaseEdge< D, E >::Measurement Measurement
std::vector< JacobianType > _jacobianOplus
jacobians of the edge (w.r.t. oplus)
std::vector< HessianHelper > _hessian
BaseEdge< D, E >::InformationType InformationType
void computeQuadraticForm(const InformationType &omega, const ErrorVector &weightedError)
VertexContainer _vertices
provide memory workspace for computing the Jacobians
virtual void computeError()=0
some general case utility functions
MatrixN< Eigen::Dynamic > MatrixX
Definition eigen_types.h:74
helper for mapping the Hessian memory of the upper triangular block
bool transposed
the block has to be transposed
Eigen::Map< MatrixX > matrix
the mapped memory