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