g2o
Loading...
Searching...
No Matches
g2o::BaseVariableSizedEdge< D, E > Class Template Reference

base class to represent an edge connecting an arbitrary number of nodes More...

#include <base_variable_sized_edge.h>

Inheritance diagram for g2o::BaseVariableSizedEdge< D, E >:
Collaboration diagram for g2o::BaseVariableSizedEdge< D, E >:

Classes

struct  HessianHelper
 helper for mapping the Hessian memory of the upper triangular block More...

Public Types

typedef BaseEdge< D, E >::Measurement Measurement
typedef MatrixX::MapType JacobianType
typedef BaseEdge< D, E >::ErrorVector ErrorVector
typedef BaseEdge< D, E >::InformationType InformationType
typedef Eigen::Map< MatrixX, MatrixX::Flags &Eigen::PacketAccessBit ? Eigen::Aligned :Eigen::Unaligned > HessianBlockType
Public Types inherited from g2o::BaseEdge< D, E >
typedef E Measurement
typedef internal::BaseEdgeTraits< D >::ErrorVector ErrorVector
typedef internal::BaseEdgeTraits< D >::InformationType InformationType

Public Member Functions

 BaseVariableSizedEdge ()
virtual void linearizeOplus (JacobianWorkspace &jacobianWorkspace)
virtual void linearizeOplus ()
virtual void resize (size_t size)
virtual bool allVerticesFixed () const
virtual void constructQuadraticForm ()
virtual void mapHessianMemory (double *d, int i, int j, bool rowMajor)
Public Member Functions inherited from g2o::BaseEdge< D, E >
 BaseEdge ()
BaseEdge & operator= (const BaseEdge &)=delete
 BaseEdge (const BaseEdge &)=delete
virtual ~BaseEdge ()
virtual double chi2 () const
virtual const double * errorData () const
 returns the error vector cached after calling the computeError;
virtual double * errorData ()
const ErrorVector & error () const
ErrorVector & error ()
EIGEN_STRONG_INLINE const InformationType & information () const
 information matrix of the constraint
EIGEN_STRONG_INLINE InformationType & information ()
void setInformation (const InformationType &information)
virtual const double * informationData () const
virtual double * informationData ()
EIGEN_STRONG_INLINE const Measurement & measurement () const
 accessor functions for the measurement represented by the edge
virtual void setMeasurement (const Measurement &m)
virtual int rank () const
virtual void initialEstimate (const OptimizableGraph::VertexSet &, OptimizableGraph::Vertex *)
template<int Dim = D>
std::enable_if< Dim==-1, void >::type setDimension (int dim)
Public Member Functions inherited from g2o::OptimizableGraph::Edge
 Edge ()
virtual ~Edge ()
virtual void computeError ()=0
virtual bool setMeasurementData (const double *m)
virtual bool getMeasurementData (double *m) const
virtual int measurementDimension () const
virtual bool setMeasurementFromState ()
RobustKernel * robustKernel () const
 if NOT NULL, error of this edge will be robustifed with the kernel
void setRobustKernel (RobustKernel *ptr)
virtual double initialEstimatePossible (const OptimizableGraph::VertexSet &from, OptimizableGraph::Vertex *to)
int level () const
 returns the level of the edge
void setLevel (int l)
 sets the level of the edge
int dimension () const
 returns the dimensions of the error function
 G2O_ATTRIBUTE_DEPRECATED (virtual Vertex *createFrom())
 G2O_ATTRIBUTE_DEPRECATED (virtual Vertex *createTo())
virtual Vertex * createVertex (int)
virtual bool read (std::istream &is)=0
 read the vertex from a stream, i.e., the internal state of the vertex
virtual bool write (std::ostream &os) const =0
 write the vertex to a stream
long long internalId () const
 the internal ID of the edge
OptimizableGraph * graph ()
const OptimizableGraph * graph () const
bool setParameterId (int argNum, int paramId)
const Parameter * parameter (int argNo) const
size_t numParameters () const
void resizeParameters (size_t newSize)
Public Member Functions inherited from g2o::HyperGraph::Edge
 Edge (int id=InvalidId)
 creates and empty edge with no vertices
const VertexContainer & vertices () const
VertexContainer & vertices ()
const Vertex * vertex (size_t i) const
Vertex * vertex (size_t i)
void setVertex (size_t i, Vertex *v)
int id () const
void setId (int id)
virtual HyperGraphElementType elementType () const
int numUndefinedVertices () const
Public Member Functions inherited from g2o::HyperGraph::HyperGraphElement
virtual ~HyperGraphElement ()
Public Member Functions inherited from g2o::HyperGraph::DataContainer
 DataContainer ()
virtual ~DataContainer ()
const Data * userData () const
 the user data associated with this vertex
Data * userData ()
void setUserData (Data *obs)
void addUserData (Data *obs)

Static Public Attributes

static constexpr int Dimension = BaseEdge<D, E>::Dimension
Static Public Attributes inherited from g2o::BaseEdge< D, E >
static constexpr int Dimension = internal::BaseEdgeTraits<D>::Dimension

Protected Member Functions

void computeQuadraticForm (const InformationType &omega, const ErrorVector &weightedError)
Protected Member Functions inherited from g2o::BaseEdge< D, E >
InformationType robustInformation (const Vector3 &rho) const
bool writeInformationMatrix (std::ostream &os) const
 write the upper trinagular part of the information matrix into the stream
bool readInformationMatrix (std::istream &is)
bool writeParamIds (std::ostream &os) const
 write the param IDs that are potentially used by the edge
bool readParamIds (std::istream &is)
 reads the param IDs from the stream
Protected Member Functions inherited from g2o::OptimizableGraph::Edge
template<typename ParameterType>
bool installParameter (ParameterType *&p, size_t argNo, int paramId=-1)
template<typename CacheType>
void resolveCache (CacheType *&cache, OptimizableGraph::Vertex *, const std::string &_type, const ParameterVector &parameters)
bool resolveParameters ()
virtual bool resolveCaches ()

Protected Attributes

std::vector< HessianHelper > _hessian
std::vector< JacobianType > _jacobianOplus
 jacobians of the edge (w.r.t. oplus)
Protected Attributes inherited from g2o::BaseEdge< D, E >
Measurement _measurement
 the measurement of the edge
InformationType _information
ErrorVector _error
Protected Attributes inherited from g2o::OptimizableGraph::Edge
int _dimension
int _level
RobustKernel * _robustKernel
long long _internalId
std::vector< int > _cacheIds
std::vector< std::string > _parameterTypes
std::vector< Parameter ** > _parameters
std::vector< int > _parameterIds
Protected Attributes inherited from g2o::HyperGraph::Edge
VertexContainer _vertices
int _id
 unique id
Protected Attributes inherited from g2o::HyperGraph::DataContainer
Data * _userData

Detailed Description

template<int D, typename E>
class g2o::BaseVariableSizedEdge< D, E >

base class to represent an edge connecting an arbitrary number of nodes

D - Dimension of the measurement E - type to represent the measurement

Definition at line 50 of file base_variable_sized_edge.h.

Member Typedef Documentation

◆ ErrorVector

template<int D, typename E>
typedef BaseEdge<D,E>::ErrorVector g2o::BaseVariableSizedEdge< D, E >::ErrorVector

Definition at line 65 of file base_variable_sized_edge.h.

◆ HessianBlockType

template<int D, typename E>
typedef Eigen::Map<MatrixX, MatrixX::Flags & Eigen::PacketAccessBit ? Eigen::Aligned : Eigen::Unaligned> g2o::BaseVariableSizedEdge< D, E >::HessianBlockType

Definition at line 70 of file base_variable_sized_edge.h.

◆ InformationType

template<int D, typename E>
typedef BaseEdge<D,E>::InformationType g2o::BaseVariableSizedEdge< D, E >::InformationType

Definition at line 66 of file base_variable_sized_edge.h.

◆ JacobianType

template<int D, typename E>
typedef MatrixX::MapType g2o::BaseVariableSizedEdge< D, E >::JacobianType

Definition at line 64 of file base_variable_sized_edge.h.

◆ Measurement

template<int D, typename E>
typedef BaseEdge<D,E>::Measurement g2o::BaseVariableSizedEdge< D, E >::Measurement

Definition at line 63 of file base_variable_sized_edge.h.

Constructor & Destructor Documentation

◆ BaseVariableSizedEdge()

template<int D, typename E>
g2o::BaseVariableSizedEdge< D, E >::BaseVariableSizedEdge ( )
inline

Definition at line 72 of file base_variable_sized_edge.h.

References g2o::BaseEdge< D, E >::BaseEdge().

Member Function Documentation

◆ allVerticesFixed()

template<int D, typename E>
bool BaseVariableSizedEdge::allVerticesFixed ( ) const
virtual

