g2o
Toggle main menu visibility
Loading...
Searching...
No Matches
g2o
types
slam2d_addons
edge_se2_line2d.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_line2d.h
"
28
29
#include <cassert>
30
31
namespace
g2o
{
32
33
EdgeSE2Line2D::EdgeSE2Line2D
()
34
:
BaseBinaryEdge
<2,
Line2D
,
VertexSE2
,
VertexLine2D
>() {}
35
36
bool
EdgeSE2Line2D::read
(std::istream& is) {
37
internal::readVector
(is,
_measurement
);
38
return
readInformationMatrix
(is);
39
}
40
41
bool
EdgeSE2Line2D::write
(std::ostream& os)
const
{
42
internal::writeVector
(os,
measurement
());
43
return
writeInformationMatrix
(os);
44
}
45
46
void
EdgeSE2Line2D::initialEstimate
(
const
OptimizableGraph::VertexSet
& from,
47
OptimizableGraph::Vertex
* to) {
48
assert(from.size() == 1 && from.count(
_vertices
[0]) == 1 &&
49
"Can not initialize VertexSE2 position by VertexLine2D"
);
50
51
VertexSE2
* vi =
static_cast<
VertexSE2
*
>
(
_vertices
[0]);
52
VertexLine2D
* vj =
static_cast<
VertexLine2D
*
>
(
_vertices
[1]);
53
if
(from.count(vi) > 0 && to == vj) {
54
SE2
T = vi->
estimate
();
55
Vector2
est =
_measurement
;
56
est[0] += T.
rotation
().angle();
57
est[0] =
normalize_theta
(est[0]);
58
Vector2
n(std::cos(est[0]), std::sin(est[0]));
59
est[1] += n.dot(T.
translation
());
60
vj->
setEstimate
(est);
61
}
62
}
63
64
}
// namespace g2o
g2o::BaseBinaryEdge< 2, Line2D, VertexSE2, VertexLine2D >::BaseBinaryEdge
BaseBinaryEdge()
Definition
base_binary_edge.h:41
g2o::BaseEdge< D, Line2D >::writeInformationMatrix
bool writeInformationMatrix(std::ostream &os) const
Definition
base_edge.h:165
g2o::BaseEdge< D, Line2D >::readInformationMatrix
bool readInformationMatrix(std::istream &is)
Definition
base_edge.h:173
g2o::BaseEdge< D, Line2D >::measurement
EIGEN_STRONG_INLINE const Measurement & measurement() const
Definition
base_edge.h:119
g2o::BaseEdge< D, Line2D >::_measurement
Measurement _measurement
Definition
base_edge.h:146
g2o::BaseVertex::estimate
const EstimateType & estimate() const
return the current estimate of the vertex
Definition
base_vertex.h:127
g2o::BaseVertex::setEstimate
void setEstimate(const EstimateType &et)
set the estimate for the vertex also calls updateCache()
Definition
base_vertex.h:129
g2o::EdgeSE2Line2D::read
virtual bool read(std::istream &is)
read the vertex from a stream, i.e., the internal state of the vertex
Definition
edge_se2_line2d.cpp:36
g2o::EdgeSE2Line2D::EdgeSE2Line2D
EIGEN_MAKE_ALIGNED_OPERATOR_NEW EdgeSE2Line2D()
Definition
edge_se2_line2d.cpp:33
g2o::EdgeSE2Line2D::initialEstimate
virtual void initialEstimate(const OptimizableGraph::VertexSet &from, OptimizableGraph::Vertex *to)
Definition
edge_se2_line2d.cpp:46
g2o::EdgeSE2Line2D::write
virtual bool write(std::ostream &os) const
write the vertex to a stream
Definition
edge_se2_line2d.cpp:41
g2o::HyperGraph::Edge::_vertices
VertexContainer _vertices
Definition
hyper_graph.h:221
g2o::HyperGraph::VertexSet
std::set< Vertex * > VertexSet
Definition
hyper_graph.h:142
g2o::OptimizableGraph::Vertex
A general case Vertex for optimization.
Definition
optimizable_graph.h:108
g2o::SE2
represent SE2
Definition
se2.h:43
g2o::SE2::translation
const Vector2 & translation() const
translational component
Definition
se2.h:57
g2o::SE2::rotation
const Rotation2D & rotation() const
rotational component
Definition
se2.h:61
g2o::VertexLine2D
Definition
vertex_line2d.h:40
g2o::VertexSE2
2D pose Vertex, (x,y,theta)
Definition
vertex_se2.h:41
edge_se2_line2d.h
g2o::internal::writeVector
bool writeVector(std::ostream &os, const Eigen::DenseBase< Derived > &b)
Definition
io_helper.h:36
g2o::internal::readVector
bool readVector(std::istream &is, Eigen::DenseBase< Derived > &b)
Definition
io_helper.h:42
g2o
Definition
dl_wrapper.cpp:55
g2o::normalize_theta
double normalize_theta(double theta)
Definition
misc.h:103
g2o::Vector2
VectorN< 2 > Vector2
Definition
eigen_types.h:50
g2o::Line2D
Definition
line_2d.h:38
Generated on
for g2o by
1.17.0