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

#include <types_icp.h>

Inheritance diagram for g2o::Edge_V_V_GICP:
Collaboration diagram for g2o::Edge_V_V_GICP:

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, EdgeGICP, 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, EdgeGICP >
 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 void setMeasurement (const Measurement &m)
virtual int rank () const
virtual void initialEstimate (const OptimizableGraph::VertexSet &, OptimizableGraph::Vertex *)
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 ()
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
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)
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
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, EdgeGICP, 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, EdgeGICP >
static constexpr int Dimension

Additional Inherited Members

Public Types inherited from g2o::BaseBinaryEdge< 3, EdgeGICP, VertexSE3, VertexSE3 >
using VertexXiType
using VertexXjType
Public Types inherited from g2o::BaseFixedSizedEdge< D, EdgeGICP, VertexSE3, VertexSE3 >
using NthType
using VertexXnType
 The type of the N-th vertex.
typedef BaseEdge< D, EdgeGICP >::Measurement Measurement
typedef BaseEdge< D, EdgeGICP >::ErrorVector ErrorVector
typedef BaseEdge< D, EdgeGICP >::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, EdgeGICP >
typedef EdgeGICP Measurement
typedef internal::BaseEdgeTraits< D >::ErrorVector ErrorVector
typedef internal::BaseEdgeTraits< D >::InformationType InformationType
Static Public Member Functions inherited from g2o::BaseFixedSizedEdge< D, EdgeGICP, VertexSE3, VertexSE3 >
static constexpr int VertexDimension ()
 Size of the N-th vertex at compile time.
Protected Member Functions inherited from g2o::BaseEdge< D, EdgeGICP >
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, VertexSE3::Dimension > & _jacobianOplusXi
BaseFixedSizedEdge< D, EdgeGICP, VertexSE3, VertexSE3 >::template JacobianType< D, VertexSE3::Dimension > & _jacobianOplusXj
Protected Attributes inherited from g2o::BaseFixedSizedEdge< D, EdgeGICP, VertexSE3, VertexSE3 >
HessianRowMajorStorage _hessianRowMajor
HessianTuple _hessianTuple
HessianTupleTransposed _hessianTupleTransposed
std::tuple< JacobianType< D, VertexTypes::Dimension >... > _jacobianOplus
Protected Attributes inherited from g2o::BaseEdge< D, EdgeGICP >
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) {}

References pl_pl.

Referenced by Edge_V_V_GICP().

◆ 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.

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}
VertexContainer _vertices
class G2O_CORE_API Vertex
Definition hyper_graph.h:74

References g2o::BaseEdge< D, EdgeGICP >::_measurement, g2o::HyperGraph::Edge::_vertices, g2o::BaseBinaryEdge< 3, EdgeGICP, VertexSE3, VertexSE3 >::BaseBinaryEdge(), cov0, cov1, Edge_V_V_GICP(), 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, VertexSE3::Dimension > & _jacobianOplusXj
BaseFixedSizedEdge< D, EdgeGICP, VertexSE3, VertexSE3 >::template JacobianType< D, VertexSE3::Dimension > & _jacobianOplusXi
EIGEN_STRONG_INLINE const Measurement & measurement() const
Definition base_edge.h:119
EIGEN_STRONG_INLINE const InformationType & information() const
Definition base_edge.h:107
Vector3 pos1
Definition types_icp.h:62
Vector3 pos0
Definition types_icp.h:62
MatrixN< 3 > Matrix3
Definition eigen_types.h:72
VectorN< 3 > Vector3
Definition eigen_types.h:51
void transform(PlaneList &l, const SE3Quat &t)

References g2o::BaseEdge< D, EdgeGICP >::_error, g2o::BaseBinaryEdge< 3, EdgeGICP, VertexSE3, VertexSE3 >::_jacobianOplusXi, g2o::BaseBinaryEdge< 3, EdgeGICP, VertexSE3, VertexSE3 >::_jacobianOplusXj, g2o::HyperGraph::Edge::_vertices, cov0, cov1, g2o::BaseVertex< D, T >::estimate(), g2o::BaseEdge< D, EdgeGICP >::information(), g2o::BaseEdge< D, EdgeGICP >::measurement(), pl_pl, and transform().

◆ linearizeOplus()

void g2o::Edge_V_V_GICP::linearizeOplus ( )
virtual

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(), g2o::BaseEdge< D, EdgeGICP >::measurement(), and g2o::EdgeGICP::pos1.

◆ 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}
Matrix3 R0
Definition types_icp.h:68
constexpr double cst(long double v)
Definition misc.h:60

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

◆ 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}
Vector3 normal1
Definition types_icp.h:65
Vector3 normal0
Definition types_icp.h:65

References g2o::BaseEdge< D, EdgeGICP >::measurement(), g2o::EdgeGICP::normal0, g2o::EdgeGICP::normal1, g2o::EdgeGICP::pos0, and g2o::EdgeGICP::pos1.

Member Data Documentation

◆ cov0

Matrix3 g2o::Edge_V_V_GICP::cov0

Definition at line 152 of file types_icp.h.

Referenced by computeError(), and Edge_V_V_GICP().

◆ cov1

Matrix3 g2o::Edge_V_V_GICP::cov1

Definition at line 152 of file types_icp.h.

Referenced by computeError(), and 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 computeError(), Edge_V_V_GICP(), and Edge_V_V_GICP().


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