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
mrpt::slam::detail::TPoseBin3D::pitch
int pitch
Definition: PF_aux_structs.h:80
mrpt::slam::detail::TPoseBin3D::TPoseBin3D
TPoseBin3D()
Definition: PF_aux_structs.h:78
mrpt::slam::detail::TPoseBin2D::lt_operator::operator()
bool operator()(const TPoseBin2D &s1, const TPoseBin2D &s2) const
Definition: PF_aux_structs.h:37
mrpt::obs::gnss::roll
double roll
Definition: gnss_messages_novatel.h:264
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::slam::detail::TPoseBin2D::y
int y
Definition: PF_aux_structs.h:32
ASSERT_
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:113
mrpt::slam::detail::TPathBin2D
Auxiliary structure
Definition: PF_aux_structs.h:49
mrpt::slam::detail::TPoseBin2D::phi
int phi
Definition: PF_aux_structs.h:32
mrpt::slam::detail::TPoseBin3D::lt_operator::operator()
bool operator()(const TPoseBin3D &s1, const TPoseBin3D &s2) const
Definition: PF_aux_structs.h:85
mrpt::slam::detail::TPathBin2D::lt_operator
less-than ordering of bins for usage in STL containers
Definition: PF_aux_structs.h:54
mrpt::slam::detail::TPoseBin3D::z
int z
Definition: PF_aux_structs.h:80
mrpt::slam::detail::TPoseBin3D::lt_operator
less-than ordering of bins for usage in STL containers
Definition: PF_aux_structs.h:83
mrpt::slam::detail::TPoseBin3D::roll
int roll
Definition: PF_aux_structs.h:80
mrpt::slam::detail::TPoseBin2D
Auxiliary structure used in KLD-sampling in particle filters.
Definition: PF_aux_structs.h:28
mrpt::slam::detail::TPoseBin3D
Auxiliary structure used in KLD-sampling in particle filters.
Definition: PF_aux_structs.h:76
mrpt::slam::detail::TPoseBin2D::x
int x
Bin indices.
Definition: PF_aux_structs.h:32
mrpt::slam::detail::TPoseBin2D::lt_operator
less-than ordering of bins for usage in STL containers
Definition: PF_aux_structs.h:35
mrpt::obs::gnss::pitch
double pitch
Definition: gnss_messages_novatel.h:264
mrpt::slam::detail::TPathBin2D::bins
std::vector< TPoseBin2D > bins
Definition: PF_aux_structs.h:51
mrpt::slam::detail::TPoseBin3D::x
int x
Bin indices.
Definition: PF_aux_structs.h:80
mrpt::slam::detail::TPoseBin3D::y
int y
Definition: PF_aux_structs.h:80
mrpt::math
This base provides a set of functions for maths stuff.
Definition: math/include/mrpt/math/bits_math.h:13
z
GLdouble GLdouble z
Definition: glext.h:3872
mrpt::slam::detail::TPoseBin2D::TPoseBin2D
TPoseBin2D()
Definition: PF_aux_structs.h:30
mrpt::slam::detail::TPathBin2D::lt_operator::operator()
bool operator()(const TPathBin2D &s1, const TPathBin2D &s2) const
Definition: PF_aux_structs.h:56
mrpt::slam::detail::TPoseBin3D::yaw
int yaw
Definition: PF_aux_structs.h:80
y
GLenum GLint GLint y
Definition: glext.h:3538
x
GLenum GLint x
Definition: glext.h:3538



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST