g2o
Loading...
Searching...
No Matches
g2o::EdgeSE3 Class Reference

Edge between two 3D pose vertices. More...

#include <edge_se3.h>

Inheritance diagram for g2o::EdgeSE3:
Collaboration diagram for g2o::EdgeSE3:

Public Member Functions

 EdgeSE3 ()
virtual bool read (std::istream &is)
 read the vertex from a stream, i.e., the internal state of the vertex
virtual bool write (std::ostream &os) const
 write the vertex to a stream
void computeError ()
virtual void setMeasurement (const Isometry3 &m)
virtual bool setMeasurementData (const double *d)
virtual bool getMeasurementData (double *d) const
void linearizeOplus ()
virtual int measurementDimension () const
virtual bool setMeasurementFromState ()
virtual double initialEstimatePossible (const OptimizableGraph::VertexSet &, OptimizableGraph::Vertex *)
virtual void initialEstimate (const OptimizableGraph::VertexSet &from, OptimizableGraph::Vertex *to)
Public Member Functions inherited from g2o::BaseBinaryEdge< 6, Isometry3, VertexSE3, VertexSE3 >
 BaseBinaryEdge ()
Public Member Functions inherited from g2o::BaseFixedSizedEdge< D, Isometry3, VertexSE3, VertexSE3 >
bool allVerticesFixedNs (std::index_sequence< Ints... >) const
void constructQuadraticFormNs (const InformationType &omega, const ErrorVector &weightedError, std::index_sequence< Ints... >)
void constructOffDiagonalQuadraticFormMs (const AtOType &, std::index_sequence<>)
void constructOffDiagonalQuadraticFormMs (const AtOType &AtO, std::index_sequence< Ints... >)
void constructOffDiagonalQuadraticFormM (const AtOType &AtO)
void constructQuadraticFormN (const InformationType &omega, const ErrorVector &weightedError)
void linearizeOplus_allocate (JacobianWorkspace &jacobianWorkspace, std::index_sequence< Ints... >)
void linearizeOplusN ()
void linearizeOplusNs (std::index_sequence< Ints... >)
constexpr std::enable_if< VertexXnType< VertexN >::Dimension!=-1, int >::type vertexDimension () const
const VertexXnType< VertexN > * vertexXn () const
 BaseFixedSizedEdge ()
OptimizableGraph::Vertex * createVertex (int i, CtorArgs... args)
 create an instance of the Nth VertexType
virtual void resize (size_t size)
virtual bool allVerticesFixed () const
virtual void linearizeOplus (JacobianWorkspace &jacobianWorkspace)
const std::tuple_element< N, std::tuple< JacobianType< D, VertexTypes::Dimension >... > >::type & jacobianOplusXn () const
virtual void constructQuadraticForm ()
virtual void mapHessianMemory (double *d, int i, int j, bool rowMajor)
Public Member Functions inherited from g2o::BaseEdge< D, Isometry3 >
 BaseEdge ()
BaseEdge & operator= (const BaseEdge &)=delete
virtual ~BaseEdge ()
virtual double chi2 () const
virtual const double * errorData () const
 returns the error vector cached after calling the computeError;
const ErrorVector & error () const
EIGEN_STRONG_INLINE const InformationType & information () const
 information matrix of the constraint
void setInformation (const InformationType &information)
virtual const double * informationData () const
EIGEN_STRONG_INLINE const Measurement & measurement () const
 accessor functions for the measurement represented by the edge
virtual int rank () const
std::enable_if< Dim==-1, void >::type setDimension (int dim)
Public Member Functions inherited from g2o::OptimizableGraph::Edge
 Edge ()
virtual ~Edge ()
RobustKernel * robustKernel () const
 if NOT NULL, error of this edge will be robustifed with the kernel
void setRobustKernel (RobustKernel *ptr)
virtual double * errorData ()=0
virtual double * informationData ()=0
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)
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)

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Protected Attributes

Isometry3 _inverseMeasurement
Protected Attributes inherited from g2o::BaseBinaryEdge< 6, Isometry3, VertexSE3, VertexSE3 >
BaseFixedSizedEdge< D, Isometry3, VertexSE3, VertexSE3 >::template JacobianType< D, VertexSE3::Dimension > & _jacobianOplusXi
BaseFixedSizedEdge< D, Isometry3, VertexSE3, VertexSE3 >::template JacobianType< D, VertexSE3::Dimension > & _jacobianOplusXj
Protected Attributes inherited from g2o::BaseFixedSizedEdge< D, Isometry3, VertexSE3, VertexSE3 >
HessianRowMajorStorage _hessianRowMajor
HessianTuple _hessianTuple
HessianTupleTransposed _hessianTupleTransposed
std::tuple< JacobianType< D, VertexTypes::Dimension >... > _jacobianOplus
Protected Attributes inherited from g2o::BaseEdge< D, Isometry3 >
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

Additional Inherited Members

Public Types inherited from g2o::BaseBinaryEdge< 6, Isometry3, VertexSE3, VertexSE3 >
using VertexXiType
using VertexXjType
Public Types inherited from g2o::BaseFixedSizedEdge< D, Isometry3, VertexSE3, VertexSE3 >
using NthType
using VertexXnType
 The type of the N-th vertex.
typedef BaseEdge< D, Isometry3 >::Measurement Measurement
typedef BaseEdge< D, Isometry3 >::ErrorVector ErrorVector
typedef BaseEdge< D, Isometry3 >::InformationType InformationType
using JacobianType
using HessianBlockType
 it requires quite some ugly code to get the type of hessians...
using HessianBlockTypeK
using HessianBlockTypeKTransposed
using HessianTuple
using HessianTupleTransposed
using HessianRowMajorStorage
Public Types inherited from g2o::BaseEdge< D, Isometry3 >
typedef Isometry3 Measurement
typedef internal::BaseEdgeTraits< D >::ErrorVector ErrorVector
typedef internal::BaseEdgeTraits< D >::InformationType InformationType
Static Public Member Functions inherited from g2o::BaseFixedSizedEdge< D, Isometry3, VertexSE3, VertexSE3 >
static constexpr int VertexDimension ()
 Size of the N-th vertex at compile time.
Static Public Attributes inherited from g2o::BaseFixedSizedEdge< D, Isometry3, VertexSE3, VertexSE3 >
static const int Dimension
static const std::size_t _nr_of_vertices
static const std::size_t _nr_of_vertex_pairs
Static Public Attributes inherited from g2o::BaseEdge< D, Isometry3 >
static constexpr int Dimension
Protected Member Functions inherited from g2o::BaseEdge< D, Isometry3 >
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 ()

Detailed Description

Edge between two 3D pose vertices.

The transformation between the two vertices is given as an Isometry3. If z denotes the measurement, then the error function is given as follows: z^-1 * (x_i^-1 * x_j)

Definition at line 43 of file edge_se3.h.

Constructor & Destructor Documentation

◆ EdgeSE3()

Member Function Documentation

◆ computeError()

void g2o::EdgeSE3::computeError ( )
virtual

Implements g2o::OptimizableGraph::Edge.

Reimplemented in g2o::EdgeSE3Offset.

Definition at line 60 of file edge_se3.cpp.

60 {
61 VertexSE3* from = static_cast<VertexSE3*>(_vertices[0]);
62 VertexSE3* to = static_cast<VertexSE3*>(_vertices[1]);
63 Isometry3 delta =
64 _inverseMeasurement * from->estimate().inverse() * to->estimate();
66}
Isometry3 _inverseMeasurement
Definition edge_se3.h:86
VertexContainer _vertices
Vector6 toVectorMQT(const Isometry3 &t)
Eigen::Transform< double, 3, Eigen::Isometry, Eigen::ColMajor > Isometry3
Definition eigen_types.h:77

References g2o::BaseEdge< D, Isometry3 >::_error, _inverseMeasurement, g2o::HyperGraph::Edge::_vertices, g2o::BaseVertex< D, T >::estimate(), and g2o::internal::toVectorMQT().

◆ getMeasurementData()

virtual bool g2o::EdgeSE3::getMeasurementData ( double * m) const
inlinevirtual

writes the measurement to an array of double

Returns
true on success

Reimplemented from g2o::OptimizableGraph::Edge.

Definition at line 64 of file edge_se3.h.

64 {
65 Eigen::Map<Vector7> v(d);
67 return true;
68 }
Vector7 toVectorQT(const Isometry3 &t)

References g2o::BaseEdge< D, Isometry3 >::_measurement, and g2o::internal::toVectorQT().

◆ initialEstimate()

void g2o::EdgeSE3::initialEstimate ( const OptimizableGraph::VertexSet & ,
OptimizableGraph::Vertex *  )
virtual

set the estimate of the to vertex, based on the estimate of the from vertices in the edge.

Reimplemented from g2o::BaseEdge< D, Isometry3 >.

Reimplemented in g2o::EdgeSE3Offset, and g2o::OnlineEdgeSE3.

Definition at line 90 of file edge_se3.cpp.

91 {
92 VertexSE3* from = static_cast<VertexSE3*>(_vertices[0]);
93 VertexSE3* to = static_cast<VertexSE3*>(_vertices[1]);
94
95 if (from_.count(from) > 0) {
96 to->setEstimate(from->estimate() * _measurement);
97 } else
98 from->setEstimate(to->estimate() * _measurement.inverse());
99}

References g2o::BaseEdge< D, Isometry3 >::_measurement, g2o::HyperGraph::Edge::_vertices, g2o::BaseVertex< D, T >::estimate(), and g2o::BaseVertex< D, T >::setEstimate().

Referenced by main().

◆ initialEstimatePossible()

virtual double g2o::EdgeSE3::initialEstimatePossible ( const OptimizableGraph::VertexSet & from,
OptimizableGraph::Vertex * to )
inlinevirtual

override in your class if it's possible to initialize the vertices in certain combinations. The return value may correspond to the cost for initiliaizng the vertex but should be positive if the initialization is possible and negative if not possible.

Reimplemented from g2o::OptimizableGraph::Edge.

Reimplemented in g2o::EdgeSE3Offset.

Definition at line 76 of file edge_se3.h.

78 {
79 return 1.;
80 }

Referenced by g2o::G2oSlamInterface::addEdge().

◆ linearizeOplus()

void g2o::EdgeSE3::linearizeOplus ( )

Definition at line 76 of file edge_se3.cpp.

76 {
77 // BaseBinaryEdge<6, Isometry3, VertexSE3, VertexSE3>::linearizeOplus();
78 // return;
79
80 VertexSE3* from = static_cast<VertexSE3*>(_vertices[0]);
81 VertexSE3* to = static_cast<VertexSE3*>(_vertices[1]);
82 Isometry3 E;
83 const Isometry3& Xi = from->estimate();
84 const Isometry3& Xj = to->estimate();
85 const Isometry3& Z = _measurement;
87 Xj);
88}
BaseFixedSizedEdge< D, Isometry3, VertexSE3, VertexSE3 >::template JacobianType< D, VertexSE3::Dimension > & _jacobianOplusXj
BaseFixedSizedEdge< D, Isometry3, VertexSE3, VertexSE3 >::template JacobianType< D, VertexSE3::Dimension > & _jacobianOplusXi
void computeEdgeSE3Gradient(Isometry3 &E, Eigen::MatrixBase< Derived > const &JiConstRef, Eigen::MatrixBase< Derived > const &JjConstRef, const Isometry3 &Z, const Isometry3 &Xi, const Isometry3 &Xj, const Isometry3 &Pi, const Isometry3 &Pj)

References g2o::BaseBinaryEdge< 6, Isometry3, VertexSE3, VertexSE3 >::_jacobianOplusXi, g2o::BaseBinaryEdge< 6, Isometry3, VertexSE3, VertexSE3 >::_jacobianOplusXj, g2o::BaseEdge< D, Isometry3 >::_measurement, g2o::HyperGraph::Edge::_vertices, g2o::internal::computeEdgeSE3Gradient(), and g2o::BaseVertex< D, T >::estimate().

◆ measurementDimension()

virtual int g2o::EdgeSE3::measurementDimension ( ) const
inlinevirtual

returns the dimension of the measurement in the extended representation which is used by get/setMeasurement;

Reimplemented from g2o::OptimizableGraph::Edge.

Definition at line 72 of file edge_se3.h.

72{ return 7; }

◆ read()

bool g2o::EdgeSE3::read ( std::istream & is)
virtual

read the vertex from a stream, i.e., the internal state of the vertex

Implements g2o::OptimizableGraph::Edge.

Reimplemented in g2o::EdgeSE3Euler, and g2o::EdgeSE3Offset.

Definition at line 43 of file edge_se3.cpp.

43 {
44 Vector7 meas;
45 internal::readVector(is, meas);
46 // normalize the quaternion to recover numerical precision lost by storing as
47 // human readable text
48 Vector4::MapType(meas.data() + 3).normalize();
50 if (is.bad()) return false;
52 return is.good() || is.eof();
53}
bool readInformationMatrix(std::istream &is)
Definition base_edge.h:173
virtual void setMeasurement(const Isometry3 &m)
Definition edge_se3.h:53
Isometry3 fromVectorQT(const Vector7 &v)
bool readVector(std::istream &is, Eigen::DenseBase< Derived > &b)
Definition io_helper.h:42
VectorN< 7 > Vector7
Definition eigen_types.h:54

References g2o::internal::fromVectorQT(), g2o::BaseEdge< D, Isometry3 >::readInformationMatrix(), g2o::internal::readVector(), and setMeasurement().

◆ setMeasurement()

◆ setMeasurementData()

virtual bool g2o::EdgeSE3::setMeasurementData ( const double * m)
inlinevirtual

sets the measurement from an array of double

Returns
true on success

Reimplemented from g2o::OptimizableGraph::Edge.

Definition at line 58 of file edge_se3.h.

58 {
59 Eigen::Map<const Vector7> v(d);
61 return true;
62 }

References g2o::internal::fromVectorQT(), and setMeasurement().

◆ setMeasurementFromState()

bool g2o::EdgeSE3::setMeasurementFromState ( )
virtual

sets the estimate to have a zero error, based on the current value of the state variables returns false if not supported.

Reimplemented from g2o::OptimizableGraph::Edge.

Reimplemented in g2o::EdgeSE3Offset.

Definition at line 68 of file edge_se3.cpp.

68 {
69 VertexSE3* from = static_cast<VertexSE3*>(_vertices[0]);
70 VertexSE3* to = static_cast<VertexSE3*>(_vertices[1]);
71 Isometry3 delta = from->estimate().inverse() * to->estimate();
72 setMeasurement(delta);
73 return true;
74}

References g2o::HyperGraph::Edge::_vertices, g2o::BaseVertex< D, T >::estimate(), and setMeasurement().

◆ write()

bool g2o::EdgeSE3::write ( std::ostream & os) const
virtual

write the vertex to a stream

Implements g2o::OptimizableGraph::Edge.

Reimplemented in g2o::EdgeSE3Euler, and g2o::EdgeSE3Offset.

Definition at line 55 of file edge_se3.cpp.

55 {
57 return writeInformationMatrix(os);
58}
bool writeInformationMatrix(std::ostream &os) const
Definition base_edge.h:165
EIGEN_STRONG_INLINE const Measurement & measurement() const
Definition base_edge.h:119
bool writeVector(std::ostream &os, const Eigen::DenseBase< Derived > &b)
Definition io_helper.h:36

References g2o::BaseEdge< D, Isometry3 >::measurement(), g2o::internal::toVectorQT(), g2o::BaseEdge< D, Isometry3 >::writeInformationMatrix(), and g2o::internal::writeVector().

Referenced by main().

Member Data Documentation

◆ _inverseMeasurement

Isometry3 g2o::EdgeSE3::_inverseMeasurement
protected

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW

g2o::EdgeSE3::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 46 of file edge_se3.h.


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