Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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
mrpt::slam::detail::TPoseBin3D::pitch
int pitch
Definition: PF_aux_structs.h:81
mrpt::slam::detail::TPoseBin3D::TPoseBin3D
TPoseBin3D()
Definition: PF_aux_structs.h:79
mrpt::slam::detail::TPoseBin2D::lt_operator::operator()
bool operator()(const TPoseBin2D &s1, const TPoseBin2D &s2) const
Definition: PF_aux_structs.h:39
utils_defs.h
mrpt::obs::gnss::roll
double roll
Definition: gnss_messages_novatel.h:204
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::slam::detail::TPoseBin2D::y
int y
Definition: PF_aux_structs.h:34
mrpt::slam::detail::TPathBin2D
Auxiliary structure
Definition: PF_aux_structs.h:51
mrpt::slam::detail::TPoseBin2D::phi
int phi
Bin indices.
Definition: PF_aux_structs.h:34
mrpt::slam::detail::TPoseBin3D::lt_operator::operator()
bool operator()(const TPoseBin3D &s1, const TPoseBin3D &s2) const
Definition: PF_aux_structs.h:86
mrpt::slam::detail::TPathBin2D::lt_operator
less-than ordering of bins for usage in STL containers
Definition: PF_aux_structs.h:56
mrpt::slam::detail::TPoseBin3D::z
int z
Definition: PF_aux_structs.h:81
mrpt::slam::detail::TPoseBin3D::lt_operator
less-than ordering of bins for usage in STL containers
Definition: PF_aux_structs.h:84
mrpt::slam::detail::TPoseBin3D::roll
int roll
Bin indices.
Definition: PF_aux_structs.h:81
mrpt::slam::detail::TPoseBin2D
Auxiliary structure used in KLD-sampling in particle filters.
Definition: PF_aux_structs.h:30
mrpt::slam::detail::TPoseBin3D
Auxiliary structure used in KLD-sampling in particle filters.
Definition: PF_aux_structs.h:77
mrpt::slam::detail::TPoseBin2D::x
int x
Definition: PF_aux_structs.h:34
mrpt::slam::detail::TPoseBin2D::lt_operator
less-than ordering of bins for usage in STL containers
Definition: PF_aux_structs.h:37
mrpt::obs::gnss::pitch
double pitch
Definition: gnss_messages_novatel.h:204
mrpt::slam::detail::TPathBin2D::bins
std::vector< TPoseBin2D > bins
Definition: PF_aux_structs.h:53
mrpt::slam::detail::TPoseBin3D::x
int x
Definition: PF_aux_structs.h:81
mrpt::slam::detail::TPoseBin3D::y
int y
Definition: PF_aux_structs.h:81
mrpt::math
This base provides a set of functions for maths stuff.
Definition: CArray.h:18
ASSERT_
#define ASSERT_(f)
Definition: mrpt_macros.h:261
mrpt::slam::detail::TPoseBin2D::TPoseBin2D
TPoseBin2D()
Definition: PF_aux_structs.h:32
mrpt::slam::detail::TPathBin2D::lt_operator::operator()
bool operator()(const TPathBin2D &s1, const TPathBin2D &s2) const
Definition: PF_aux_structs.h:58
mrpt::slam::detail::TPoseBin3D::yaw
int yaw
Definition: PF_aux_structs.h:81



Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 23:11:08 UTC 2019