g2o
Public Member Functions | Private Member Functions | Private Attributes | List of all members
g2o::deprecated::EdgeSE3PointXYZ Class Reference

#include <edge_se3_pointxyz.h>

Inheritance diagram for g2o::deprecated::EdgeSE3PointXYZ:
Inheritance graph
[legend]
Collaboration diagram for g2o::deprecated::EdgeSE3PointXYZ:
Collaboration graph
[legend]

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW EdgeSE3PointXYZ ()
 
virtual bool read (std::istream &is)
 read the vertex from a stream, i.e., the internal state of the vertex More...
 
virtual bool write (std::ostream &os) const
 write the vertex to a stream More...
 
void computeError ()
 
virtual void linearizeOplus ()
 
virtual void setMeasurement (const Eigen::Vector3d &m)
 
virtual bool setMeasurementData (const double *d)
 
virtual bool getMeasurementData (double *d) const
 
virtual int measurementDimension () const
 
virtual bool setMeasurementFromState ()
 
virtual double initialEstimatePossible (const OptimizableGraph::VertexSet &from, OptimizableGraph::Vertex *to)
 
virtual void initialEstimate (const OptimizableGraph::VertexSet &from, OptimizableGraph::Vertex *to)
 
- Public Member Functions inherited from g2o::BaseBinaryEdge< 3, Eigen::Vector3d, VertexSE3, VertexPointXYZ >
 BaseBinaryEdge ()
 
virtual OptimizableGraph::VertexcreateFrom ()
 
virtual OptimizableGraph::VertexcreateTo ()
 
virtual OptimizableGraph::VertexcreateVertex (int i)
 
virtual void resize (size_t size)
 
virtual bool allVerticesFixed () const
 
virtual void linearizeOplus (JacobianWorkspace &jacobianWorkspace)
 
const JacobianXiOplusTypejacobianOplusXi () const
 returns the result of the linearization in the manifold space for the node xi More...
 
const JacobianXjOplusTypejacobianOplusXj () const
 returns the result of the linearization in the manifold space for the node xj More...
 
virtual void constructQuadraticForm ()
 
virtual void mapHessianMemory (double *d, int i, int j, bool rowMajor)
 
- Public Member Functions inherited from g2o::BaseEdge< D, Eigen::Vector3d >
 BaseEdge ()
 
virtual ~BaseEdge ()
 
virtual double chi2 () const
 computes the chi2 based on the cached error value, only valid after computeError has been called. More...
 
virtual const double * errorData () const
 returns the error vector cached after calling the computeError; More...
 
virtual double * errorData ()
 
const ErrorVectorerror () const
 
ErrorVectorerror ()
 
EIGEN_STRONG_INLINE const InformationTypeinformation () const
 information matrix of the constraint More...
 
EIGEN_STRONG_INLINE InformationTypeinformation ()
 
EIGEN_STRONG_INLINE void setInformation (const InformationType &information)
 
virtual const double * informationData () const
 returns the memory of the information matrix, usable for example with a Eigen::Map<MatrixXD> More...
 
virtual double * informationData ()
 
EIGEN_STRONG_INLINE const Measurementmeasurement () const
 accessor functions for the measurement represented by the edge More...
 
virtual int rank () const
 
- Public Member Functions inherited from g2o::OptimizableGraph::Edge
 Edge ()
 
virtual ~Edge ()
 
virtual Edgeclone () const
 
RobustKernelrobustKernel () const
 if NOT NULL, error of this edge will be robustifed with the kernel More...
 
void setRobustKernel (RobustKernel *ptr)
 
int level () const
 returns the level of the edge More...
 
void setLevel (int l)
 sets the level of the edge More...
 
int dimension () const
 returns the dimensions of the error function More...
 
 G2O_ATTRIBUTE_DEPRECATED (virtual Vertex *createFrom())
 
 G2O_ATTRIBUTE_DEPRECATED (virtual Vertex *createTo())
 
long long internalId () const
 the internal ID of the edge More...
 
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 More...
 
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 ()
 
HyperGraphElementclone () const
 
- Public Member Functions inherited from g2o::HyperGraph::DataContainer
 DataContainer ()
 
virtual ~DataContainer ()
 
const DatauserData () const
 the user data associated with this vertex More...
 
DatauserData ()
 
void setUserData (Data *obs)
 
void addUserData (Data *obs)
 

Private Member Functions

virtual bool resolveCaches ()
 

Private Attributes

Eigen::Matrix< double, 3, 9 > J
 
ParameterSE3OffsetoffsetParam
 
CacheSE3Offsetcache
 

Additional Inherited Members

- Public Types inherited from g2o::BaseBinaryEdge< 3, Eigen::Vector3d, VertexSE3, VertexPointXYZ >
typedef VertexSE3 VertexXiType
 
typedef VertexPointXYZ VertexXjType
 
typedef BaseEdge< D, Eigen::Vector3d >::Measurement Measurement
 
typedef Eigen::Matrix< double, D, Di, D==1?Eigen::RowMajor:Eigen::ColMajor >::AlignedMapType JacobianXiOplusType
 
typedef Eigen::Matrix< double, D, Dj, D==1?Eigen::RowMajor:Eigen::ColMajor >::AlignedMapType JacobianXjOplusType
 
typedef BaseEdge< D, Eigen::Vector3d >::ErrorVector ErrorVector
 
typedef BaseEdge< D, Eigen::Vector3d >::InformationType InformationType
 
typedef Eigen::Map< Eigen::Matrix< double, Di, Dj, Di==1?Eigen::RowMajor:Eigen::ColMajor >, Eigen::Matrix< double, Di, Dj, Di==1?Eigen::RowMajor:Eigen::ColMajor >::Flags &Eigen::AlignedBit?Eigen::Aligned:Eigen::Unaligned > HessianBlockType
 
typedef Eigen::Map< Eigen::Matrix< double, Dj, Di, Dj==1?Eigen::RowMajor:Eigen::ColMajor >, Eigen::Matrix< double, Dj, Di, Dj==1?Eigen::RowMajor:Eigen::ColMajor >::Flags &Eigen::AlignedBit?Eigen::Aligned:Eigen::Unaligned > HessianBlockTransposedType
 
- Public Types inherited from g2o::BaseEdge< D, Eigen::Vector3d >
typedef Eigen::Vector3d Measurement
 
typedef Eigen::Matrix< double, D, 1, Eigen::ColMajor > ErrorVector
 
typedef Eigen::Matrix< double, D, D, Eigen::ColMajor > InformationType
 
- Static Public Attributes inherited from g2o::BaseBinaryEdge< 3, Eigen::Vector3d, VertexSE3, VertexPointXYZ >
static const int Di
 
static const int Dj
 
static const int Dimension
 
- Static Public Attributes inherited from g2o::BaseEdge< D, Eigen::Vector3d >
static const int Dimension
 
- Protected Member Functions inherited from g2o::BaseEdge< D, Eigen::Vector3d >
InformationType robustInformation (const Vector3D &rho)
 
- 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 ()
 
- Protected Attributes inherited from g2o::BaseBinaryEdge< 3, Eigen::Vector3d, VertexSE3, VertexPointXYZ >
bool _hessianRowMajor
 
HessianBlockType _hessian
 
HessianBlockTransposedType _hessianTransposed
 
JacobianXiOplusType _jacobianOplusXi
 
JacobianXjOplusType _jacobianOplusXj
 
- Protected Attributes inherited from g2o::BaseEdge< D, Eigen::Vector3d >
Measurement _measurement
 
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 More...
 
- Protected Attributes inherited from g2o::HyperGraph::DataContainer
Data_userData
 

Detailed Description

Definition at line 44 of file edge_se3_pointxyz.h.

Constructor & Destructor Documentation

g2o::deprecated::EdgeSE3PointXYZ::EdgeSE3PointXYZ ( )

Definition at line 38 of file edge_se3_pointxyz.cpp.

