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-2018, 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 uint8_t CRobotPosesGraph::serializeGetVersion() const { return 0; }
23 void CRobotPosesGraph::serializeTo(mrpt::serialization::CArchive& out) const
24 {
25  uint32_t N = static_cast<uint32_t>(size());
26  out << N;
27  for (const auto& e : *this) out << e.first << e.second.sf << e.second.pdf;
28 }
29 
30 void CRobotPosesGraph::serializeFrom(
32 {
33  switch (version)
34  {
35  case 0:
36  {
37  uint32_t i, N;
38  in >> N;
39  clear();
40 
41  for (i = 0; i < N; i++)
42  {
43  TPoseID poseid;
44  in >> poseid;
45 
46  TPoseInfo& info = (*this)[poseid];
47 
48  in >> info.sf >> info.pdf;
49  }
50  }
51  break;
52  default:
54  };
55 }
56 
57 /*---------------------------------------------------------------
58  insertIntoMetricMap
59  ---------------------------------------------------------------*/
60 void CRobotPosesGraph::insertIntoMetricMap(CMultiMetricMap& metricMap) const
61 {
62  CPose3D meanPose;
64  ++it)
65  {
66  it->second.pdf.getMean(meanPose);
67  it->second.sf.insertObservationsInto(&metricMap, &meanPose);
68  }
69 }
70 
71 /*---------------------------------------------------------------
72  convertIntoSimplemap
73  ---------------------------------------------------------------*/
74 void CRobotPosesGraph::convertIntoSimplemap(CSimpleMap& out_simplemap) const
75 {
76  out_simplemap.clear();
78  ++it)
79  out_simplemap.insert(&it->second.pdf, it->second.sf);
80 }
This class stores a sequence of <Probabilistic Pose,SensoryFrame> pairs, thus a "metric map" can be t...
Definition: CSimpleMap.h:33
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.
uint64_t TPoseID
An integer number uniquely identifying each robot pose stored in HMT-SLAM.
EIGEN_STRONG_INLINE iterator begin()
Definition: eigen_plugins.h:29
STL namespace.
unsigned char uint8_t
Definition: rptypes.h:41
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:90
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...
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:52
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:86
mrpt::obs::CSensoryFrame sf
The observations.
GLuint in
Definition: glext.h:7274
Information kept for each robot pose used in CRobotPosesGraph.
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:136
unsigned __int32 uint32_t
Definition: rptypes.h:47
void clear()
Clear the contents of this container.
Definition: ts_hash_map.h:186
const Scalar * const_iterator
Definition: eigen_plugins.h:27
void clear()
Remove all stored pairs.
Definition: CSimpleMap.cpp:55



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020