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

#include <base_fixed_sized_edge.h>

Inheritance diagram for g2o::BaseFixedSizedEdge< D, E, VertexTypes >:
Collaboration diagram for g2o::BaseFixedSizedEdge< D, E, VertexTypes >:

Classes

struct  HessianTupleType
struct  HessianTupleType< std::index_sequence< Ints... > >

Public Types

template<int N, typename... Types>
using NthType = typename std::tuple_element<N, std::tuple<Types...>>::type
template<int VertexN>
using VertexXnType = NthType<VertexN, VertexTypes...>
 The type of the N-th vertex.
typedef BaseEdge< D, E >::Measurement Measurement
typedef BaseEdge< D, E >::ErrorVector ErrorVector
typedef BaseEdge< D, E >::InformationType InformationType
template<int EdgeDimension, int VertexDimension>
using JacobianType
template<int DN, int DM>
using HessianBlockType
 it requires quite some ugly code to get the type of hessians...
template<int K>
using HessianBlockTypeK
template<int K>
using HessianBlockTypeKTransposed
using HessianTuple
using HessianTupleTransposed
using HessianRowMajorStorage = std::array<bool, _nr_of_vertex_pairs>
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

template<int VertexN>
constexpr std::enable_if< VertexXnType< VertexN >::Dimension!=-1, int >::type vertexDimension () const
template<int VertexN>
std::enable_if< VertexXnType< VertexN >::Dimension==-1, int >::type vertexDimension () const
template<int VertexN>
const VertexXnType< VertexN > * vertexXn () const
template<int VertexN>
VertexXnType< VertexN > * vertexXn ()
 BaseFixedSizedEdge ()
template<typename... CtorArgs>
OptimizableGraph::Vertex * createVertex (int i, CtorArgs... args)
 create an instance of the Nth VertexType
virtual void resize (size_t size)
template<std::size_t... Ints>
bool allVerticesFixedNs (std::index_sequence< Ints... >) const
virtual bool allVerticesFixed () const
virtual void linearizeOplus (JacobianWorkspace &jacobianWorkspace)
template<std::size_t... Ints>
void linearizeOplus_allocate (JacobianWorkspace &jacobianWorkspace, std::index_sequence< Ints... >)
virtual void linearizeOplus ()
template<std::size_t... Ints>
void linearizeOplusNs (std::index_sequence< Ints... >)
template<int N>
void linearizeOplusN ()
template<int N>
const std::tuple_element< N, std::tuple< JacobianType< D, VertexTypes::Dimension >... > >::type & jacobianOplusXn () const
template<int N>
std::tuple_element< N, std::tuple< JacobianType< D, VertexTypes::Dimension >... > >::type & jacobianOplusXn ()
virtual void constructQuadraticForm ()
template<std::size_t... Ints>
void constructQuadraticFormNs (const InformationType &omega, const ErrorVector &weightedError, std::index_sequence< Ints... >)
template<int N>
void constructQuadraticFormN (const InformationType &omega, const ErrorVector &weightedError)
template<int N, typename AtOType>
void constructOffDiagonalQuadraticFormMs (const AtOType &, std::index_sequence<>)
template<int N, std::size_t... Ints, typename AtOType>
void constructOffDiagonalQuadraticFormMs (const AtOType &AtO, std::index_sequence< Ints... >)
template<int N, int M, typename AtOType>
void constructOffDiagonalQuadraticFormM (const AtOType &AtO)
virtual void mapHessianMemory (double *d, int i, int j, bool rowMajor)
template<std::size_t... Ints>
bool allVerticesFixedNs (std::index_sequence< Ints... >) const
template<std::size_t... Ints>
void constructQuadraticFormNs (const InformationType &omega, const ErrorVector &weightedError, std::index_sequence< Ints... >)
template<int N, typename AtOType>
void constructOffDiagonalQuadraticFormMs (const AtOType &, std::index_sequence<>)
template<int N, std::size_t... Ints, typename AtOType>
void constructOffDiagonalQuadraticFormMs (const AtOType &AtO, std::index_sequence< Ints... >)
template<int N, int M, typename AtOType>
void constructOffDiagonalQuadraticFormM (const AtOType &AtO)
template<int N>
void constructQuadraticFormN (const InformationType &omega, const ErrorVector &weightedError)
template<std::size_t... Ints>
void linearizeOplus_allocate (JacobianWorkspace &jacobianWorkspace, std::index_sequence< Ints... >)
template<int N>
void linearizeOplusN ()
template<std::size_t... Ints>
void linearizeOplusNs (std::index_sequence< Ints... >)
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 Member Functions

