g2o
Toggle main menu visibility
Loading...
Searching...
No Matches
g2o
types
sclam2d
edge_se2_odom_differential_calib.cpp
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
#include "
edge_se2_odom_differential_calib.h
"
28
29
#ifdef G2O_HAVE_OPENGL
30
#include "
g2o/stuff/opengl_wrapper.h
"
31
#endif
32
33
namespace
g2o
{
34
35
EdgeSE2OdomDifferentialCalib::EdgeSE2OdomDifferentialCalib
()
36
:
BaseFixedSizedEdge
<3,
VelocityMeasurement
,
VertexSE2
,
VertexSE2
,
37
VertexOdomDifferentialParams
>() {}
38
39
bool
EdgeSE2OdomDifferentialCalib::read
(std::istream& is) {
40
double
vl, vr, dt;
41
is >> vl >> vr >> dt;
42
VelocityMeasurement
vm(vl, vr, dt);
43
setMeasurement
(vm);
44
return
readInformationMatrix
(is);
45
}
46
47
bool
EdgeSE2OdomDifferentialCalib::write
(std::ostream& os)
const
{
48
os <<
measurement
().
vl
() <<
" "
<<
measurement
().
vr
() <<
" "
49
<<
measurement
().
dt
() <<
" "
;
50
return
writeInformationMatrix
(os);
51
}
52
53
#ifdef G2O_HAVE_OPENGL
54
EdgeSE2OdomDifferentialCalibDrawAction::EdgeSE2OdomDifferentialCalibDrawAction()
55
:
DrawAction
(typeid(
EdgeSE2OdomDifferentialCalib
).name()) {}
56
57
HyperGraphElementAction* EdgeSE2OdomDifferentialCalibDrawAction::operator()(
58
HyperGraph::HyperGraphElement* element,
59
HyperGraphElementAction::Parameters*) {
60
if
(
typeid
(*element).name() != _typeName)
return
nullptr
;
61
EdgeSE2OdomDifferentialCalib* e =
62
static_cast<
EdgeSE2OdomDifferentialCalib*
>
(element);
63
VertexSE2* fromEdge =
static_cast<
VertexSE2*
>
(e->vertex(0));
64
VertexSE2* toEdge =
static_cast<
VertexSE2*
>
(e->vertex(1));
65
glColor3f(0.5f, 0.5f, 0.5f);
66
glPushAttrib(GL_ENABLE_BIT);
67
glDisable(GL_LIGHTING);
68
glBegin(GL_LINES);
69
glVertex3f((
float
)fromEdge->estimate().translation().x(),
70
(
float
)fromEdge->estimate().translation().y(), 0.f);
71
glVertex3f((
float
)toEdge->estimate().translation().x(),
72
(
float
)toEdge->estimate().translation().y(), 0.f);
73
glEnd();
74
glPopAttrib();
75
return
this
;
76
}
77
#endif
78
79
}
// namespace g2o
g2o::BaseEdge< D, VelocityMeasurement >::writeInformationMatrix
bool writeInformationMatrix(std::ostream &os) const
Definition
base_edge.h:165
g2o::BaseEdge< D, VelocityMeasurement >::readInformationMatrix
bool readInformationMatrix(std::istream &is)
Definition
base_edge.h:173
g2o::BaseEdge< D, VelocityMeasurement >::measurement
EIGEN_STRONG_INLINE const Measurement & measurement() const
Definition
base_edge.h:119
g2o::BaseEdge< D, VelocityMeasurement >::setMeasurement
virtual void setMeasurement(const Measurement &m)
Definition
base_edge.h:122
g2o::BaseFixedSizedEdge< 3, VelocityMeasurement, VertexSE2, VertexSE2, VertexOdomDifferentialParams >::BaseFixedSizedEdge
BaseFixedSizedEdge()
Definition
base_fixed_sized_edge.h:208
g2o::DrawAction
draw actions
Definition
hyper_graph_action.h:201
g2o::EdgeSE2OdomDifferentialCalib
Definition
edge_se2_odom_differential_calib.h:40
g2o::EdgeSE2OdomDifferentialCalib::write
virtual bool write(std::ostream &os) const
write the vertex to a stream
Definition
edge_se2_odom_differential_calib.cpp:47
g2o::EdgeSE2OdomDifferentialCalib::EdgeSE2OdomDifferentialCalib
EdgeSE2OdomDifferentialCalib()
Definition
edge_se2_odom_differential_calib.cpp:35
g2o::EdgeSE2OdomDifferentialCalib::read
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
Definition
edge_se2_odom_differential_calib.cpp:39
g2o::VelocityMeasurement
velocity measurement of a differential robot
Definition
odometry_measurement.h:40
g2o::VelocityMeasurement::vr
double vr() const
Definition
odometry_measurement.h:49
g2o::VelocityMeasurement::dt
double dt() const
Definition
odometry_measurement.h:52
g2o::VelocityMeasurement::vl
double vl() const
Definition
odometry_measurement.h:46
g2o::VertexOdomDifferentialParams
Definition
vertex_odom_differential_params.h:36
g2o::VertexSE2
2D pose Vertex, (x,y,theta)
Definition
vertex_se2.h:41
edge_se2_odom_differential_calib.h
g2o
Definition
dl_wrapper.cpp:55
opengl_wrapper.h
Generated on
for g2o by
1.17.0