smmap.h
Go to the documentation of this file.
1 #ifndef SMMAP_H
2 #define SMMAP_H
3 #include <gmapping/grid/map.h>
5 #include <gmapping/utils/point.h>
6 #define SIGHT_INC 1
7 
8 namespace GMapping {
9 
12  /* before
13  PointAccumulator(int i=-1): acc(0,0), n(0), visits(0){assert(i==-1);}
14  */
15  /*after begin*/
16  PointAccumulator(): acc(0,0), n(0), visits(0){}
17  PointAccumulator(int i): acc(0,0), n(0), visits(0){assert(i==-1);}
18  /*after end*/
19  inline void update(bool value, const Point& p=Point(0,0));
20  inline Point mean() const {return 1./n*Point(acc.x, acc.y);}
21  inline operator double() const { return visits?(double)n*SIGHT_INC/(double)visits:-1; }
22  inline void add(const PointAccumulator& p) {acc=acc+p.acc; n+=p.n; visits+=p.visits; }
23  static const PointAccumulator& Unknown();
26  int n, visits;
27  inline double entropy() const;
28 };
29 
30 void PointAccumulator::update(bool value, const Point& p){
31  if (value) {
32  acc.x+= static_cast<float>(p.x);
33  acc.y+= static_cast<float>(p.y);
34  n++;
36  } else
37  visits++;
38 }
39 
41  if (!visits)
42  return -log(.5);
43  if (n==visits || n==0)
44  return 0;
45  double x=(double)n*SIGHT_INC/(double)visits;
46  return -( x*log(x)+ (1-x)*log(1-x) );
47 }
48 
49 
51 
52 };
53 
54 #endif
SIGHT_INC
#define SIGHT_INC
Definition: smmap.h:6
harray2d.h
point.h
GMapping::PointAccumulator::update
void update(bool value, const Point &p=Point(0, 0))
Definition: smmap.h:30
GMapping::PointAccumulator::add
void add(const PointAccumulator &p)
Definition: smmap.h:22
GMapping::PointAccumulator::FloatPoint
point< float > FloatPoint
Definition: smmap.h:11
GMapping
Definition: configfile.cpp:34
GMapping::PointAccumulator::Unknown
static const PointAccumulator & Unknown()
Definition: smmap.cpp:5
GMapping::PointAccumulator::PointAccumulator
PointAccumulator()
Definition: smmap.h:16
GMapping::PointAccumulator::mean
Point mean() const
Definition: smmap.h:20
GMapping::PointAccumulator::PointAccumulator
PointAccumulator(int i)
Definition: smmap.h:17
GMapping::Map
Definition: map.h:16
GMapping::PointAccumulator
Definition: smmap.h:10
GMapping::point::y
T y
Definition: point.h:16
GMapping::Point
point< double > Point
Definition: point.h:202
GMapping::PointAccumulator::visits
int visits
Definition: smmap.h:26
GMapping::PointAccumulator::entropy
double entropy() const
Definition: smmap.h:40
map.h
GMapping::point< float >
GMapping::ScanMatcherMap
Map< PointAccumulator, HierarchicalArray2D< PointAccumulator > > ScanMatcherMap
Definition: smmap.h:50
GMapping::PointAccumulator::unknown_ptr
static PointAccumulator * unknown_ptr
Definition: smmap.h:24
GMapping::point::x
T x
Definition: point.h:16
GMapping::PointAccumulator::acc
FloatPoint acc
Definition: smmap.h:25
GMapping::PointAccumulator::n
int n
Definition: smmap.h:26


openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Thu Oct 19 2023 02:25:51