References cache, g2o::BaseEdge< D, Eigen::Vector3d >::information(), g2o::OptimizableGraph::Edge::installParameter(), J, offsetParam, and g2o::OptimizableGraph::Edge::resizeParameters().

38  : BaseBinaryEdge<3, Eigen::Vector3d, VertexSE3, VertexPointXYZ>() {
39  information().setIdentity();
40  J.fill(0);
41  J.block<3,3>(0,0) = -Eigen::Matrix3d::Identity();
42  cache = 0;
43  offsetParam = 0;
46  }
bool installParameter(ParameterType *&p, size_t argNo, int paramId=-1)
void resizeParameters(size_t newSize)
EIGEN_STRONG_INLINE const InformationType & information() const
information matrix of the constraint
Definition: base_edge.h:67
Eigen::Matrix< double, 3, 9 > J

Member Function Documentation

void g2o::deprecated::EdgeSE3PointXYZ::computeError ( )
virtual

Implements g2o::OptimizableGraph::Edge.

Definition at line 92 of file edge_se3_pointxyz.cpp.

References g2o::BaseEdge< D, Eigen::Vector3d >::_error, g2o::BaseEdge< D, Eigen::Vector3d >::_measurement, g2o::HyperGraph::Edge::_vertices, cache, g2o::BaseVertex< D, T >::estimate(), and g2o::deprecated::CacheSE3Offset::w2nMatrix().

92  {
93  // from cam to point (track)
94  //VertexSE3 *cam = static_cast<VertexSE3*>(_vertices[0]);
95  VertexPointXYZ *point = static_cast<VertexPointXYZ*>(_vertices[1]);
96 
97  Eigen::Vector3d perr = cache->w2nMatrix() * point->estimate();
98 
99  // error, which is backwards from the normal observed - calculated
100  // _measurement is the measured projection
101  _error = perr - _measurement;
102  // std::cout << _error << std::endl << std::endl;
103  }
const Eigen::Isometry3d & w2nMatrix() const
VertexContainer _vertices
Definition: hyper_graph.h:202
virtual bool g2o::deprecated::EdgeSE3PointXYZ::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 67 of file edge_se3_pointxyz.h.

67  {
68  Eigen::Map<Eigen::Vector3d> v(d);
69  v=_measurement;
70  return true;
71  }
void g2o::deprecated::EdgeSE3PointXYZ::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, Eigen::Vector3d >.

Definition at line 149 of file edge_se3_pointxyz.cpp.

References g2o::BaseEdge< D, Eigen::Vector3d >::_measurement, g2o::HyperGraph::Edge::_vertices, g2o::deprecated::ParameterSE3Offset::offsetMatrix(), offsetParam, and g2o::BaseVertex< D, T >::setEstimate().

150  {
151  (void) from;
152  assert(from.size() == 1 && from.count(_vertices[0]) == 1 && "Can not initialize VertexDepthCam position by VertexTrackXYZ");
153 
154  VertexSE3 *cam = dynamic_cast<VertexSE3*>(_vertices[0]);
155  VertexPointXYZ *point = dynamic_cast<VertexPointXYZ*>(_vertices[1]);
156  // SE3OffsetCache* vcache = (SE3OffsetCache* ) cam->getCache(_cacheIds[0]);
157  // if (! vcache){
158  // cerr << "fatal error in retrieving cache" << endl;
159  // }
160  // SE3OffsetParameters* params=vcache->params;
161  const Eigen::Vector3d& p=_measurement;
162  point->setEstimate(cam->estimate() * (offsetParam->offsetMatrix() * p));
163  }
const Eigen::Isometry3d & offsetMatrix() const
rotation of the offset as 3x3 rotation matrix
VertexContainer _vertices
Definition: hyper_graph.h:202
virtual double g2o::deprecated::EdgeSE3PointXYZ::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.

Definition at line 77 of file edge_se3_pointxyz.h.

78  {
79  (void) to;
80  return (from.count(_vertices[0]) == 1 ? 1.0 : -1.0);
81  }
VertexContainer _vertices
Definition: hyper_graph.h:202
void g2o::deprecated::EdgeSE3PointXYZ::linearizeOplus ( )
virtual

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

Reimplemented from g2o::BaseBinaryEdge< 3, Eigen::Vector3d, VertexSE3, VertexPointXYZ >.

Definition at line 105 of file edge_se3_pointxyz.cpp.

References g2o::BaseBinaryEdge< 3, Eigen::Vector3d, VertexSE3, VertexPointXYZ >::_jacobianOplusXi, g2o::BaseBinaryEdge< 3, Eigen::Vector3d, VertexSE3, VertexPointXYZ >::_jacobianOplusXj, g2o::HyperGraph::Edge::_vertices, cache, g2o::BaseVertex< D, T >::estimate(), g2o::deprecated::ParameterSE3Offset::inverseOffsetMatrix(), J, offsetParam, and g2o::deprecated::CacheSE3Offset::w2lMatrix().

105  {
106  //VertexSE3 *cam = static_cast<VertexSE3 *>(_vertices[0]);
107  VertexPointXYZ *vp = static_cast<VertexPointXYZ *>(_vertices[1]);
108 
109  Eigen::Vector3d Zcam = cache->w2lMatrix() * vp->estimate();
110 
111  // J(0,3) = -0.0;
112  J(0,4) = -2*Zcam(2);
113  J(0,5) = 2*Zcam(1);
114 
115  J(1,3) = 2*Zcam(2);
116  // J(1,4) = -0.0;
117  J(1,5) = -2*Zcam(0);
118 
119  J(2,3) = -2*Zcam(1);
120  J(2,4) = 2*Zcam(0);
121  // J(2,5) = -0.0;
122 
123  J.block<3,3>(0,6) = cache->w2lMatrix().rotation();
124 
125  Eigen::Matrix<double,3,9> Jhom = offsetParam->inverseOffsetMatrix().rotation() * J;
126 
127  _jacobianOplusXi = Jhom.block<3,6>(0,0);
128  _jacobianOplusXj = Jhom.block<3,3>(0,6);
129  }
const Eigen::Isometry3d & inverseOffsetMatrix() const
rotation of the inverse offset as 3x3 rotation matrix
const Eigen::Isometry3d & w2lMatrix() const
Eigen::Matrix< double, 3, 9 > J
VertexContainer _vertices
Definition: hyper_graph.h:202
virtual int g2o::deprecated::EdgeSE3PointXYZ::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 73 of file edge_se3_pointxyz.h.

73 {return 3;}
bool g2o::deprecated::EdgeSE3PointXYZ::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 56 of file edge_se3_pointxyz.cpp.

References g2o::BaseEdge< D, Eigen::Vector3d >::information(), setMeasurement(), and g2o::OptimizableGraph::Edge::setParameterId().

56  {
57  int pId;
58  is >> pId;
59  setParameterId(0, pId);
60  // measured keypoint
61  Eigen::Vector3d meas;
62  for (int i=0; i<3; i++) is >> meas[i];
63  setMeasurement(meas);
64  // information matrix is the identity for features, could be changed to allow arbitrary covariances
65  if (is.bad()) {
66  return false;
67  }
68  for ( int i=0; i<information().rows() && is.good(); i++)
69  for (int j=i; j<information().cols() && is.good(); j++){
70  is >> information()(i,j);
71  if (i!=j)
72  information()(j,i)=information()(i,j);
73  }
74  if (is.bad()) {
75  // we overwrite the information matrix
76  information().setIdentity();
77  }
78  return true;
79  }
bool setParameterId(int argNum, int paramId)
virtual void setMeasurement(const Eigen::Vector3d &m)
EIGEN_STRONG_INLINE const InformationType & information() const
information matrix of the constraint
Definition: base_edge.h:67
bool g2o::deprecated::EdgeSE3PointXYZ::resolveCaches ( )
privatevirtual

Reimplemented from g2o::OptimizableGraph::Edge.

Definition at line 48 of file edge_se3_pointxyz.cpp.

