Main Page
Classes
Files
File List
File Members
src
slams
gmapping
gmapping_occupancy_observation_pe.h
Go to the documentation of this file.
1
#ifndef SLAM_CTOR_GMAPPING_OCCUPANCY_OBSERVATION_PE
2
#define SLAM_CTOR_GMAPPING_OCCUPANCY_OBSERVATION_PE
3
4
#include <cmath>
5
#include <cassert>
6
7
#include "../../core/scan_matchers/occupancy_observation_probability.h"
8
#include "../../core/geometry_utils.h"
9
10
class
GmappingOccupancyObservationPE
11
:
public
OccupancyObservationProbabilityEstimator
{
12
public
:
13
GmappingOccupancyObservationPE
(
double
fullness_th,
unsigned
window_size)
14
:
Fullness_Th
{fullness_th},
Window_Sz
{int(window_size)},
_cached_prob
{-1} {}
15
double
probability
(
const
AreaOccupancyObservation
&aoo,
16
const
LightWeightRectangle
&,
17
const
GridMap
&map)
const override
{
18
assert(aoo.
is_occupied
);
19
auto
sp_coord = map.
world_to_cell
(aoo.
obstacle
);
20
if
(sp_coord ==
_cached_coord
&&
_cached_prob
!= -1) {
21
return
_cached_prob
;
22
}
23
24
double
best_prob = 0;
25
for
(
int
d_x = -
Window_Sz
; d_x <=
Window_Sz
; ++d_x) {
26
for
(
int
d_y = -
Window_Sz
; d_y <=
Window_Sz
; ++d_y) {
27
auto
cell_coord = sp_coord +
DiscretePoint2D
{d_x, d_y};
28
const
auto
&cell = map[cell_coord];
29
if
(cell <
Fullness_Th
) {
continue
; }
30
best_prob = std::max(best_prob, 1.0 - cell.discrepancy(aoo));
31
}
32
}
33
34
_cached_coord
= sp_coord;
35
return
_cached_prob
= best_prob;
36
}
37
38
private
:
39
const
double
Fullness_Th
;
40
const
int
Window_Sz
;
41
mutable
DiscretePoint2D
_cached_coord
;
42
mutable
double
_cached_prob
;
43
};
44
45
46
#endif
GmappingOccupancyObservationPE::probability
double probability(const AreaOccupancyObservation &aoo, const LightWeightRectangle &, const GridMap &map) const override
Definition:
gmapping_occupancy_observation_pe.h:15
RegularSquaresGrid::world_to_cell
Coord world_to_cell(const Point2D &pt) const
Definition:
regular_squares_grid.h:34
GmappingOccupancyObservationPE::_cached_coord
DiscretePoint2D _cached_coord
Definition:
gmapping_occupancy_observation_pe.h:41
LightWeightRectangle
Definition:
geometry_primitives.h:165
GridMap
Definition:
grid_map.h:22
GmappingOccupancyObservationPE::_cached_prob
double _cached_prob
Definition:
gmapping_occupancy_observation_pe.h:42
GmappingOccupancyObservationPE
Definition:
gmapping_occupancy_observation_pe.h:10
AreaOccupancyObservation
Definition:
state_data.h:42
AreaOccupancyObservation::obstacle
Point2D obstacle
Definition:
state_data.h:45
GmappingOccupancyObservationPE::GmappingOccupancyObservationPE
GmappingOccupancyObservationPE(double fullness_th, unsigned window_size)
Definition:
gmapping_occupancy_observation_pe.h:13
AreaOccupancyObservation::is_occupied
bool is_occupied
Definition:
state_data.h:43
GmappingOccupancyObservationPE::Window_Sz
const int Window_Sz
Definition:
gmapping_occupancy_observation_pe.h:40
DiscretePoint2D
Definition:
geometry_discrete_primitives.h:10
OccupancyObservationProbabilityEstimator
Definition:
grid_scan_matcher.h:32
GmappingOccupancyObservationPE::Fullness_Th
const double Fullness_Th
Definition:
gmapping_occupancy_observation_pe.h:39
slam_constructor
Author(s): JetBrains Research, OSLL team
autogenerated on Mon Jun 10 2019 15:08:25