Main MRPT website > C++ reference for MRPT 1.5.6
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 #include <mrpt/slam/link_pragmas.h>
18 
19 namespace mrpt
20 {
21  namespace slam
22  {
23  namespace detail
24  {
25  using namespace mrpt;
26  using namespace mrpt::math;
27  using namespace std;
28 
29  /** Auxiliary structure used in KLD-sampling in particle filters \sa CPosePDFParticles, CMultiMetricMapPDF */
31  {
32  TPoseBin2D() : x(0),y(0),phi(0) { }
33 
34  int x,y,phi; //!< Bin indices
35 
36  /** less-than ordering of bins for usage in STL containers */
38  {
39  inline bool operator()(const TPoseBin2D& s1, const TPoseBin2D& s2) const
40  {
41  if (s1.x < s2.x) return true;
42  if (s1.x > s2.x) return false;
43  if (s1.y < s2.y) return true;
44  if (s1.y > s2.y) return false;
45  return s1.phi<s2.phi;
46  }
47  };
48  };
49 
50  /** Auxiliary structure */
52  {
53  std::vector<TPoseBin2D> bins;
54 
55  /** less-than ordering of bins for usage in STL containers */
57  {
58  bool operator()(const TPathBin2D& s1, const TPathBin2D& s2) const
59  {
60  ASSERT_(s1.bins.size()==s2.bins.size())
61  for (size_t i=0;i<s1.bins.size();i++)
62  {
63  if (s1.bins[i].x < s2.bins[i].x) return true;
64  if (s1.bins[i].x > s2.bins[i].x) return false;
65  if (s1.bins[i].y < s2.bins[i].y) return true;
66  if (s1.bins[i].y > s2.bins[i].y) return false;
67  if (s1.bins[i].phi < s2.bins[i].phi) return true;
68  if (s1.bins[i].phi > s2.bins[i].phi) return false;
69  // else, keep comparing:
70  }
71  return false; // If they're exactly equal, s1 is NOT < s2.
72  }
73  };
74  };
75 
76  /** Auxiliary structure used in KLD-sampling in particle filters \sa CPosePDFParticles, CMultiMetricMapPDF */
78  {
79  TPoseBin3D() : x(0),y(0),z(0),yaw(0),pitch(0),roll(0) { }
80 
81  int x,y,z,yaw,pitch,roll; //!< Bin indices
82 
83  /** less-than ordering of bins for usage in STL containers */
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 
104  } // End of namespace
105  } // End of namespace
106 } // End of namespace
107 
108 #endif
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1166
less-than ordering of bins for usage in STL containers
bool operator()(const TPathBin2D &s1, const TPathBin2D &s2) const
less-than ordering of bins for usage in STL containers
bool operator()(const TPoseBin3D &s1, const TPoseBin3D &s2) const
Auxiliary structure.
GLint GLint GLint GLint GLint x
Definition: glew.h:1166
Auxiliary structure used in KLD-sampling in particle filters.
Auxiliary structure used in KLD-sampling in particle filters.
GLdouble GLdouble z
Definition: glew.h:1464
less-than ordering of bins for usage in STL containers
#define ASSERT_(f)
std::vector< TPoseBin2D > bins
bool operator()(const TPoseBin2D &s1, const TPoseBin2D &s2) const



Page generated by Doxygen 1.8.6 for MRPT 1.5.6 Git: 4c65e84 Tue Apr 24 08:18:17 2018 +0200 at mar abr 24 08:26:17 CEST 2018