GlobalMap.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2023, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifndef SRC_MAP_H_
29 #define SRC_MAP_H_
30 
31 #include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
32 
33 #include <rtabmap/core/LocalGrid.h>
35 #include <rtabmap/core/Transform.h>
36 #include <list>
37 
38 namespace rtabmap {
39 
40 class RTABMAP_CORE_EXPORT GlobalMap
41 {
42 public:
43  inline static float logodds(double probability)
44  {
45  return (float) log(probability/(1-probability));
46  }
47 
48  inline static double probability(double logodds)
49  {
50  return 1. - ( 1. / (1. + exp(logodds)));
51  }
52 
53 public:
54  virtual ~GlobalMap();
55 
56  bool update(const std::map<int, Transform> & poses); // return true if map has changed
57 
58  virtual void clear();
59 
60  float getCellSize() const {return cellSize_;}
61  float getUpdateError() const {return updateError_;}
62  const std::map<int, Transform> & addedNodes() const {return addedNodes_;}
63 
64  void getGridMin(double & x, double & y) const {x=minValues_[0];y=minValues_[1];}
65  void getGridMax(double & x, double & y) const {x=maxValues_[0];y=maxValues_[1];}
66  void getGridMin(double & x, double & y, double & z) const {x=minValues_[0];y=minValues_[1];z=minValues_[2];}
67  void getGridMax(double & x, double & y, double & z) const {x=maxValues_[0];y=maxValues_[1];z=maxValues_[2];}
68 
69  virtual unsigned long getMemoryUsed() const;
70 
71 protected:
72  GlobalMap(const LocalGridCache * cache, const ParametersMap & parameters = ParametersMap());
73 
74  virtual void assemble(const std::list<std::pair<int, Transform> > & newPoses) = 0;
75 
76  const std::map<int, LocalGrid> & cache() const {return cache_->localGrids();}
77 
78  const std::map<int, Transform> & assembledNodes() const {return addedNodes_;}
79  bool isNodeAssembled(int id) {return addedNodes_.find(id) != addedNodes_.end();}
80  void addAssembledNode(int id, const Transform & pose);
81 
82 protected:
83  float cellSize_;
84  float updateError_;
85 
87  float logOddsHit_;
88  float logOddsMiss_;
91 
92  double minValues_[3];
93  double maxValues_[3];
94 
95 private:
97  std::map<int, Transform> addedNodes_;
98 };
99 
100 } /* namespace rtabmap */
101 
102 #endif /* SRC_MAP_H_ */
rtabmap::GlobalMap::addedNodes_
std::map< int, Transform > addedNodes_
Definition: GlobalMap.h:97
rtabmap::GlobalMap::logOddsHit_
float logOddsHit_
Definition: GlobalMap.h:87
update
def update(text)
rtabmap::GlobalMap::getGridMin
void getGridMin(double &x, double &y) const
Definition: GlobalMap.h:64
rtabmap::GlobalMap::logodds
static float logodds(double probability)
Definition: GlobalMap.h:43
rtabmap::GlobalMap::logOddsMiss_
float logOddsMiss_
Definition: GlobalMap.h:88
LocalGrid.h
Transform.h
y
Matrix3f y
rtabmap::LocalGridCache
Definition: LocalGrid.h:56
rtabmap::ParametersMap
std::map< std::string, std::string > ParametersMap
Definition: Parameters.h:43
rtabmap::GlobalMap::cache_
const LocalGridCache * cache_
Definition: GlobalMap.h:96
rtabmap::GlobalMap::isNodeAssembled
bool isNodeAssembled(int id)
Definition: GlobalMap.h:79
Parameters.h
rtabmap::GlobalMap::getGridMax
void getGridMax(double &x, double &y) const
Definition: GlobalMap.h:65
rtabmap::GlobalMap::addedNodes
const std::map< int, Transform > & addedNodes() const
Definition: GlobalMap.h:62
rtabmap::GlobalMap::logOddsClampingMin_
float logOddsClampingMin_
Definition: GlobalMap.h:89
rtabmap::GlobalMap
Definition: GlobalMap.h:40
rtabmap::GlobalMap::occupancyThr_
float occupancyThr_
Definition: GlobalMap.h:86
z
z
x
x
glm::log
GLM_FUNC_DECL genType log(genType const &x)
rtabmap::GlobalMap::probability
static double probability(double logodds)
Definition: GlobalMap.h:48
rtabmap::Transform
Definition: Transform.h:41
rtabmap::GlobalMap::updateError_
float updateError_
Definition: GlobalMap.h:84
rtabmap::GlobalMap::getUpdateError
float getUpdateError() const
Definition: GlobalMap.h:61
rtabmap::GlobalMap::getGridMax
void getGridMax(double &x, double &y, double &z) const
Definition: GlobalMap.h:67
rtabmap::GlobalMap::cache
const std::map< int, LocalGrid > & cache() const
Definition: GlobalMap.h:76
rtabmap::GlobalMap::logOddsClampingMax_
float logOddsClampingMax_
Definition: GlobalMap.h:90
rtabmap::GlobalMap::cellSize_
float cellSize_
Definition: GlobalMap.h:83
rtabmap::GlobalMap::getCellSize
float getCellSize() const
Definition: GlobalMap.h:60
rtabmap
Definition: CameraARCore.cpp:35
rtabmap::GlobalMap::assembledNodes
const std::map< int, Transform > & assembledNodes() const
Definition: GlobalMap.h:78
glm::exp
GLM_FUNC_DECL genType exp(genType const &x)
rtabmap::GlobalMap::getGridMin
void getGridMin(double &x, double &y, double &z) const
Definition: GlobalMap.h:66


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:10