template<int VertexN>
static constexpr int VertexDimension ()
 Size of the N-th vertex at compile time.

Static Public Attributes

static const int Dimension = BaseEdge<D, E>::Dimension
static const std::size_t _nr_of_vertices = sizeof...(VertexTypes)
static const std::size_t _nr_of_vertex_pairs
Static Public Attributes inherited from g2o::BaseEdge< D, E >
static constexpr int Dimension = internal::BaseEdgeTraits<D>::Dimension

Protected Attributes

HessianRowMajorStorage _hessianRowMajor
HessianTuple _hessianTuple
HessianTupleTransposed _hessianTupleTransposed
std::tuple< JacobianType< D, VertexTypes::Dimension >... > _jacobianOplus
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

Additional Inherited Members

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 ()

Detailed Description

template<int D, typename E, typename... VertexTypes>
class g2o::BaseFixedSizedEdge< D, E, VertexTypes >

Definition at line 125 of file base_fixed_sized_edge.h.

Member Typedef Documentation

◆ ErrorVector

template<int D, typename E, typename... VertexTypes>
typedef BaseEdge<D,E>::ErrorVector g2o::BaseFixedSizedEdge< D, E, VertexTypes >::ErrorVector

Definition at line 166 of file base_fixed_sized_edge.h.

◆ HessianBlockType

template<int D, typename E, typename... VertexTypes>
template<int DN, int DM>
using g2o::BaseFixedSizedEdge< D, E, VertexTypes >::HessianBlockType
Initial value:
Eigen::Map<
Eigen::Matrix<double, DN, DM,
DN == 1 ? Eigen::RowMajor : Eigen::ColMajor>,
Eigen::Matrix<double, DN, DM,
DN == 1 ? Eigen::RowMajor : Eigen::ColMajor>::Flags &
Eigen::PacketAccessBit
? Eigen::Aligned
: Eigen::Unaligned>

it requires quite some ugly code to get the type of hessians...

Definition at line 176 of file base_fixed_sized_edge.h.

◆ HessianBlockTypeK

template<int D, typename E, typename... VertexTypes>
template<int K>
using g2o::BaseFixedSizedEdge< D, E, VertexTypes >::HessianBlockTypeK
Initial value:
Eigen::Map< Eigen::Matrix< double, DN, DM, DN==1 ? Eigen::RowMajor :Eigen::ColMajor >, Eigen::Matrix< double, DN, DM, DN==1 ? Eigen::RowMajor :Eigen::ColMajor >::Flags & Eigen::PacketAccessBit ? Eigen::Aligned :Eigen::Unaligned > HessianBlockType
it requires quite some ugly code to get the type of hessians...
NthType< VertexN, VertexTypes... > VertexXnType
The type of the N-th vertex.
constexpr TrivialPair index_to_pair(const int k, const int j=0)

Definition at line 185 of file base_fixed_sized_edge.h.

◆ HessianBlockTypeKTransposed

template<int D, typename E, typename... VertexTypes>
template<int K>
using g2o::BaseFixedSizedEdge< D, E, VertexTypes >::HessianBlockTypeKTransposed

◆ HessianRowMajorStorage

template<int D, typename E, typename... VertexTypes>
using g2o::BaseFixedSizedEdge< D, E, VertexTypes >::HessianRowMajorStorage = std::array<bool, _nr_of_vertex_pairs>

Definition at line 206 of file base_fixed_sized_edge.h.

◆ HessianTuple

template<int D, typename E, typename... VertexTypes>
using g2o::BaseFixedSizedEdge< D, E, VertexTypes >::HessianTuple
Initial value:
typename HessianTupleType<
std::make_index_sequence<_nr_of_vertex_pairs>>::type

Definition at line 202 of file base_fixed_sized_edge.h.

◆ HessianTupleTransposed

template<int D, typename E, typename... VertexTypes>
using g2o::BaseFixedSizedEdge< D, E, VertexTypes >::HessianTupleTransposed
Initial value:
typename HessianTupleType<
std::make_index_sequence<_nr_of_vertex_pairs>>::typeTransposed

Definition at line 204 of file base_fixed_sized_edge.h.

◆ InformationType

template<int D, typename E, typename... VertexTypes>
typedef BaseEdge<D,E>::InformationType g2o::BaseFixedSizedEdge< D, E, VertexTypes >::InformationType

Definition at line 167 of file base_fixed_sized_edge.h.

◆ JacobianType

template<int D, typename E, typename... VertexTypes>
template<int EdgeDimension, int VertexDimension>
using g2o::BaseFixedSizedEdge< D, E, VertexTypes >::JacobianType
Initial value:
typename Eigen::Matrix<
double, EdgeDimension, VertexDimension,
EdgeDimension == 1 ? Eigen::RowMajor : Eigen::ColMajor>::AlignedMapType
static constexpr int VertexDimension()
Size of the N-th vertex at compile time.

Definition at line 170 of file base_fixed_sized_edge.h.

◆ Measurement

template<int D, typename E, typename... VertexTypes>
typedef BaseEdge<D,E>::Measurement g2o::BaseFixedSizedEdge< D, E, VertexTypes >::Measurement

Definition at line 165 of file base_fixed_sized_edge.h.

◆ NthType

template<int D, typename E, typename... VertexTypes>
template<int N, typename... Types>
using g2o::BaseFixedSizedEdge< D, E, VertexTypes >::NthType = typename std::tuple_element<N, std::tuple<Types...>>::type

Definition at line 128 of file base_fixed_sized_edge.h.

◆ VertexXnType

template<int D, typename E, typename... VertexTypes>
template<int VertexN>
using g2o::BaseFixedSizedEdge< D, E, VertexTypes >::VertexXnType = NthType<VertexN, VertexTypes...>

The type of the N-th vertex.

Definition at line 131 of file base_fixed_sized_edge.h.

Constructor & Destructor Documentation

◆ BaseFixedSizedEdge()

template<int D, typename E, typename... VertexTypes>
g2o::BaseFixedSizedEdge< D, E, VertexTypes >::BaseFixedSizedEdge ( )
inline

Member Function Documentation

◆ allVerticesFixed()

template<int D, typename E, typename... VertexTypes>
bool BaseFixedSizedEdge::allVerticesFixed ( ) const
virtual

Implements g2o::OptimizableGraph::Edge.

Definition at line 45 of file base_fixed_sized_edge.h.

◆ allVerticesFixedNs() [1/2]

template<int D, typename E, typename... VertexTypes>
template<std::size_t... Ints>
bool g2o::BaseFixedSizedEdge< D, E, VertexTypes >::allVerticesFixedNs ( std::index_sequence< Ints... > ) const

◆ allVerticesFixedNs() [2/2]

template<int D, typename E, typename... VertexTypes>
template<std::size_t... Ints>
bool g2o::BaseFixedSizedEdge< D, E, VertexTypes >::allVerticesFixedNs ( std::index_sequence< Ints... > ) const

Definition at line 38 of file base_fixed_sized_edge.hpp.

39 {
40 return (... && vertexXn<Ints>()->fixed());
41}
const VertexXnType< VertexN > * vertexXn() const

◆ constructOffDiagonalQuadraticFormM() [1/2]

template<int D, typename E, typename... VertexTypes>
template<int N, int M, typename AtOType>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructOffDiagonalQuadraticFormM ( const AtOType & AtO)

Definition at line 92 of file base_fixed_sized_edge.h.

97 constexpr int c =
99 return T(nullptr, r, c);
100}
102template <typename... Args>
104 return std::tuple<Args...>{createHessianMapK<Args>()...};
105}
106
107template <int I, typename EdgeType, typename... CtorArgs>
109createNthVertexType(int /*i*/, const EdgeType& /*t*/, CtorArgs... /*args*/) {
110 return nullptr;
111}

◆ constructOffDiagonalQuadraticFormM() [2/2]

template<int D, typename E, typename... VertexTypes>
template<int N, int M, typename AtOType>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructOffDiagonalQuadraticFormM ( const AtOType & AtO)

Definition at line 91 of file base_fixed_sized_edge.hpp.

92 {
93 constexpr auto fromId = N;
94 constexpr auto toId = N + M + 1;
95 assert(fromId < toId && "Index mixed up");
96 auto to = vertexXn<toId>();
97 if (!to->fixed()) {
98 const auto& B = std::get<toId>(_jacobianOplus);
99 constexpr auto K = internal::pair_to_index(fromId, toId);
101 (void)lck;
102 if (_hessianRowMajor[K]) { // we have to write to the block as transposed
104 hessianTransposed.noalias() += B.transpose() * AtO.transpose();
105 } else {
107 hessian.noalias() += AtO * B;
108 }
109 }
110}
constexpr int pair_to_index(const int i, const int j)

◆ constructOffDiagonalQuadraticFormMs() [1/4]

template<int D, typename E, typename... VertexTypes>
template<int N, typename AtOType>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructOffDiagonalQuadraticFormMs ( const AtOType & ,
std::index_sequence<>  )

Definition at line 78 of file base_fixed_sized_edge.h.

79 {
80 * constexpr int j = int(0.5 + cst_sqrt(0.25 + 2 * n));

◆ constructOffDiagonalQuadraticFormMs() [2/4]

template<int D, typename E, typename... VertexTypes>
template<int N, typename AtOType>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructOffDiagonalQuadraticFormMs ( const AtOType & ,
std::index_sequence<>  )

Definition at line 77 of file base_fixed_sized_edge.hpp.

78 {
79}

◆ constructOffDiagonalQuadraticFormMs() [3/4]

template<int D, typename E, typename... VertexTypes>
template<int N, std::size_t... Ints, typename AtOType>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructOffDiagonalQuadraticFormMs ( const AtOType & AtO,
std::index_sequence< Ints... >  )

Definition at line 84 of file base_fixed_sized_edge.h.

86 {
87 return k < j ? TrivialPair{k, j} : index_to_pair(k - j, j + 1);
88}

◆ constructOffDiagonalQuadraticFormMs() [4/4]

template<int D, typename E, typename... VertexTypes>
template<int N, std::size_t... Ints, typename AtOType>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructOffDiagonalQuadraticFormMs ( const AtOType & AtO,
std::index_sequence< Ints... >  )

Definition at line 83 of file base_fixed_sized_edge.hpp.

85 {
87}
void constructOffDiagonalQuadraticFormM(const AtOType &AtO)

◆ constructQuadraticForm()

template<int D, typename E, typename... VertexTypes>
void BaseFixedSizedEdge::constructQuadraticForm ( )
virtual

computes the (block) elements of the Hessian matrix of the linearized least squares.

Implements g2o::OptimizableGraph::Edge.

Definition at line 50 of file base_fixed_sized_edge.h.

53 {
54 return std::array<bool, 0>();
55}
56
57// assumes i < j
58// duplication of internal::computeUpperTriangleIndex in
59// g2o/core/base_variable_sized_edge.hpp
60constexpr int pair_to_index(const int i, const int j) {
61 return j * (j - 1) / 2 + i;
62}
63

◆ constructQuadraticFormN() [1/2]

template<int D, typename E, typename... VertexTypes>
template<int N>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructQuadraticFormN ( const InformationType & omega,
const ErrorVector & weightedError )

◆ constructQuadraticFormN() [2/2]

template<int D, typename E, typename... VertexTypes>
template<int N>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructQuadraticFormN ( const InformationType & omega,
const ErrorVector & weightedError )

Definition at line 114 of file base_fixed_sized_edge.hpp.

115 {
116 auto from = vertexXn<N>();
117 const auto& A = std::get<N>(_jacobianOplus);
118
119 if (!(from->fixed())) {
120 const auto AtO = A.transpose() * omega;
121 {
123 (void)lck;
124 from->b().noalias() += A.transpose() * weightedError;
125 from->A().noalias() += AtO * A;
126 }
129 }
130};
void constructOffDiagonalQuadraticFormMs(const AtOType &, std::index_sequence<>)

◆ constructQuadraticFormNs() [1/2]

template<int D, typename E, typename... VertexTypes>
template<std::size_t... Ints>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructQuadraticFormNs ( const InformationType & omega,
const ErrorVector & weightedError,
std::index_sequence< Ints... >  )

Definition at line 68 of file base_fixed_sized_edge.h.

68 {
69 int first, second;
70 constexpr TrivialPair(int f, int s) : first(f), second(s) {}
71 bool operator==(const TrivialPair& other) const {
72 return first == other.first && second == other.second;

References g2o::internal::TrivialPair::TrivialPair().

Referenced by g2o::BaseFixedSizedEdge< D, OdomAndLaserMotion, VertexSE2, VertexBaseline >::constructQuadraticFormNs().

◆ constructQuadraticFormNs() [2/2]

template<int D, typename E, typename... VertexTypes>
template<std::size_t... Ints>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::constructQuadraticFormNs ( const InformationType & omega,
const ErrorVector & weightedError,
std::index_sequence< Ints... >  )

Definition at line 67 of file base_fixed_sized_edge.hpp.

69 {
71}
void constructQuadraticFormN(const InformationType &omega, const ErrorVector &weightedError)

◆ createVertex()

template<int D, typename E, typename... VertexTypes>
template<typename... CtorArgs>
OptimizableGraph::Vertex * g2o::BaseFixedSizedEdge< D, E, VertexTypes >::createVertex ( int i,
CtorArgs... args )
inline

create an instance of the Nth VertexType

Definition at line 220 of file base_fixed_sized_edge.h.

220 {
221 if (i < 0) return nullptr;
223 sizeof...(VertexTypes) - 1,
224 typename std::remove_reference<decltype(*this)>::type, CtorArgs...>(
225 i, *this, args...);
226 };

◆ jacobianOplusXn() [1/2]

template<int D, typename E, typename... VertexTypes>
template<int N>
std::tuple_element< N, std::tuple< JacobianType< D, VertexTypes::Dimension >... > >::type & g2o::BaseFixedSizedEdge< D, E, VertexTypes >::jacobianOplusXn ( )
inline

returns the result of the linearization in the manifold space for the nodes xn

Definition at line 262 of file base_fixed_sized_edge.h.

262 {
264 }

References _jacobianOplus.

◆ jacobianOplusXn() [2/2]

template<int D, typename E, typename... VertexTypes>
template<int N>
const std::tuple_element< N, std::tuple< JacobianType< D, VertexTypes::Dimension >... > >::type & g2o::BaseFixedSizedEdge< D, E, VertexTypes >::jacobianOplusXn ( ) const
inline

returns the result of the linearization in the manifold space for the nodes xn

Definition at line 254 of file base_fixed_sized_edge.h.

254 {
256 }

References _jacobianOplus.

◆ linearizeOplus() [1/2]

template<int D, typename E, typename... VertexTypes>
void BaseFixedSizedEdge::linearizeOplus ( )
virtual

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

Definition at line 205 of file base_fixed_sized_edge.h.

◆ linearizeOplus() [2/2]

template<int D, typename E, typename... VertexTypes>
void BaseFixedSizedEdge::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 134 of file base_fixed_sized_edge.h.

134 {
136 };

◆ linearizeOplus_allocate() [1/2]

template<int D, typename E, typename... VertexTypes>
template<std::size_t... Ints>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::linearizeOplus_allocate ( JacobianWorkspace & jacobianWorkspace,
std::index_sequence< Ints... >  )

◆ linearizeOplus_allocate() [2/2]

template<int D, typename E, typename... VertexTypes>
template<std::size_t... Ints>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::linearizeOplus_allocate ( JacobianWorkspace & jacobianWorkspace,
std::index_sequence< Ints... >  )

Definition at line 142 of file base_fixed_sized_edge.hpp.

◆ linearizeOplusN() [1/2]

template<int D, typename E, typename... VertexTypes>
template<int N>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::linearizeOplusN ( )

Definition at line 155 of file base_fixed_sized_edge.h.

175 template <int DN, int DM>
184 template <int K>
188 template <int K>
192 template <typename>
193 struct HessianTupleType;
194 template <std::size_t... Ints>
195 struct HessianTupleType<std::index_sequence<Ints...>> {
BaseEdge< D, E >::InformationType InformationType
HessianBlockType< VertexXnType< internal::index_to_pair(K).first >::Dimension, VertexXnType< internal::index_to_pair(K).second >::Dimension > HessianBlockTypeK
BaseEdge< D, E >::ErrorVector ErrorVector
HessianBlockType< VertexXnType< internal::index_to_pair(K).second >::Dimension, VertexXnType< internal::index_to_pair(K).first >::Dimension > HessianBlockTypeKTransposed
BaseEdge< D, E >::Measurement Measurement

Referenced by g2o::BaseFixedSizedEdge< D, OdomAndLaserMotion, VertexSE2, VertexBaseline >::linearizeOplusN().

◆ linearizeOplusN() [2/2]

template<int D, typename E, typename... VertexTypes>
template<int N>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::linearizeOplusN ( )

Definition at line 154 of file base_fixed_sized_edge.hpp.

154 {
155 auto vertex = vertexXn<N>();
156
157 if (vertex->fixed()) return;
158
160
161 constexpr double delta = cst(1e-9);
162 constexpr double scalar = 1 / (2 * delta);
163
165 (void)lck;
166
167 typedef typename std::conditional<
170 double, static_cast<size_t>(VertexXnType<N>::Dimension)> >::type
173 add_vertex.fill(0.);
174
175 // estimate the jacobian numerically
176 // add small step along the unit vector in each dimension
177 for (int d = 0; d < vertexDimension<N>(); ++d) {
178 vertex->push();
179 add_vertex[d] = delta;
180 vertex->oplus(add_vertex.data());
181 computeError();
182 auto errorBak = this->error();
183 vertex->pop();
184 vertex->push();
185 add_vertex[d] = -delta;
186 vertex->oplus(add_vertex.data());
187 computeError();
188 errorBak -= this->error();
189 vertex->pop();
190 add_vertex[d] = 0.0;
191
193 } // end dimension
194}
const ErrorVector & error() const
Definition base_edge.h:103
const Vertex * vertex(size_t i) const
virtual void computeError()=0
constexpr double cst(long double v)
Definition misc.h:60

◆ linearizeOplusNs() [1/2]

template<int D, typename E, typename... VertexTypes>
template<std::size_t... Ints>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::linearizeOplusNs ( std::index_sequence< Ints... > )

◆ linearizeOplusNs() [2/2]

template<int D, typename E, typename... VertexTypes>
template<std::size_t... Ints>
void g2o::BaseFixedSizedEdge< D, E, VertexTypes >::linearizeOplusNs ( std::index_sequence< Ints... > )

Definition at line 198 of file base_fixed_sized_edge.hpp.

199 {
200 (void(linearizeOplusN<Ints>()), ...);
201}

◆ mapHessianMemory()

template<int D, typename E, typename... VertexTypes>
void BaseFixedSizedEdge::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 228 of file base_fixed_sized_edge.h.

◆ resize()

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

resizes the number of vertices connected by this edge

Reimplemented from g2o::HyperGraph::Edge.

Definition at line 31 of file base_fixed_sized_edge.h.

Referenced by main().

◆ VertexDimension()

template<int D, typename E, typename... VertexTypes>
template<int VertexN>
constexpr int g2o::BaseFixedSizedEdge< D, E, VertexTypes >::VertexDimension ( )
inlinestaticconstexpr

Size of the N-th vertex at compile time.

Definition at line 134 of file base_fixed_sized_edge.h.

134 {
136 };

◆ vertexDimension() [1/2]

template<int D, typename E, typename... VertexTypes>
template<int VertexN>
std::enable_if< VertexXnType< VertexN >::Dimension==-1, int >::type g2o::BaseFixedSizedEdge< D, E, VertexTypes >::vertexDimension ( ) const
inline

Definition at line 148 of file base_fixed_sized_edge.h.

148 {
149 return vertexXn<VertexN>()->dimension();
150 };

References vertexXn().

◆ vertexDimension() [2/2]

template<int D, typename E, typename... VertexTypes>
template<int VertexN>
std::enable_if< VertexXnType< VertexN >::Dimension!=-1, int >::type g2o::BaseFixedSizedEdge< D, E, VertexTypes >::vertexDimension ( ) const
inlineconstexpr

Get the size of a given Vertex. If the vertex dimension is static and by this known at compile time, we return this. Otherwise we get the size at runtime.

Definition at line 144 of file base_fixed_sized_edge.h.

144 {
146 };

◆ vertexXn() [1/2]

template<int D, typename E, typename... VertexTypes>
template<int VertexN>
VertexXnType< VertexN > * g2o::BaseFixedSizedEdge< D, E, VertexTypes >::vertexXn ( )
inline

Definition at line 160 of file base_fixed_sized_edge.h.

160 {
161 return static_cast<VertexXnType<VertexN>*>(_vertices[VertexN]);
162 }

References g2o::HyperGraph::Edge::_vertices.

◆ vertexXn() [2/2]

template<int D, typename E, typename... VertexTypes>
template<int VertexN>
const VertexXnType< VertexN > * g2o::BaseFixedSizedEdge< D, E, VertexTypes >::vertexXn ( ) const
inline

Return a pointer to the N-th vertex, directly casted to the correct type

Definition at line 156 of file base_fixed_sized_edge.h.

156 {
157 return static_cast<const VertexXnType<VertexN>*>(_vertices[VertexN]);
158 }

References g2o::HyperGraph::Edge::_vertices.

Referenced by vertexDimension().

Member Data Documentation

◆ _hessianRowMajor

template<int D, typename E, typename... VertexTypes>
HessianRowMajorStorage g2o::BaseFixedSizedEdge< D, E, VertexTypes >::_hessianRowMajor
protected

Definition at line 301 of file base_fixed_sized_edge.h.

Referenced by BaseFixedSizedEdge().

◆ _hessianTuple

template<int D, typename E, typename... VertexTypes>
HessianTuple g2o::BaseFixedSizedEdge< D, E, VertexTypes >::_hessianTuple
protected

Definition at line 302 of file base_fixed_sized_edge.h.

Referenced by BaseFixedSizedEdge().

◆ _hessianTupleTransposed

template<int D, typename E, typename... VertexTypes>
HessianTupleTransposed g2o::BaseFixedSizedEdge< D, E, VertexTypes >::_hessianTupleTransposed
protected

Definition at line 303 of file base_fixed_sized_edge.h.

Referenced by BaseFixedSizedEdge().

◆ _jacobianOplus

template<int D, typename E, typename... VertexTypes>
std::tuple<JacobianType<D, VertexTypes::Dimension>...> g2o::BaseFixedSizedEdge< D, E, VertexTypes >::_jacobianOplus
protected

Definition at line 304 of file base_fixed_sized_edge.h.

Referenced by BaseFixedSizedEdge(), jacobianOplusXn(), and jacobianOplusXn().

◆ _nr_of_vertex_pairs

template<int D, typename E, typename... VertexTypes>
const std::size_t g2o::BaseFixedSizedEdge< D, E, VertexTypes >::_nr_of_vertex_pairs
static
Initial value:

Definition at line 200 of file base_fixed_sized_edge.h.

Referenced by BaseFixedSizedEdge().

◆ _nr_of_vertices

template<int D, typename E, typename... VertexTypes>
const std::size_t g2o::BaseFixedSizedEdge< D, E, VertexTypes >::_nr_of_vertices = sizeof...(VertexTypes)
static

Definition at line 199 of file base_fixed_sized_edge.h.

◆ Dimension

template<int D, typename E, typename... VertexTypes>
const int g2o::BaseFixedSizedEdge< D, E, VertexTypes >::Dimension = BaseEdge<D, E>::Dimension
static

Definition at line 164 of file base_fixed_sized_edge.h.


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