Main MRPT website > C++ reference for MRPT 1.9.9
CRobotPosesGraph.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "hmtslam-precomp.h" // Precomp header
11 
13 
14 using namespace mrpt::slam;
15 using namespace mrpt::maps;
16 using namespace mrpt::poses;
17 using namespace mrpt::hmtslam;
18 using namespace std;
19 
21 
22 /*---------------------------------------------------------------
23  writeToStream
24  ---------------------------------------------------------------*/
25 void CRobotPosesGraph::writeToStream(
26  mrpt::utils::CStream& out, int* version) const
27 {
28  if (version)
29  *version = 0;
30  else
31  {
32  uint32_t N = static_cast<uint32_t>(size());
33  out << N;
34 
36  it != end(); ++it)
37  {
38  out << it->first << it->second.sf << it->second.pdf;
39  }
40  }
41 }
42 
43 /*---------------------------------------------------------------
44  readFromStream
45  ---------------------------------------------------------------*/
46 void CRobotPosesGraph::readFromStream(mrpt::utils::CStream& in, int version)
47 {
48  switch (version)
49  {
50  case 0:
51  {
52  uint32_t i, N;
53  in >> N;
54  clear();
55 
56  for (i = 0; i < N; i++)
57  {
58  TPoseID poseid;
59  in >> poseid;
60 
61  TPoseInfo& info = (*this)[poseid];
62 
63  in >> info.sf >> info.pdf;
64  }
65  }
66  break;
67  default:
69  };
70 }
71 
72 /*---------------------------------------------------------------
73  insertIntoMetricMap
74  ---------------------------------------------------------------*/
75 void CRobotPosesGraph::insertIntoMetricMap(CMultiMetricMap& metricMap) const
76 {
77  CPose3D meanPose;
79  ++it)
80  {
81  it->second.pdf.getMean(meanPose);
82  it->second.sf.insertObservationsInto(&metricMap, &meanPose);
83  }
84 }
85 
86 /*---------------------------------------------------------------
87  convertIntoSimplemap
88  ---------------------------------------------------------------*/
89 void CRobotPosesGraph::convertIntoSimplemap(CSimpleMap& out_simplemap) const
90 {
91  out_simplemap.clear();
93  ++it)
94  out_simplemap.insert(&it->second.pdf, it->second.sf);
95 }
This class stores a sequence of <Probabilistic Pose,SensoryFrame> pairs, thus a "metric map" can be t...
Definition: CSimpleMap.h:35
Classes related to the implementation of Hybrid Metric Topological (HMT) SLAM.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
mrpt::poses::CPose3DPDFParticles pdf
The robot pose PDF.
EIGEN_STRONG_INLINE iterator begin()
Definition: eigen_plugins.h:29
STL namespace.
const Scalar * const_iterator
Definition: eigen_plugins.h:27
uint64_t TPoseID
An integer number uniquely identifying each robot pose stored in HMT-SLAM.
void clear()
Clear the contents of this container.
Definition: ts_hash_map.h:189
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
GLuint GLuint end
Definition: glext.h:3528
Auxiliary class used in mrpt::slam::CLocalMetricHypothesis for HMT-SLAM; this class stores a set of r...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
Definition: CPoint.h:17
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::obs::CSensoryFrame sf
The observations.
GLuint in
Definition: glext.h:7274
Information kept for each robot pose used in CRobotPosesGraph.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
GLsizeiptr size
Definition: glext.h:3923
This class stores any customizable set of metric maps.
void insert(const mrpt::poses::CPose3DPDF *in_posePDF, const mrpt::obs::CSensoryFrame &in_SF)
Add a new pair to the sequence.
Definition: CSimpleMap.cpp:177
unsigned __int32 uint32_t
Definition: rptypes.h:47
void clear()
Remove all stored pairs.
Definition: CSimpleMap.cpp:70



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019