g2o
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
g2o::Edge_V_V_GICP Class Reference

#include <types_icp.h>

Inheritance diagram for g2o::Edge_V_V_GICP:
Inheritance graph
[legend]
Collaboration diagram for g2o::Edge_V_V_GICP:
Collaboration graph
[legend]

Public Member Functions

 Edge_V_V_GICP ()
 
 Edge_V_V_GICP (const Edge_V_V_GICP *e)
 
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 linearizeOplus ()
 
- Public Member Functions inherited from g2o::BaseBinaryEdge< 3, EdgeGICP, VertexSE3, VertexSE3 >
 BaseBinaryEdge ()
 
- Public Member Functions inherited from g2o::BaseFixedSizedEdge< D, E, VertexTypes >
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::VertexcreateVertex (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... >)
 
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 ()
 
BaseEdgeoperator= (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 ErrorVectorerror () const
 
ErrorVectorerror ()
 
EIGEN_STRONG_INLINE const InformationTypeinformation () const
 information matrix of the constraint
 
EIGEN_STRONG_INLINE InformationTypeinformation ()
 
void setInformation (const InformationType &information)
 
virtual const double * informationData () const
 
virtual double * informationData ()
 
EIGEN_STRONG_INLINE const Measurementmeasurement () 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 bool setMeasurementData (const double *m)
 
virtual bool getMeasurementData (double *m) const
 
virtual int measurementDimension () const
 
virtual bool setMeasurementFromState ()
 
RobustKernelrobustKernel () 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 VertexcreateVertex (int)
 
long long internalId () const
 the internal ID of the edge
 
OptimizableGraphgraph ()
 
const OptimizableGraphgraph () const
 
bool setParameterId (int argNum, int paramId)
 
const Parameterparameter (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 VertexContainervertices () const
 
VertexContainervertices ()
 
const Vertexvertex (size_t i) const
 
Vertexvertex (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 DatauserData () const
 the user data associated with this vertex
 
DatauserData ()
 
void setUserData (Data *obs)
 
void addUserData (Data *obs)
 

Public Attributes

 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
 
bool pl_pl
 
Matrix3 cov0
 
Matrix3 cov1
 

Static Public Attributes

static Matrix3 dRidx
 
static Matrix3 dRidy
 
static Matrix3 dRidz
 
- Static Public Attributes inherited from g2o::BaseFixedSizedEdge< D, E, VertexTypes >
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
 

Additional Inherited Members

- Public Types inherited from g2o::BaseBinaryEdge< 3, EdgeGICP, VertexSE3, VertexSE3 >
using VertexXiType = VertexSE3
 
using VertexXjType = VertexSE3
 
- Public Types inherited from g2o::BaseFixedSizedEdge< D, E, VertexTypes >
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 = typename Eigen::Matrix< double, EdgeDimension, VertexDimension, EdgeDimension==1 ? Eigen::RowMajor :Eigen::ColMajor >::AlignedMapType
 
template<int DN, int DM>
using HessianBlockType = 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...
 
template<int K>
using HessianBlockTypeK = HessianBlockType< VertexXnType< internal::index_to_pair(K).first >::Dimension, VertexXnType< internal::index_to_pair(K).second >::Dimension >
 
template<int K>
using HessianBlockTypeKTransposed = HessianBlockType< VertexXnType< internal::index_to_pair(K).second >::Dimension, VertexXnType< internal::index_to_pair(K).first >::Dimension >
 
using HessianTuple = typename HessianTupleType< std::make_index_sequence< _nr_of_vertex_pairs > >::type
 
using HessianTupleTransposed = typename HessianTupleType< std::make_index_sequence< _nr_of_vertex_pairs > >::typeTransposed
 
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
 
- Static Public Member Functions inherited from g2o::BaseFixedSizedEdge< D, E, VertexTypes >
template<int VertexN>
static constexpr int VertexDimension ()
 Size of the N-th vertex at compile time.
 
- 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 inherited from g2o::BaseBinaryEdge< 3, EdgeGICP, VertexSE3, VertexSE3 >
BaseFixedSizedEdge< D, EdgeGICP, VertexSE3, VertexSE3 >::template JacobianType< D, VertexXi::Dimension > & _jacobianOplusXi
 
BaseFixedSizedEdge< D, EdgeGICP, VertexSE3, VertexSE3 >::template JacobianType< D, VertexXj::Dimension > & _jacobianOplusXj
 
- Protected Attributes inherited from g2o::BaseFixedSizedEdge< D, E, VertexTypes >
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
 

Detailed Description

Definition at line 143 of file types_icp.h.

Constructor & Destructor Documentation

◆ Edge_V_V_GICP() [1/2]

g2o::Edge_V_V_GICP::Edge_V_V_GICP ( )
inline

Definition at line 147 of file types_icp.h.

147: pl_pl(false) {}

◆ Edge_V_V_GICP() [2/2]

g2o::Edge_V_V_GICP::Edge_V_V_GICP ( const Edge_V_V_GICP e)

Definition at line 73 of file types_icp.cpp.

74 : BaseBinaryEdge<3, EdgeGICP, VertexSE3, VertexSE3>() {
75 // Temporary hack - TODO, sort out const-ness properly
76 _vertices[0] = const_cast<HyperGraph::Vertex*>(e->vertex(0));
77 _vertices[1] = const_cast<HyperGraph::Vertex*>(e->vertex(1));
78
79 _measurement.pos0 = e->measurement().pos0;
80 _measurement.pos1 = e->measurement().pos1;
81 _measurement.normal0 = e->measurement().normal0;
82 _measurement.normal1 = e->measurement().normal1;
83 _measurement.R0 = e->measurement().R0;
84 _measurement.R1 = e->measurement().R1;
85
86 pl_pl = e->pl_pl;
87 cov0 = e->cov0;
88 cov1 = e->cov1;
89
90 // TODO the robust kernel is not correctly copied
91 //_robustKernel = e->_robustKernel;
92}
Measurement _measurement
the measurement of the edge
Definition base_edge.h:146
VertexContainer _vertices

References g2o::BaseEdge< D, E >::_measurement, g2o::HyperGraph::Edge::_vertices, cov0, cov1, g2o::BaseEdge< D, E >::measurement(), pl_pl, and g2o::HyperGraph::Edge::vertex().

Member Function Documentation

◆ computeError()

void g2o::Edge_V_V_GICP::computeError ( )
inlinevirtual

Implements g2o::OptimizableGraph::Edge.

Definition at line 159 of file types_icp.h.

159 {
160 // from <ViewPoint> to <Point>
161 const VertexSE3* vp0 = static_cast<const VertexSE3*>(_vertices[0]);
162 const VertexSE3* vp1 = static_cast<const VertexSE3*>(_vertices[1]);
163
164 // get vp1 point into vp0 frame
165 // could be more efficient if we computed this transform just once
166 Vector3 p1;
167
168#if 0
169 if (_cnum >= 0 && 0) // using global cache
170 {
171 if (_tainted[_cnum]) // set up transform
172 {
173 _transforms[_cnum] = vp0->estimate().inverse() * vp1->estimate();
174 _tainted[_cnum] = 0;
175 cout << _transforms[_cnum] << endl;
176 }
177 p1 = _transforms[_cnum].map(measurement().pos1); // do the transform
178 }
179 else
180#endif
181 {
182 p1 = vp1->estimate() * measurement().pos1;
183 p1 = vp0->estimate().inverse() * p1;
184 }
185
186 // cout << endl << "Error computation; points are: " << endl;
187 // cout << p0.transpose() << endl;
188 // cout << p1.transpose() << endl;
189
190 // get their difference
191 // this is simple Euclidean distance, for now
192 _error = p1 - measurement().pos0;
193
194#if 0
195 cout << "vp0" << endl << vp0->estimate() << endl;
196 cout << "vp1" << endl << vp1->estimate() << endl;
197 cout << "e Jac Xj" << endl << _jacobianOplusXj << endl << endl;
198 cout << "e Jac Xi" << endl << _jacobianOplusXi << endl << endl;
199#endif
200
201 if (!pl_pl) return;
202
203 // re-define the information matrix
204 // topLeftCorner<3,3>() is the rotation()
205 const Matrix3 transform = (vp0->estimate().inverse() * vp1->estimate())
206 .matrix()
207 .topLeftCorner<3, 3>();
208 information() = (cov0 + transform * cov1 * transform.transpose()).inverse();
209 }
BaseFixedSizedEdge< D, EdgeGICP, VertexSE3, VertexSE3 >::template JacobianType< D, VertexXj::Dimension > & _jacobianOplusXj
BaseFixedSizedEdge< D, EdgeGICP, VertexSE3, VertexSE3 >::template JacobianType< D, VertexXi::Dimension > & _jacobianOplusXi
EIGEN_STRONG_INLINE const Measurement & measurement() const
accessor functions for the measurement represented by the edge
Definition base_edge.h:119
EIGEN_STRONG_INLINE const InformationType & information() const
information matrix of the constraint
Definition base_edge.h:107
ErrorVector _error
Definition base_edge.h:149
VectorN< 3 > Vector3
Definition eigen_types.h:51
MatrixN< 3 > Matrix3
Definition eigen_types.h:72
void transform(PlaneList &l, const SE3Quat &t)

References g2o::BaseVertex< D, T >::estimate(), and transform().

◆ linearizeOplus()

void g2o::Edge_V_V_GICP::linearizeOplus ( )
virtual

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

Reimplemented from g2o::BaseFixedSizedEdge< D, E, VertexTypes >.

Definition at line 145 of file types_icp.cpp.

145 {
146 VertexSE3* vp0 = static_cast<VertexSE3*>(_vertices[0]);
147 VertexSE3* vp1 = static_cast<VertexSE3*>(_vertices[1]);
148
149 // topLeftCorner<3,3>() is the rotation matrix
150 Matrix3 R0T = vp0->estimate().matrix().topLeftCorner<3, 3>().transpose();
151 Vector3 p1 = measurement().pos1;
152
153 // this could be more efficient
154 if (!vp0->fixed()) {
155 Isometry3 T01 = vp0->estimate().inverse() * vp1->estimate();
156 Vector3 p1t = T01 * p1;
157 _jacobianOplusXi.block<3, 3>(0, 0) = -Matrix3::Identity();
158 _jacobianOplusXi.block<3, 1>(0, 3) = dRidx * p1t;
159 _jacobianOplusXi.block<3, 1>(0, 4) = dRidy * p1t;
160 _jacobianOplusXi.block<3, 1>(0, 5) = dRidz * p1t;
161 }
162
163 if (!vp1->fixed()) {
164 Matrix3 R1 = vp1->estimate().matrix().topLeftCorner<3, 3>();
165 R0T = R0T * R1;
166 _jacobianOplusXj.block<3, 3>(0, 0) = R0T;
167 _jacobianOplusXj.block<3, 1>(0, 3) = R0T * dRidx.transpose() * p1;
168 _jacobianOplusXj.block<3, 1>(0, 4) = R0T * dRidy.transpose() * p1;
169 _jacobianOplusXj.block<3, 1>(0, 5) = R0T * dRidz.transpose() * p1;
170 }
171}
static Matrix3 dRidy
Definition types_icp.h:218
static Matrix3 dRidx
Definition types_icp.h:217
static Matrix3 dRidz
Definition types_icp.h:219
Eigen::Transform< double, 3, Eigen::Isometry, Eigen::ColMajor > Isometry3
Definition eigen_types.h:77

References g2o::BaseBinaryEdge< 3, EdgeGICP, VertexSE3, VertexSE3 >::_jacobianOplusXi, g2o::BaseBinaryEdge< 3, EdgeGICP, VertexSE3, VertexSE3 >::_jacobianOplusXj, g2o::HyperGraph::Edge::_vertices, dRidx, dRidy, dRidz, g2o::BaseVertex< D, T >::estimate(), g2o::OptimizableGraph::Vertex::fixed(), and g2o::BaseEdge< D, E >::measurement().

◆ read()

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

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

Implements g2o::OptimizableGraph::Edge.

Definition at line 104 of file types_icp.cpp.

104 {
105 // measured point and normal
106 for (int i = 0; i < 3; i++) is >> _measurement.pos0[i];
107 for (int i = 0; i < 3; i++) is >> _measurement.normal0[i];
108
109 // measured point and normal
110 for (int i = 0; i < 3; i++) is >> _measurement.pos1[i];
111 for (int i = 0; i < 3; i++) is >> _measurement.normal1[i];
112
113 // don't need this if we don't use it in error calculation (???)
114 // inverseMeasurement() = -measurement();
115
116 _measurement.makeRot0(); // set up rotation matrices
117
118 // GICP info matrices
119
120 // point-plane only
121 Matrix3 prec;
122 double v = cst(.01);
123 prec << v, 0, 0, 0, v, 0, 0, 0, 1;
124 const Matrix3& R = measurement().R0; // plane of the point in vp0
125 information() = R.transpose() * prec * R;
126
127 // information().setIdentity();
128
129 // setRobustKernel(true);
130 // setHuberWidth(0.01); // units? m?
131
132 return true;
133}
constexpr double cst(long double v)
Definition misc.h:60

References g2o::BaseEdge< D, E >::_measurement, g2o::cst(), g2o::BaseEdge< D, E >::information(), and g2o::BaseEdge< D, E >::measurement().

◆ write()

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

write the vertex to a stream

Implements g2o::OptimizableGraph::Edge.

Definition at line 174 of file types_icp.cpp.

174 {
175 // first point
176 for (int i = 0; i < 3; i++) os << measurement().pos0[i] << " ";
177 for (int i = 0; i < 3; i++) os << measurement().normal0[i] << " ";
178
179 // second point
180 for (int i = 0; i < 3; i++) os << measurement().pos1[i] << " ";
181 for (int i = 0; i < 3; i++) os << measurement().normal1[i] << " ";
182
183 return os.good();
184}

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

Member Data Documentation

◆ cov0

Matrix3 g2o::Edge_V_V_GICP::cov0

Definition at line 152 of file types_icp.h.

Referenced by Edge_V_V_GICP().

◆ cov1

Matrix3 g2o::Edge_V_V_GICP::cov1

Definition at line 152 of file types_icp.h.

Referenced by Edge_V_V_GICP().

◆ dRidx

Matrix3 g2o::Edge_V_V_GICP::dRidx
static

Definition at line 217 of file types_icp.h.

Referenced by g2o::types_icp::init(), and linearizeOplus().

◆ dRidy

Matrix3 g2o::Edge_V_V_GICP::dRidy
static

Definition at line 218 of file types_icp.h.

Referenced by g2o::types_icp::init(), and linearizeOplus().

◆ dRidz

Matrix3 g2o::Edge_V_V_GICP::dRidz
static

Definition at line 219 of file types_icp.h.

Referenced by g2o::types_icp::init(), and linearizeOplus().

◆ EIGEN_MAKE_ALIGNED_OPERATOR_NEW

g2o::Edge_V_V_GICP::EIGEN_MAKE_ALIGNED_OPERATOR_NEW

Definition at line 146 of file types_icp.h.

◆ pl_pl

bool g2o::Edge_V_V_GICP::pl_pl

Definition at line 151 of file types_icp.h.

Referenced by Edge_V_V_GICP().


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