g2o
Loading...
Searching...
No Matches
vertex_se3.h
Go to the documentation of this file.
1// g2o - General Graph Optimization
2// Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are
7// met:
8//
9// * Redistributions of source code must retain the above copyright notice,
10// this list of conditions and the following disclaimer.
11// * Redistributions in binary form must reproduce the above copyright
12// notice, this list of conditions and the following disclaimer in the
13// documentation and/or other materials provided with the distribution.
14//
15// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
16// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
18// PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
21// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
27#ifndef G2O_VERTEX_SE3_
28#define G2O_VERTEX_SE3_
29
30#include "g2o/config.h"
34#include "isometry3d_mappings.h"
35
36namespace g2o {
37
50class G2O_TYPES_SLAM3D_API VertexSE3 : public BaseVertex<6, Isometry3> {
51 public:
53
54 static const int orthogonalizeAfter =
55 1000; //< orthogonalize the rotation matrix after N updates
56
57 VertexSE3();
58
59 virtual void setToOriginImpl() { _estimate = Isometry3::Identity(); }
60
61 virtual bool read(std::istream& is);
62 virtual bool write(std::ostream& os) const;
63
64 virtual bool setEstimateDataImpl(const double* est) {
65 Eigen::Map<const Vector7> v(est);
66 _estimate = internal::fromVectorQT(v);
67 return true;
68 }
69
70 virtual bool getEstimateData(double* est) const {
71 Eigen::Map<Vector7> v(est);
72 v = internal::toVectorQT(_estimate);
73 return true;
74 }
75
76 virtual int estimateDimension() const { return 7; }
77
78 virtual bool setMinimalEstimateDataImpl(const double* est) {
79 Eigen::Map<const Vector6> v(est);
80 _estimate = internal::fromVectorMQT(v);
81 return true;
82 }
83
84 virtual bool getMinimalEstimateData(double* est) const {
85 Eigen::Map<Vector6> v(est);
86 v = internal::toVectorMQT(_estimate);
87 return true;
88 }
89
90 virtual int minimalEstimateDimension() const { return 6; }
91
99 virtual void oplusImpl(const double* update) {
100 Eigen::Map<const Vector6> v(update);
101 Isometry3 increment = internal::fromVectorMQT(v);
102 _estimate = _estimate * increment;
103 if (++_numOplusCalls > orthogonalizeAfter) {
104 _numOplusCalls = 0;
105 internal::approximateNearestOrthogonalMatrix(
106 _estimate.matrix().topLeftCorner<3, 3>());
107 }
108 }
109
111 SE3Quat G2O_ATTRIBUTE_DEPRECATED(estimateAsSE3Quat() const) {
112 return internal::toSE3Quat(estimate());
113 }
115 void G2O_ATTRIBUTE_DEPRECATED(setEstimateFromSE3Quat(const SE3Quat& se3)) {
116 setEstimate(internal::fromSE3Quat(se3));
117 }
118
119 protected:
122};
123
134
135#ifdef G2O_HAVE_OPENGL
139class G2O_TYPES_SLAM3D_API VertexSE3DrawAction : public DrawAction {
140 public:
141 VertexSE3DrawAction();
142 virtual HyperGraphElementAction* operator()(
145
146 protected:
147 virtual bool refreshPropertyPtrs(
149 FloatProperty *_triangleX, *_triangleY;
150};
151#endif
152
153} // namespace g2o
154
155#endif
Templatized BaseVertex.
Definition base_vertex.h:51
Abstract action that operates on a graph entity.
write the vertex to some Gnuplot data file
Definition vertex_se3.h:127
virtual HyperGraphElementAction * operator()(HyperGraph::HyperGraphElement *element, HyperGraphElementAction::Parameters *params_)
3D pose Vertex, represented as an Isometry3
Definition vertex_se3.h:50
virtual bool setEstimateDataImpl(const double *est)
Definition vertex_se3.h:64
virtual bool getMinimalEstimateData(double *est) const
Definition vertex_se3.h:84
virtual bool getEstimateData(double *est) const
Definition vertex_se3.h:70
virtual bool setMinimalEstimateDataImpl(const double *est)
Definition vertex_se3.h:78
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition vertex_se3.h:52
virtual void oplusImpl(const double *update)
Definition vertex_se3.h:99
virtual int estimateDimension() const
Definition vertex_se3.h:76
virtual int minimalEstimateDimension() const
Definition vertex_se3.h:90
void G2O_ATTRIBUTE_DEPRECATED(setEstimateFromSE3Quat(const SE3Quat &se3))
wrapper function to use the old SE3 type
Definition vertex_se3.h:115
SE3Quat G2O_ATTRIBUTE_DEPRECATED(estimateAsSE3Quat() const)
wrapper function to use the old SE3 type
Definition vertex_se3.h:111
virtual void setToOriginImpl()
sets the node to the origin (used in the multilevel stuff)
Definition vertex_se3.h:59
#define G2O_TYPES_SLAM3D_API
Eigen::Transform< double, 3, Eigen::Isometry, Eigen::ColMajor > Isometry3
Definition eigen_types.h:77
Property< float > FloatProperty
Definition property.h:150