grid_cell.h
Go to the documentation of this file.
1 #ifndef SLAM_CTOR_CORE_GRID_CELL_H
2 #define SLAM_CTOR_CORE_GRID_CELL_H
3 
4 #include <memory>
5 #include "../math_utils.h"
6 #include "../states/sensor_data.h"
7 #include "../serialization.h"
8 
9 class GridCell {
10 public:
11  GridCell(const Occupancy &occ) : _occupancy{occ} {}
12  GridCell(const GridCell& gc) = default;
13  GridCell& operator=(const GridCell& gc) = default;
14  GridCell(GridCell&& gc) = default;
15  GridCell& operator=(GridCell&& gc) = default;
16  virtual ~GridCell() = default;
17 
18  operator double() const { return occupancy().prob_occ; }
19  explicit operator bool() const { return are_equal(double(*this), 0.0); }
20  virtual const Occupancy& occupancy() const { return _occupancy; }
21 
22  virtual std::unique_ptr<GridCell> clone() const {
23  return std::make_unique<GridCell>(*this);
24  }
25 
26  virtual void operator+=(const AreaOccupancyObservation &aoo) {
27  _occupancy = aoo.occupancy;
28  }
29 
30  // must be in interval [0, 1.0]
31  virtual double discrepancy(const AreaOccupancyObservation &aoo) const {
32  return std::abs(_occupancy - aoo.occupancy);
33  }
34 
35  virtual std::vector<char> serialize() const {
37  return s.result();
38  }
39 
40  virtual size_t deserialize(const std::vector<char>& data, size_t pos = 0) {
41  Deserializer d(data, pos);
43  return d.pos();
44  }
45 
46 protected:
48 };
49 
50 #endif
d
double prob_occ
Definition: state_data.h:8
virtual double discrepancy(const AreaOccupancyObservation &aoo) const
Definition: grid_cell.h:31
CONSTEXPR bool are_equal(const T &a, const T &b, const T &eps)
Definition: math_utils.h:17
size_t pos() const
Definition: serialization.h:73
virtual std::unique_ptr< GridCell > clone() const
Definition: grid_cell.h:22
XmlRpcServer s
virtual const Occupancy & occupancy() const
Definition: grid_cell.h:20
virtual void operator+=(const AreaOccupancyObservation &aoo)
Definition: grid_cell.h:26
virtual ~GridCell()=default
double estimation_quality
Definition: state_data.h:9
Occupancy _occupancy
Definition: grid_cell.h:47
GridCell(const Occupancy &occ)
Definition: grid_cell.h:11
virtual size_t deserialize(const std::vector< char > &data, size_t pos=0)
Definition: grid_cell.h:40
virtual std::vector< char > serialize() const
Definition: grid_cell.h:35
std::vector< char > result() const
Definition: serialization.h:24
GridCell & operator=(const GridCell &gc)=default


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