g2o
Toggle main menu visibility
Loading...
Searching...
No Matches
g2o
examples
tutorial_slam2d
simulator.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_SIMULATOR_H
28
#define G2O_SIMULATOR_H
29
30
#include <map>
31
#include <vector>
32
33
#include "
g2o_tutorial_slam2d_api.h
"
34
#include "
se2.h
"
35
36
namespace
g2o
{
37
namespace
tutorial
{
38
39
class
G2O_TUTORIAL_SLAM2D_API
Simulator
{
40
public
:
41
enum
G2O_TUTORIAL_SLAM2D_API
MotionType {
MO_LEFT
,
MO_RIGHT
, MO_NUM_ELEMS };
42
46
struct
G2O_TUTORIAL_SLAM2D_API
Landmark
{
47
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
;
48
int
id
;
49
Eigen::Vector2d
truePose
;
50
Eigen::Vector2d
simulatedPose
;
51
std::vector<int>
seenBy
;
52
Landmark
() :
id
(-1) {}
53
};
54
using
LandmarkVector
= std::vector<Landmark>;
55
using
LandmarkPtrVector
= std::vector<Landmark*>;
56
60
struct
G2O_TUTORIAL_SLAM2D_API
GridPose
{
61
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
;
62
int
id
;
63
SE2
truePose
;
64
SE2
simulatorPose
;
65
LandmarkPtrVector
landmarks
;
66
};
67
using
PosesVector
= std::vector<GridPose>;
68
72
struct
G2O_TUTORIAL_SLAM2D_API
GridEdge
{
73
int
from
;
74
int
to
;
75
SE2
trueTransf
;
76
SE2
simulatorTransf
;
77
Eigen::Matrix3d
information
;
78
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
;
79
};
80
using
GridEdgeVector
= std::vector<GridEdge>;
81
82
struct
G2O_TUTORIAL_SLAM2D_API
LandmarkEdge
{
83
int
from
;
84
int
to
;
85
Eigen::Vector2d
trueMeas
;
86
Eigen::Vector2d
simulatorMeas
;
87
Eigen::Matrix2d
information
;
88
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
;
89
};
90
using
LandmarkEdgeVector
= std::vector<LandmarkEdge>;
91
92
public
:
93
Simulator
();
94
~Simulator
();
95
96
void
simulate
(
int
numPoses,
const
SE2
& sensorOffset =
SE2
());
97
98
const
PosesVector
&
poses
()
const
{
return
_poses
; }
99
const
LandmarkVector
&
landmarks
()
const
{
return
_landmarks
; }
100
const
GridEdgeVector
&
odometry
()
const
{
return
_odometry
; }
101
const
LandmarkEdgeVector
&
landmarkObservations
()
const
{
102
return
_landmarkObservations
;
103
}
104
105
protected
:
106
PosesVector
_poses
;
107
LandmarkVector
_landmarks
;
108
GridEdgeVector
_odometry
;
109
LandmarkEdgeVector
_landmarkObservations
;
110
111
GridPose
generateNewPose
(
const
GridPose
& prev,
const
SE2
& trueMotion,
112
const
Eigen::Vector2d& transNoise,
double
rotNoise);
113
SE2
getMotion
(
int
motionDirection,
double
stepLen);
114
SE2
sampleTransformation
(
const
SE2
& trueMotion_,
115
const
Eigen::Vector2d& transNoise,
double
rotNoise);
116
};
117
118
}
// namespace tutorial
119
}
// namespace g2o
120
121
#endif
g2o::tutorial::SE2
Definition
se2.h:42
g2o::tutorial::Simulator::Simulator
Simulator()
Definition
simulator.cpp:50
g2o::tutorial::Simulator::GridEdgeVector
std::vector< GridEdge > GridEdgeVector
Definition
simulator.h:80
g2o::tutorial::Simulator::sampleTransformation
SE2 sampleTransformation(const SE2 &trueMotion_, const Eigen::Vector2d &transNoise, double rotNoise)
Definition
simulator.cpp:315
g2o::tutorial::Simulator::poses
const PosesVector & poses() const
Definition
simulator.h:98
g2o::tutorial::Simulator::_poses
PosesVector _poses
Definition
simulator.h:106
g2o::tutorial::Simulator::generateNewPose
GridPose generateNewPose(const GridPose &prev, const SE2 &trueMotion, const Eigen::Vector2d &transNoise, double rotNoise)
Definition
simulator.cpp:292
g2o::tutorial::Simulator::LandmarkPtrVector
std::vector< Landmark * > LandmarkPtrVector
Definition
simulator.h:55
g2o::tutorial::Simulator::simulate
void simulate(int numPoses, const SE2 &sensorOffset=SE2())
Definition
simulator.cpp:57
g2o::tutorial::Simulator::PosesVector
std::vector< GridPose > PosesVector
Definition
simulator.h:67
g2o::tutorial::Simulator::landmarkObservations
const LandmarkEdgeVector & landmarkObservations() const
Definition
simulator.h:101
g2o::tutorial::Simulator::_landmarks
LandmarkVector _landmarks
Definition
simulator.h:107
g2o::tutorial::Simulator::_landmarkObservations
LandmarkEdgeVector _landmarkObservations
Definition
simulator.h:109
g2o::tutorial::Simulator::landmarks
const LandmarkVector & landmarks() const
Definition
simulator.h:99
g2o::tutorial::Simulator::odometry
const GridEdgeVector & odometry() const
Definition
simulator.h:100
g2o::tutorial::Simulator::LandmarkVector
std::vector< Landmark > LandmarkVector
Definition
simulator.h:54
g2o::tutorial::Simulator::getMotion
SE2 getMotion(int motionDirection, double stepLen)
Definition
simulator.cpp:303
g2o::tutorial::Simulator::LandmarkEdgeVector
std::vector< LandmarkEdge > LandmarkEdgeVector
Definition
simulator.h:90
g2o::tutorial::Simulator::_odometry
GridEdgeVector _odometry
Definition
simulator.h:108
se2.h
MO_LEFT
MO_LEFT
Definition
simulator.h:41
MO_RIGHT
MO_RIGHT
Definition
simulator.h:41
g2o_tutorial_slam2d_api.h
G2O_TUTORIAL_SLAM2D_API
#define G2O_TUTORIAL_SLAM2D_API
Definition
g2o_tutorial_slam2d_api.h:55
g2o::tutorial
Definition
edge_se2.cpp:32
g2o
Definition
dl_wrapper.cpp:55
g2o::tutorial::Simulator::GridEdge
odometry constraint
Definition
simulator.h:72
g2o::tutorial::Simulator::GridEdge::simulatorTransf
SE2 simulatorTransf
Definition
simulator.h:76
g2o::tutorial::Simulator::GridEdge::information
Eigen::Matrix3d information
Definition
simulator.h:77
g2o::tutorial::Simulator::GridEdge::from
int from
Definition
simulator.h:73
g2o::tutorial::Simulator::GridEdge::trueTransf
SE2 trueTransf
Definition
simulator.h:75
g2o::tutorial::Simulator::GridEdge::EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition
simulator.h:78
g2o::tutorial::Simulator::GridEdge::to
int to
Definition
simulator.h:74
g2o::tutorial::Simulator::GridPose
Definition
simulator.h:60
g2o::tutorial::Simulator::GridPose::simulatorPose
SE2 simulatorPose
Definition
simulator.h:64
g2o::tutorial::Simulator::GridPose::id
int id
Definition
simulator.h:62
g2o::tutorial::Simulator::GridPose::truePose
SE2 truePose
Definition
simulator.h:63
g2o::tutorial::Simulator::GridPose::landmarks
LandmarkPtrVector landmarks
the landmarks observed by this node
Definition
simulator.h:65
g2o::tutorial::Simulator::GridPose::EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition
simulator.h:61
g2o::tutorial::Simulator::LandmarkEdge
Definition
simulator.h:82
g2o::tutorial::Simulator::LandmarkEdge::trueMeas
Eigen::Vector2d trueMeas
Definition
simulator.h:85
g2o::tutorial::Simulator::LandmarkEdge::from
int from
Definition
simulator.h:83
g2o::tutorial::Simulator::LandmarkEdge::simulatorMeas
Eigen::Vector2d simulatorMeas
Definition
simulator.h:86
g2o::tutorial::Simulator::LandmarkEdge::information
Eigen::Matrix2d information
Definition
simulator.h:87
g2o::tutorial::Simulator::LandmarkEdge::EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition
simulator.h:88
g2o::tutorial::Simulator::LandmarkEdge::to
int to
Definition
simulator.h:84
g2o::tutorial::Simulator::Landmark::seenBy
std::vector< int > seenBy
Definition
simulator.h:51
g2o::tutorial::Simulator::Landmark::simulatedPose
Eigen::Vector2d simulatedPose
Definition
simulator.h:50
g2o::tutorial::Simulator::Landmark::id
int id
Definition
simulator.h:48
g2o::tutorial::Simulator::Landmark::truePose
Eigen::Vector2d truePose
Definition
simulator.h:49
g2o::tutorial::Simulator::Landmark::Landmark
Landmark()
Definition
simulator.h:52
g2o::tutorial::Simulator::Landmark::EIGEN_MAKE_ALIGNED_OPERATOR_NEW
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
Definition
simulator.h:47
Generated on
for g2o by
1.17.0