g2o
targetTypes3D.hpp
Go to the documentation of this file.
1 #ifndef G2O_TARGET_TYPES_3D_HPP_
2 #define G2O_TARGET_TYPES_3D_HPP_
3 
4 #include <g2o/core/base_vertex.h>
6 #include <Eigen/Core>
7 
8 // This header file specifies a set of types for the different
9 // tracking examples; note that
10 
11 class VertexPosition3D : public g2o::BaseVertex<3, Eigen::Vector3d>
12 {
13 public:
14  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
16  {
17  }
18 
19  virtual void setToOriginImpl() {
20  _estimate.setZero();
21  }
22 
23  virtual void oplusImpl(const double* update)
24  {
25  _estimate[0] += update[0];
26  _estimate[1] += update[1];
27  _estimate[2] += update[2];
28  }
29 
30  virtual bool read(std::istream& /*is*/)
31  {
32  return false;
33  }
34 
35  virtual bool write(std::ostream& /*os*/) const
36  {
37  return false;
38  }
39 
40 };
41 
42 
43 // Store velocity separately from position?
44 class VertexVelocity3D : public g2o::BaseVertex<3, Eigen::Vector3d>
45 {
46 public:
47  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
49  {
50  }
51 
52  virtual void setToOriginImpl() {
53  _estimate.setZero();
54  }
55 
56  virtual void oplusImpl(const double* update)
57  {
58  _estimate[0] += update[0];
59  _estimate[1] += update[1];
60  _estimate[2] += update[2];
61  }
62 
63  virtual bool read(std::istream& /*is*/)
64  {
65  return false;
66  }
67 
68  virtual bool write(std::ostream& /*os*/) const
69  {
70  return false;
71  }
72 
73 };
74 
75 // The idealised GPS measurement; this is 3D and linear
76 class GPSObservationPosition3DEdge : public g2o::BaseUnaryEdge<3, Eigen::Vector3d, VertexPosition3D>
77 {
78 public:
80  {
81  }
82 
83  void computeError()
84  {
85  const VertexPosition3D* v = static_cast<const VertexPosition3D*>(_vertices[0]);
86  _error = v->estimate() - _measurement;
87  }
88 
89  virtual bool read(std::istream& /*is*/)
90  {
91  return false;
92  }
93 
94  virtual bool write(std::ostream& /*os*/) const
95  {
96  return false;
97  }
98 };
99 
100 #endif // __TARGET_TYPES_3D_HPP__
EIGEN_MAKE_ALIGNED_OPERATOR_NEW VertexPosition3D()
virtual void oplusImpl(const double *update)
virtual void setToOriginImpl()
sets the node to the origin (used in the multilevel stuff)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW VertexVelocity3D()
virtual void oplusImpl(const double *update)
Templatized BaseVertex.
Definition: base_vertex.h:50
virtual bool read(std::istream &)
read the vertex from a stream, i.e., the internal state of the vertex
virtual void setToOriginImpl()
sets the node to the origin (used in the multilevel stuff)
virtual bool read(std::istream &)
read the vertex from a stream, i.e., the internal state of the vertex
virtual bool read(std::istream &)
read the vertex from a stream, i.e., the internal state of the vertex
virtual bool write(std::ostream &) const
write the vertex to a stream
const EstimateType & estimate() const
return the current estimate of the vertex
Definition: base_vertex.h:99
virtual bool write(std::ostream &) const
write the vertex to a stream
virtual bool write(std::ostream &) const
write the vertex to a stream