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

#include <edge_se2_pointxy_offset.h>

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

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW EdgeSE2PointXYOffset ()
 
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 Vector2D &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< 2, Vector2D, VertexSE2, VertexPointXY >
 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, Vector2D >
 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

ParameterSE2OffsetoffsetParam
 
CacheSE2Offsetcache
 

Additional Inherited Members

- Public Types inherited from g2o::BaseBinaryEdge< 2, Vector2D, VertexSE2, VertexPointXY >
typedef VertexSE2 VertexXiType
 
typedef VertexPointXY VertexXjType
 
typedef BaseEdge< D, Vector2D >::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, Vector2D >::ErrorVector ErrorVector
 
typedef BaseEdge< D, Vector2D >::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, Vector2D >
typedef Vector2D 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< 2, Vector2D, VertexSE2, VertexPointXY >
static const int Di
 
static const int Dj
 
static const int Dimension
 
- Static Public Attributes inherited from g2o::BaseEdge< D, Vector2D >
static const int Dimension
 
- Protected Member Functions inherited from g2o::BaseEdge< D, Vector2D >
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< 2, Vector2D, VertexSE2, VertexPointXY >
bool _hessianRowMajor
 
HessianBlockType _hessian
 
HessianBlockTransposedType _hessianTransposed
 
JacobianXiOplusType _jacobianOplusXi
 
JacobianXjOplusType _jacobianOplusXj
 
- Protected Attributes inherited from g2o::BaseEdge< D, Vector2D >
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_se2_pointxy_offset.h.

Constructor & Destructor Documentation

g2o::EdgeSE2PointXYOffset::EdgeSE2PointXYOffset ( )

Definition at line 36 of file edge_se2_pointxy_offset.cpp.

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

36  : BaseBinaryEdge<2, Vector2D, VertexSE2, VertexPointXY>() {
37  information().setIdentity();
38  cache = 0;
39  offsetParam = 0;
42  }
bool installParameter(ParameterType *&p, size_t argNo, int paramId=-1)
ParameterSE2Offset * offsetParam
void resizeParameters(size_t newSize)
EIGEN_STRONG_INLINE const InformationType & information() const
information matrix of the constraint
Definition: base_edge.h:67

Member Function Documentation

void g2o::EdgeSE2PointXYOffset::computeError ( )
virtual

Implements g2o::OptimizableGraph::Edge.

Definition at line 89 of file edge_se2_pointxy_offset.cpp.

References g2o::BaseEdge< D, Vector2D >::_error, g2o::BaseEdge< D, Vector2D >::_measurement, g2o::HyperGraph::Edge::_vertices, cache, g2o::BaseVertex< D, T >::estimate(), and g2o::CacheSE2Offset::w2lMatrix().

89  {
90  // from cam to point (track)
91  // VertexSE2 *rob = static_cast<VertexSE2*>(_vertices[0]);
92  VertexPointXY *point = static_cast<VertexPointXY*>(_vertices[1]);
93 
94  Vector2D perr = cache->w2lMatrix() * point->estimate();
95 
96  // error, which is backwards from the normal observed - calculated
97  // _measurement is the measured projection
98  _error = perr - _measurement;
99  // std::cout << _error << std::endl << std::endl;
100  }
Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
Definition: eigen_types.h:45
const Isometry2D & w2lMatrix() const
VertexContainer _vertices
Definition: hyper_graph.h:202
virtual bool g2o::EdgeSE2PointXYOffset::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_se2_pointxy_offset.h.

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

Definition at line 122 of file edge_se2_pointxy_offset.cpp.

References g2o::BaseEdge< D, Vector2D >::_measurement, g2o::HyperGraph::Edge::_vertices, g2o::ParameterSE2Offset::offsetMatrix(), offsetParam, and g2o::BaseVertex< D, T >::setEstimate().

123  {
124  (void) from;
125  assert(from.size() == 1 && from.count(_vertices[0]) == 1 && "Can not initialize VertexDepthCam position by VertexTrackXY");
126 
127  VertexSE2 *cam = dynamic_cast<VertexSE2*>(_vertices[0]);
128  VertexPointXY *point = dynamic_cast<VertexPointXY*>(_vertices[1]);
129  // SE2OffsetCache* vcache = (SE2OffsetCache* ) cam->getCache(_cacheIds[0]);
130  // if (! vcache){
131  // cerr << "fatal error in retrieving cache" << endl;
132  // }
133  // SE2OffsetParameters* params=vcache->params;
135  point->setEstimate(cam->estimate() * (offsetParam->offsetMatrix() * p));
136  }
Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
Definition: eigen_types.h:45
const Isometry2D & offsetMatrix() const
rotation of the offset as 2x2 rotation matrix
ParameterSE2Offset * offsetParam
VertexContainer _vertices
Definition: hyper_graph.h:202
virtual double g2o::EdgeSE2PointXYOffset::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_se2_pointxy_offset.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::EdgeSE2PointXYOffset::linearizeOplus ( )
virtual

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