Implements g2o::OptimizableGraph::Edge.

Definition at line 148 of file base_variable_sized_edge.h.

187 {
188
196template <int D, typename E>
197class BaseVariableSizedEdge : public BaseEdge<D, E> {
198 public:
202 struct HessianHelper {
204 bool transposed;
205 HessianHelper() : matrix(0, 0, 0), transposed(false) {}
206 };
207
208 public:
209 static constexpr int Dimension = BaseEdge<D, E>::Dimension;
218
220
222
227 virtual void linearizeOplus();
228
229 virtual void resize(size_t size);
230
231 virtual bool allVerticesFixed() const;
232
233 virtual void constructQuadraticForm();
234
235 virtual void mapHessianMemory(double* d, int i, int j, bool rowMajor);
236
237 using BaseEdge<D, E>::computeError;
238
239 protected:
240 using BaseEdge<D, E>::_measurement;
241 using BaseEdge<D, E>::_information;
242 using BaseEdge<D, E>::_error;
243 using BaseEdge<D, E>::_vertices;
244 using BaseEdge<D, E>::_dimension;
245
249
252
253 public:
255};
256
258
259} // end namespace g2o
260
261#endif
base class to represent an edge connecting an arbitrary number of nodes
virtual void mapHessianMemory(double *d, int i, int j, bool rowMajor)
virtual void resize(size_t size)
void computeQuadraticForm(const InformationType &omega, const ErrorVector &weightedError)

◆ computeQuadraticForm()

template<int D, typename E>
void BaseVariableSizedEdge::computeQuadraticForm ( const InformationType & omega,
const ErrorVector & weightedError )
protected

Definition at line 158 of file base_variable_sized_edge.h.

197 {
198
206template <int D, typename E>
207class BaseVariableSizedEdge : public BaseEdge<D, E> {
208 public:
212 struct HessianHelper {
214 bool transposed;
215 HessianHelper() : matrix(0, 0, 0), transposed(false) {}
216 };
217
218 public:
219 static constexpr int Dimension = BaseEdge<D, E>::Dimension;
228
230
232
237 virtual void linearizeOplus();
238
239 virtual void resize(size_t size);
240
241 virtual bool allVerticesFixed() const;
242
243 virtual void constructQuadraticForm();
244
245 virtual void mapHessianMemory(double* d, int i, int j, bool rowMajor);
246
247 using BaseEdge<D, E>::computeError;
248
249 protected:
250 using BaseEdge<D, E>::_measurement;
251 using BaseEdge<D, E>::_information;
252 using BaseEdge<D, E>::_error;
253 using BaseEdge<D, E>::_vertices;
254 using BaseEdge<D, E>::_dimension;
255
259
262
263 public:
265};
266
268
269} // end namespace g2o
270
271#endif

◆ constructQuadraticForm()

template<int D, typename E>
void BaseVariableSizedEdge::constructQuadraticForm ( )
virtual

Linearizes the constraint in the edge. Makes side effect on the vertices of the graph by changing the parameter vector b and the hessian blocks ii and jj. The off diagoinal block is accessed via _hessian.

Implements g2o::OptimizableGraph::Edge.

Definition at line 38 of file base_variable_sized_edge.h.

40 {
41
49template <int D, typename E>
50class BaseVariableSizedEdge : public BaseEdge<D, E> {

◆ linearizeOplus() [1/2]

template<int D, typename E>
void BaseVariableSizedEdge::linearizeOplus ( )
virtual

Linearizes the oplus operator in the vertex, and stores the result in temporary variable vector _jacobianOplus

Definition at line 67 of file base_variable_sized_edge.h.

71
73
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
91
92 protected:
95 using BaseEdge<D, E>::_error;
96 using BaseEdge<D, E>::_vertices;
97 using BaseEdge<D, E>::_dimension;
98
102
105
106 public:
108};
109
111
112} // end namespace g2o
113
Eigen::Map< MatrixX, MatrixX::Flags &Eigen::PacketAccessBit ? Eigen::Aligned :Eigen::Unaligned > HessianBlockType
BaseEdge< D, E >::ErrorVector ErrorVector
std::vector< JacobianType > _jacobianOplus
jacobians of the edge (w.r.t. oplus)
std::vector< HessianHelper > _hessian
BaseEdge< D, E >::InformationType InformationType

◆ linearizeOplus() [2/2]

