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
13#include <vector>
14#include <iostream>
15#include <iterator>
16
18
19namespace 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
#define ASSERT_(f)
Definition: mrpt_macros.h:261
This base provides a set of functions for maths stuff.
Definition: CArray.h:19
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
STL namespace.
less-than ordering of bins for usage in STL containers
bool operator()(const TPathBin2D &s1, const TPathBin2D &s2) const
std::vector< TPoseBin2D > bins
less-than ordering of bins for usage in STL containers
bool operator()(const TPoseBin2D &s1, const TPoseBin2D &s2) const
Auxiliary structure used in KLD-sampling in particle filters.
less-than ordering of bins for usage in STL containers
bool operator()(const TPoseBin3D &s1, const TPoseBin3D &s2) const
Auxiliary structure used in KLD-sampling in particle filters.



Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Wed Mar 22 09:54:56 UTC 2023