tiny_grid_cells.h
Go to the documentation of this file.
1 
12 #ifndef __TINY_GRID_CELLS_H
13 #define __TINY_GRID_CELLS_H
14 
15 #include "../core/maps/grid_map.h"
16 
17 //------------------------------------------------------------------------------
18 // Base cell
19 
26 class BaseTinyCell : public GridCell {
27 public:
31  BaseTinyCell(): _prob(0.5) {}
35  double value() const override { return _prob; }
41  void set_value(const Occupancy &value, double quality) override {
42  _prob = (1.0 - quality) * _prob + quality * value.prob_occ;
43  }
44 private:
45  double _prob;
46 };
47 
55 public:
59  std::shared_ptr<GridCell> create_cell() override {
60  return std::shared_ptr<GridCell>(new BaseTinyCell());
61  }
62 };
63 
64 //------------------------------------------------------------------------------
65 // Modified cell
66 
73 class AvgTinyCell : public GridCell {
74 public:
78  AvgTinyCell(): _cnt(0), _n(0) {}
82  double value() const override { return _n == 0 ? -1 : _cnt / _n; }
89  void set_value (const Occupancy &value, double quality) override {
90  _n += 1;
91  _cnt += 0.5 + (value.prob_occ - 0.5) * quality;
92  }
93 private:
94  double _cnt, _n;
95 };
96 
105 public:
109  std::shared_ptr<GridCell> create_cell() override {
110  return std::shared_ptr<GridCell>(new AvgTinyCell());
111  }
112 };
113 
114 #endif
double value() const override
std::shared_ptr< GridCell > create_cell() override
A strategy creates cells of the base tiny model (BaseTinyCell).
The base class for factories that encapsulate creation of a specific cell (The Factory method pattern...
void set_value(const Occupancy &value, double quality) override
void set_value(const Occupancy &value, double quality) override
A strategy creates cells with the average probability calculation rule (AvgTinyCell).
std::shared_ptr< GridCell > create_cell() override
The grid cell&#39;s model presented in the original tinySLAM paper.
double value() const override
The grid cell&#39;s model updates probabilities as an average value.
The base class for GridMap&#39;s cell that defines a model of occupancy tracking.


tiny_slam
Author(s):
autogenerated on Mon Jun 10 2019 15:30:57