template<int D, typename E>
void BaseVariableSizedEdge::linearizeOplus ( JacobianWorkspace & jacobianWorkspace)
virtual

Linearizes the constraint in the edge in the manifold space, and store the result in the given workspace

Implements g2o::OptimizableGraph::Edge.

Definition at line 53 of file base_variable_sized_edge.h.

55 {
57 bool transposed;
58 HessianHelper() : matrix(0, 0, 0), transposed(false) {}
59 };
60
61 public:
62 static constexpr int Dimension = BaseEdge<D, E>::Dimension;
BaseEdge< D, E >::Measurement Measurement
helper for mapping the Hessian memory of the upper triangular block

◆ mapHessianMemory()

template<int D, typename E>
void BaseVariableSizedEdge::mapHessianMemory ( double * d,
int i,
int j,
bool rowMajor )
virtual

maps the internal matrix to some external memory location, you need to provide the memory before calling constructQuadraticForm

Parameters
dthe memory location to which we map
iindex of the vertex i
jindex of the vertex j (j > i, upper triangular fashion)
rowMajorif true, will write in rowMajor order to the block. Since EIGEN is columnMajor by default, this results in writing the transposed

Implements g2o::OptimizableGraph::Edge.

Definition at line 116 of file base_variable_sized_edge.h.

155 {
156
164template <int D, typename E>
165class BaseVariableSizedEdge : public BaseEdge<D, E> {
166 public:
170 struct HessianHelper {
172 bool transposed;
173 HessianHelper() : matrix(0, 0, 0), transposed(false) {}
174 };
175
176 public:
177 static constexpr int Dimension = BaseEdge<D, E>::Dimension;
186
188
190
195 virtual void linearizeOplus();
196
197 virtual void resize(size_t size);
198
199 virtual bool allVerticesFixed() const;
200
201 virtual void constructQuadraticForm();
202
203 virtual void mapHessianMemory(double* d, int i, int j, bool rowMajor);
204
205 using BaseEdge<D, E>::computeError;
206
207 protected:
208 using BaseEdge<D, E>::_measurement;
209 using BaseEdge<D, E>::_information;
210 using BaseEdge<D, E>::_error;
211 using BaseEdge<D, E>::_vertices;
212 using BaseEdge<D, E>::_dimension;
213
217
220
221 public:
223};
224
226
227} // end namespace g2o
228
229#endif

◆ resize()

template<int D, typename E>
void BaseVariableSizedEdge::resize ( size_t size)
virtual

resizes the number of vertices connected by this edge

Reimplemented from g2o::HyperGraph::Edge.

Definition at line 138 of file base_variable_sized_edge.h.

177 {
178
186template <int D, typename E>
187class BaseVariableSizedEdge : public BaseEdge<D, E> {
188 public:
192 struct HessianHelper {
194 bool transposed;
195 HessianHelper() : matrix(0, 0, 0), transposed(false) {}
196 };
197
198 public:
199 static constexpr int Dimension = BaseEdge<D, E>::Dimension;
208
210
212
217 virtual void linearizeOplus();
218
219 virtual void resize(size_t size);
220
221 virtual bool allVerticesFixed() const;
222
223 virtual void constructQuadraticForm();
224
225 virtual void mapHessianMemory(double* d, int i, int j, bool rowMajor);
226
227 using BaseEdge<D, E>::computeError;
228
229 protected:
230 using BaseEdge<D, E>::_measurement;
231 using BaseEdge<D, E>::_information;
232 using BaseEdge<D, E>::_error;
233 using BaseEdge<D, E>::_vertices;
234 using BaseEdge<D, E>::_dimension;
235
239
242
243 public:
245};
246
248
249} // end namespace g2o
250
251#endif

Member Data Documentation

◆ _hessian

template<int D, typename E>
std::vector<HessianHelper> g2o::BaseVariableSizedEdge< D, E >::_hessian
protected

Definition at line 99 of file base_variable_sized_edge.h.

◆ _jacobianOplus

template<int D, typename E>
std::vector<JacobianType> g2o::BaseVariableSizedEdge< D, E >::_jacobianOplus
protected

jacobians of the edge (w.r.t. oplus)

Definition at line 101 of file base_variable_sized_edge.h.

◆ Dimension

template<int D, typename E>
int g2o::BaseVariableSizedEdge< D, E >::Dimension = BaseEdge<D, E>::Dimension
staticconstexpr

Definition at line 62 of file base_variable_sized_edge.h.


The documentation for this class was generated from the following files: