Main MRPT website > C++ reference for MRPT 1.9.9
PF_aux_structs.h
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 #ifndef PF_aux_structs_H
10 #define PF_aux_structs_H
11 
12 #include <mrpt/utils/utils_defs.h>
13 #include <vector>
14 #include <iostream>
15 #include <iterator>
16 
17 namespace mrpt
18 {
19 namespace slam
20 {
21 namespace detail
22 {
23 using namespace mrpt;
24 using namespace mrpt::math;
25 using namespace std;
26 
27 /** Auxiliary structure used in KLD-sampling in particle filters \sa
28  * CPosePDFParticles, CMultiMetricMapPDF */
29 struct TPoseBin2D
30 {
31  TPoseBin2D() : x(0), y(0), phi(0) {}
32  /** Bin indices */
33  int x, y, phi;
34 
35  /** less-than ordering of bins for usage in STL containers */
36  struct lt_operator
37  {
38  inline bool operator()(const TPoseBin2D& s1, const TPoseBin2D& s2) const
39  {
40  if (s1.x < s2.x) return true;
41  if (s1.x > s2.x) return false;
42  if (s1.y < s2.y) return true;
43  if (s1.y > s2.y) return false;
44  return s1.phi < s2.phi;
45  }
46  };
47 };
48 
49 /** Auxiliary structure */
50 struct TPathBin2D
51 {
52  std::vector<TPoseBin2D> bins;
53 
54  /** less-than ordering of bins for usage in STL containers */
55  struct lt_operator
56  {
57  bool operator()(const TPathBin2D& s1, const TPathBin2D& s2) const
58  {
59  ASSERT_(s1.bins.size() == s2.bins.size())
60  for (size_t i = 0; i < s1.bins.size(); i++)
61  {
62  if (s1.bins[i].x < s2.bins[i].x) return true;
63  if (s1.bins[i].x > s2.bins[i].x) return false;
64  if (s1.bins[i].y < s2.bins[i].y) return true;
65  if (s1.bins[i].y > s2.bins[i].y) return false;
66  if (s1.bins[i].phi < s2.bins[i].phi) return true;
67  if (s1.bins[i].phi > s2.bins[i].phi) return false;
68  // else, keep comparing:
69  }
70  return false; // If they're exactly equal, s1 is NOT < s2.
71  }
72  };
73 };
74 
75 /** Auxiliary structure used in KLD-sampling in particle filters \sa
76  * CPosePDFParticles, CMultiMetricMapPDF */
77 struct TPoseBin3D
78 {
79  TPoseBin3D() : x(0), y(0), z(0), yaw(0), pitch(0), roll(0) {}
80  /** Bin indices */
81  int x, y, z, yaw, pitch, roll;
82 
83  /** less-than ordering of bins for usage in STL containers */
84  struct lt_operator
85  {
86  bool operator()(const TPoseBin3D& s1, const TPoseBin3D& s2) const
87  {
88  if (s1.x < s2.x) return true;
89  if (s1.x > s2.x) return false;
90  if (s1.y < s2.y) return true;
91  if (s1.y > s2.y) return false;
92  if (s1.z < s2.z) return true;
93  if (s1.z > s2.z) return false;
94  if (s1.yaw < s2.yaw) return true;
95  if (s1.yaw > s2.yaw) return false;
96  if (s1.pitch < s2.pitch) return true;
97  if (s1.pitch > s2.pitch) return false;
98  return s1.roll < s2.roll;
99  }
100  };
101 };
102 
103 } // End of namespace
104 } // End of namespace
105 } // End of namespace
106 
107 #endif
GLdouble GLdouble z
Definition: glext.h:3872
less-than ordering of bins for usage in STL containers
less-than ordering of bins for usage in STL containers
STL namespace.
bool operator()(const TPathBin2D &s1, const TPathBin2D &s2) const
This base provides a set of functions for maths stuff.
Definition: CArrayNumeric.h:19
Auxiliary structure.
bool operator()(const TPoseBin3D &s1, const TPoseBin3D &s2) const
Auxiliary structure used in KLD-sampling in particle filters.
Auxiliary structure used in KLD-sampling in particle filters.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
less-than ordering of bins for usage in STL containers
#define ASSERT_(f)
GLenum GLint GLint y
Definition: glext.h:3538
std::vector< TPoseBin2D > bins
GLenum GLint x
Definition: glext.h:3538
bool operator()(const TPoseBin2D &s1, const TPoseBin2D &s2) const



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