References g2o::HyperGraph::Edge::_vertices, cache, offsetParam, and g2o::OptimizableGraph::Edge::resolveCache().

48  {
49  ParameterVector pv(1);
50  pv[0]=offsetParam;
51  resolveCache(cache, (OptimizableGraph::Vertex*)_vertices[0],"CACHE_SE3_OFFSET",pv);
52  return cache != 0;
53  }
class G2O_CORE_API Vertex
void resolveCache(CacheType *&cache, OptimizableGraph::Vertex *, const std::string &_type, const ParameterVector &parameters)
Definition: cache.h:122
std::vector< Parameter * > ParameterVector
Definition: parameter.h:52
VertexContainer _vertices
Definition: hyper_graph.h:202
virtual void g2o::deprecated::EdgeSE3PointXYZ::setMeasurement ( const Eigen::Vector3d &  m)
inlinevirtual

Reimplemented from g2o::BaseEdge< D, Eigen::Vector3d >.

Definition at line 57 of file edge_se3_pointxyz.h.

Referenced by read().

57  {
58  _measurement = m;
59  }
virtual bool g2o::deprecated::EdgeSE3PointXYZ::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 61 of file edge_se3_pointxyz.h.

61  {
62  Eigen::Map<const Eigen::Vector3d> v(d);
63  _measurement = v;
64  return true;
65  }
bool g2o::deprecated::EdgeSE3PointXYZ::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.

Definition at line 132 of file edge_se3_pointxyz.cpp.

References g2o::BaseEdge< D, Eigen::Vector3d >::_measurement, g2o::HyperGraph::Edge::_vertices, cache, g2o::BaseVertex< D, T >::estimate(), and g2o::deprecated::CacheSE3Offset::w2nMatrix().

132  {
133  //VertexSE3 *cam = static_cast<VertexSE3*>(_vertices[0]);
134  VertexPointXYZ *point = static_cast<VertexPointXYZ*>(_vertices[1]);
135 
136  // calculate the projection
137  const Eigen::Vector3d &pt = point->estimate();
138  // SE3OffsetCache* vcache = (SE3OffsetCache*) cam->getCache(_cacheIds[0]);
139  // if (! vcache){
140  // cerr << "fatal error in retrieving cache" << endl;
141  // }
142 
143  Eigen::Vector3d perr = cache->w2nMatrix() * pt;
144  _measurement = perr;
145  return true;
146  }
const Eigen::Isometry3d & w2nMatrix() const
VertexContainer _vertices
Definition: hyper_graph.h:202
bool g2o::deprecated::EdgeSE3PointXYZ::write ( std::ostream &  os) const
virtual

write the vertex to a stream

Implements g2o::OptimizableGraph::Edge.

Definition at line 81 of file edge_se3_pointxyz.cpp.

References g2o::Parameter::id(), g2o::BaseEdge< D, Eigen::Vector3d >::information(), g2o::BaseEdge< D, Eigen::Vector3d >::measurement(), and offsetParam.

81  {
82  os << offsetParam->id() << " ";
83  for (int i=0; i<3; i++) os << measurement()[i] << " ";
84  for (int i=0; i<information().rows(); i++)
85  for (int j=i; j<information().cols(); j++) {
86  os << information()(i,j) << " ";
87  }
88  return os.good();
89  }
int id() const
Definition: parameter.h:45
EIGEN_STRONG_INLINE const InformationType & information() const
information matrix of the constraint
Definition: base_edge.h:67
EIGEN_STRONG_INLINE const Measurement & measurement() const
accessor functions for the measurement represented by the edge
Definition: base_edge.h:75

Member Data Documentation

CacheSE3Offset* g2o::deprecated::EdgeSE3PointXYZ::cache
private
Eigen::Matrix<double,3,9> g2o::deprecated::EdgeSE3PointXYZ::J
private

Definition at line 86 of file edge_se3_pointxyz.h.

Referenced by EdgeSE3PointXYZ(), and linearizeOplus().

ParameterSE3Offset* g2o::deprecated::EdgeSE3PointXYZ::offsetParam
private

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