Main MRPT website
>
C++ reference
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
mrpt
slam
PF_aux_structs.h
Go to the documentation of this file.
1
/* +---------------------------------------------------------------------------+
2
| The Mobile Robot Programming Toolkit (MRPT) C++ library |
3
| |
4
| http://www.mrpt.org/ |
5
| |
6
| Copyright (C) 2005-2012 University of Malaga |
7
| |
8
| This software was written by the Machine Perception and Intelligent |
9
| Robotics Lab, University of Malaga (Spain). |
10
| Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11
| |
12
| This file is part of the MRPT project. |
13
| |
14
| MRPT is free software: you can redistribute it and/or modify |
15
| it under the terms of the GNU General Public License as published by |
16
| the Free Software Foundation, either version 3 of the License, or |
17
| (at your option) any later version. |
18
| |
19
| MRPT is distributed in the hope that it will be useful, |
20
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
21
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22
| GNU General Public License for more details. |
23
| |
24
| You should have received a copy of the GNU General Public License |
25
| along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26
| |
27
+---------------------------------------------------------------------------+ */
28
#ifndef PF_aux_structs_H
29
#define PF_aux_structs_H
30
31
#include <
mrpt/utils/utils_defs.h
>
32
#include <vector>
33
#include <iostream>
34
#include <iterator>
35
36
#include <
mrpt/slam/link_pragmas.h
>
37
38
namespace
mrpt
39
{
40
namespace
slam
41
{
42
namespace
detail
43
{
44
using namespace
mrpt;
45
using namespace
mrpt::math;
46
using namespace
std;
47
48
/** Auxiliary structure used in KLD-sampling in particle filters \sa CPosePDFParticles, CMultiMetricMapPDF */
49
struct
SLAM_IMPEXP
TPoseBin2D
50
{
51
TPoseBin2D
() : x(0),y(0),phi(0) { }
52
53
int
x,
y
,phi;
//!< Bin indices
54
55
/** less-than ordering of bins for usage in STL containers */
56
struct
SLAM_IMPEXP
lt_operator
57
{
58
inline
bool
operator()(
const
TPoseBin2D
& s1,
const
TPoseBin2D
& s2)
const
59
{
60
if
(s1.
x
< s2.
x
)
return
true
;
61
if
(s1.
x
> s2.
x
)
return
false
;
62
if
(s1.
y
< s2.
y
)
return
true
;
63
if
(s1.
y
> s2.
y
)
return
false
;
64
return
s1.
phi
<s2.
phi
;
65
}
66
};
67
};
68
69
/** Auxiliary structure */
70
struct
SLAM_IMPEXP
TPathBin2D
71
{
72
std::vector<TPoseBin2D>
bins
;
73
74
/** less-than ordering of bins for usage in STL containers */
75
struct
SLAM_IMPEXP
lt_operator
76
{
77
bool
operator()(
const
TPathBin2D
& s1,
const
TPathBin2D
& s2)
const
78
{
79
ASSERT_
(s1.
bins
.size()==s2.
bins
.size())
80
for
(
size_t
i=0;i<s1.
bins
.size();i++)
81
{
82
if
(s1.
bins
[i].x < s2.
bins
[i].x)
return
true
;
83
if
(s1.
bins
[i].x > s2.
bins
[i].x)
return
false
;
84
if
(s1.
bins
[i].y < s2.
bins
[i].y)
return
true
;
85
if
(s1.
bins
[i].y > s2.
bins
[i].y)
return
false
;
86
if
(s1.
bins
[i].phi < s2.
bins
[i].phi)
return
true
;
87
if
(s1.
bins
[i].phi > s2.
bins
[i].phi)
return
false
;
88
// else, keep comparing:
89
}
90
return
false
;
// If they're exactly equal, s1 is NOT < s2.
91
}
92
};
93
};
94
95
/** Auxiliary structure used in KLD-sampling in particle filters \sa CPosePDFParticles, CMultiMetricMapPDF */
96
struct
SLAM_IMPEXP
TPoseBin3D
97
{
98
TPoseBin3D
() : x(0),y(0),z(0),yaw(0),pitch(0),roll(0) { }
99
100
int
x,y,
z
,yaw,pitch,roll;
//!< Bin indices
101
102
/** less-than ordering of bins for usage in STL containers */
103
struct
SLAM_IMPEXP
lt_operator
104
{
105
bool
operator()(
const
TPoseBin3D
& s1,
const
TPoseBin3D
& s2)
const
106
{
107
if
(s1.
x
< s2.
x
)
return
true
;
108
if
(s1.
x
> s2.
x
)
return
false
;
109
if
(s1.
y
< s2.
y
)
return
true
;
110
if
(s1.
y
> s2.
y
)
return
false
;
111
if
(s1.
z
< s2.
z
)
return
true
;
112
if
(s1.
z
> s2.
z
)
return
false
;
113
if
(s1.
yaw
< s2.
yaw
)
return
true
;
114
if
(s1.
yaw
> s2.
yaw
)
return
false
;
115
if
(s1.
pitch
< s2.
pitch
)
return
true
;
116
if
(s1.
pitch
> s2.
pitch
)
return
false
;
117
return
s1.
roll
<s2.
roll
;
118
}
119
};
120
};
121
122
123
}
// End of namespace
124
}
// End of namespace
125
}
// End of namespace
126
127
#endif
Page generated by
Doxygen 1.8.3
for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013