tiny_grid_cell.h
Go to the documentation of this file.
1 #ifndef SLAM_CTOR_SLAM_TINY_GRID_CELL_H
2 #define SLAM_CTOR_SLAM_TINY_GRID_CELL_H
3 
4 #include "../../core/maps/grid_cell.h"
5 
6 //------------------------------------------------------------------------------
7 // Base cell
8 
9 class BaseTinyCell : public GridCell {
10 public:
12 
13  virtual std::unique_ptr<GridCell> clone() const {
14  return std::make_unique<BaseTinyCell>(*this);
15  }
16 
17  virtual void operator+=(const AreaOccupancyObservation &aoo) {
18  if (!aoo.occupancy.is_valid()) { return; }
19 
20  const double q = aoo.quality;
21  _occupancy.prob_occ = (1.0 - q) * (*this) + q * aoo.occupancy;
22  }
23 };
24 
25 //------------------------------------------------------------------------------
26 // Modified cell
27 
28 class AvgTinyCell : public GridCell {
29 public:
30  AvgTinyCell(): GridCell{Occupancy{0.5, 1}}, _n(0) {}
31 
32  virtual std::unique_ptr<GridCell> clone() const {
33  return std::make_unique<AvgTinyCell>(*this);
34  }
35 
36  virtual void operator+=(const AreaOccupancyObservation &aoo) {
37  if (!aoo.occupancy.is_valid()) { return; }
38 
39  _n += 1;
40  double that_p = 0.5 + (aoo.occupancy - 0.5) * aoo.quality;
41  _occupancy.prob_occ = ((*this) * (_n - 1) + that_p) / _n;
42  }
43 
44 private:
45  double _n;
46 };
47 
48 #endif
double prob_occ
Definition: state_data.h:8
virtual void operator+=(const AreaOccupancyObservation &aoo)
virtual std::unique_ptr< GridCell > clone() const
virtual void operator+=(const AreaOccupancyObservation &aoo)
bool is_valid() const
Definition: state_data.h:23
Occupancy _occupancy
Definition: grid_cell.h:47
virtual std::unique_ptr< GridCell > clone() const


slam_constructor
Author(s): JetBrains Research, OSLL team
autogenerated on Mon Jun 10 2019 15:08:25