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 
17 {
18 using namespace mrpt;
19 using namespace mrpt::math;
20 using namespace std;
21 
22 /** Auxiliary structure used in KLD-sampling in particle filters \sa
23  * CPosePDFParticles, CMultiMetricMapPDF */
24 struct TPoseBin2D
25 {
26  TPoseBin2D() : x(0), y(0), phi(0) {}
27  /** Bin indices */
28  int x, y, phi;
29 
30  /** less-than ordering of bins for usage in STL containers */
31  struct lt_operator
32  {
33  inline bool operator()(const TPoseBin2D& s1, const TPoseBin2D& s2) const
34  {
35  if (s1.x < s2.x) return true;
36  if (s1.x > s2.x) return false;
37  if (s1.y < s2.y) return true;
38  if (s1.y > s2.y) return false;
39  return s1.phi < s2.phi;
40  }
41  };
42 };
43 
44 /** Auxiliary structure */
45 struct TPathBin2D
46 {
47  std::vector<TPoseBin2D> bins;
48 
49  /** less-than ordering of bins for usage in STL containers */
50  struct lt_operator
51  {
52  bool operator()(const TPathBin2D& s1, const TPathBin2D& s2) const
53  {
54  ASSERT_(s1.bins.size() == s2.bins.size());
55  for (size_t i = 0; i < s1.bins.size(); i++)
56  {
57  if (s1.bins[i].x < s2.bins[i].x) return true;
58  if (s1.bins[i].x > s2.bins[i].x) return false;
59  if (s1.bins[i].y < s2.bins[i].y) return true;
60  if (s1.bins[i].y > s2.bins[i].y) return false;
61  if (s1.bins[i].phi < s2.bins[i].phi) return true;
62  if (s1.bins[i].phi > s2.bins[i].phi) return false;
63  // else, keep comparing:
64  }
65  return false; // If they're exactly equal, s1 is NOT < s2.
66  }
67  };
68 };
69 
70 /** Auxiliary structure used in KLD-sampling in particle filters \sa
71  * CPosePDFParticles, CMultiMetricMapPDF */
72 struct TPoseBin3D
73 {
74  TPoseBin3D() : x(0), y(0), z(0), yaw(0), pitch(0), roll(0) {}
75  /** Bin indices */
76  int x, y, z, yaw, pitch, roll;
77 
78  /** less-than ordering of bins for usage in STL containers */
79  struct lt_operator
80  {
81  bool operator()(const TPoseBin3D& s1, const TPoseBin3D& s2) const
82  {
83  if (s1.x < s2.x) return true;
84  if (s1.x > s2.x) return false;
85  if (s1.y < s2.y) return true;
86  if (s1.y > s2.y) return false;
87  if (s1.z < s2.z) return true;
88  if (s1.z > s2.z) return false;
89  if (s1.yaw < s2.yaw) return true;
90  if (s1.yaw > s2.yaw) return false;
91  if (s1.pitch < s2.pitch) return true;
92  if (s1.pitch > s2.pitch) return false;
93  return s1.roll < s2.roll;
94  }
95  };
96 };
97 
98 }
99 #endif
100 
101 
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: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020