Reimplemented from g2o::BaseBinaryEdge< 2, Vector2D, VertexSE2, VertexPointXY >.

Definition at line 102 of file edge_se2_pointxy_offset.cpp.

References g2o::BaseBinaryEdge< 2, Vector2D, VertexSE2, VertexPointXY >::_jacobianOplusXi, g2o::BaseBinaryEdge< 2, Vector2D, VertexSE2, VertexPointXY >::_jacobianOplusXj, g2o::HyperGraph::Edge::_vertices, cache, g2o::BaseVertex< D, T >::estimate(), g2o::CacheSE2Offset::RpInverseRInverseMatrix(), g2o::CacheSE2Offset::RpInverseRInversePrimeMatrix(), and g2o::SE2::translation().

102  {
103  VertexSE2 *rob = static_cast<VertexSE2*>(_vertices[0]);
104  VertexPointXY *point = static_cast<VertexPointXY*>(_vertices[1]);
105  _jacobianOplusXi.block<2,2>(0,0) = - cache->RpInverseRInverseMatrix();
106  _jacobianOplusXi.block<2,1>(0,2) = cache->RpInverseRInversePrimeMatrix()*(point->estimate()-rob->estimate().translation());
108  }
const Matrix2D RpInverseRInversePrimeMatrix() const
const Matrix2D RpInverseRInverseMatrix() const
VertexContainer _vertices
Definition: hyper_graph.h:202
virtual int g2o::EdgeSE2PointXYOffset::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_se2_pointxy_offset.h.

73 {return 3;}
bool g2o::EdgeSE2PointXYOffset::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 52 of file edge_se2_pointxy_offset.cpp.

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

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

Reimplemented from g2o::OptimizableGraph::Edge.

Definition at line 44 of file edge_se2_pointxy_offset.cpp.

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

44  {
45  ParameterVector pv(1);
46  pv[0]=offsetParam;
47  resolveCache(cache, (OptimizableGraph::Vertex*)_vertices[0],"CACHE_SE2_OFFSET",pv);
48  return cache != 0;
49  }
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
ParameterSE2Offset * offsetParam
VertexContainer _vertices
Definition: hyper_graph.h:202
virtual void g2o::EdgeSE2PointXYOffset::setMeasurement ( const Vector2D m)
inlinevirtual

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

Definition at line 57 of file edge_se2_pointxy_offset.h.

Referenced by g2o::SensorPointXYOffset::addNoise(), and read().

57  {
58  _measurement = m;
59  }
virtual bool g2o::EdgeSE2PointXYOffset::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_se2_pointxy_offset.h.

61  {
62  Eigen::Map<const Vector2D> v(d);
63  _measurement = v;
64  return true;
65  }
bool g2o::EdgeSE2PointXYOffset::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 111 of file edge_se2_pointxy_offset.cpp.

References g2o::BaseEdge< D, Vector2D >::_measurement, g2o::HyperGraph::Edge::_vertices, cache, g2o::BaseVertex< D, T >::estimate(), and g2o::CacheSE2Offset::w2lMatrix().

Referenced by g2o::SensorPointXYOffset::sense().

111  {
112  VertexPointXY *point = static_cast<VertexPointXY*>(_vertices[1]);
113 
114  const Vector2D &pt = point->estimate();
115 
116  Vector2D perr = cache->w2lMatrix() * pt;
117  _measurement = perr;
118  return true;
119  }
Eigen::Matrix< double, 2, 1, Eigen::ColMajor > Vector2D
Definition: eigen_types.h:45
const Isometry2D & w2lMatrix() const
VertexContainer _vertices
Definition: hyper_graph.h:202
bool g2o::EdgeSE2PointXYOffset::write ( std::ostream &  os) const
virtual

write the vertex to a stream

Implements g2o::OptimizableGraph::Edge.

Definition at line 77 of file edge_se2_pointxy_offset.cpp.

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

77  {
78  cerr <<"W";
79  os << offsetParam->id() << " ";
80  for (int i=0; i<2; i++) os << measurement()[i] << " ";
81  for (int i=0; i<information().rows(); i++)
82  for (int j=i; j<information().cols(); j++) {
83  os << information()(i,j) << " ";
84  }
85  return os.good();
86  }
int id() const
Definition: parameter.h:45
ParameterSE2Offset * offsetParam
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

CacheSE2Offset* g2o::EdgeSE2PointXYOffset::cache
private
ParameterSE2Offset* g2o::EdgeSE2PointXYOffset::offsetParam
private

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