LocalGrid.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_LOCALGRID_H_
29 #define SRC_LOCALGRID_H_
30 
31 #include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
32 
33 #include <opencv2/core.hpp>
34 #include <map>
35 
36 namespace rtabmap {
37 
38 class RTABMAP_CORE_EXPORT LocalGrid
39 {
40 public:
41  LocalGrid(const cv::Mat & ground,
42  const cv::Mat & obstacles,
43  const cv::Mat & empty,
44  float cellSize,
45  const cv::Point3f & viewPoint = cv::Point3f(0,0,0));
46  virtual ~LocalGrid() {}
47  bool is3D() const;
48 public:
49  cv::Mat groundCells;
50  cv::Mat obstacleCells;
51  cv::Mat emptyCells;
52  float cellSize;
53  cv::Point3f viewPoint;
54 };
55 
56 class RTABMAP_CORE_EXPORT LocalGridCache
57 {
58 public:
60  virtual ~LocalGridCache() {}
61 
62  void add(int nodeId,
63  const cv::Mat & ground,
64  const cv::Mat & obstacles,
65  const cv::Mat & empty,
66  float cellSize,
67  const cv::Point3f & viewPoint = cv::Point3f(0,0,0));
68 
69  void add(int nodeId, const LocalGrid & localGrid);
70 
71  bool shareTo(int nodeId, LocalGridCache & anotherCache) const;
72 
73  unsigned long getMemoryUsed() const;
74  void clear(bool temporaryOnly = false);
75 
76  size_t size() const {return localGrids_.size();}
77  bool empty() const {return localGrids_.empty();}
78  const std::map<int, LocalGrid> & localGrids() const {return localGrids_;}
79 
80  std::map<int, LocalGrid>::const_iterator find(int nodeId) const {return localGrids_.find(nodeId);}
81  std::map<int, LocalGrid>::const_iterator begin() const {return localGrids_.begin();}
82  std::map<int, LocalGrid>::const_iterator end() const {return localGrids_.end();}
83 
84 private:
85  std::map<int, LocalGrid> localGrids_;
86 };
87 
88 } /* namespace rtabmap */
89 
90 #endif /* SRC_LOCALGRID_H_ */
rtabmap::LocalGridCache::find
std::map< int, LocalGrid >::const_iterator find(int nodeId) const
Definition: LocalGrid.h:80
rtabmap::LocalGrid::obstacleCells
cv::Mat obstacleCells
Definition: LocalGrid.h:50
rtabmap::LocalGridCache
Definition: LocalGrid.h:56
rtabmap::LocalGridCache::localGrids
const std::map< int, LocalGrid > & localGrids() const
Definition: LocalGrid.h:78
rtabmap::LocalGrid::groundCells
cv::Mat groundCells
Definition: LocalGrid.h:49
add
graph add(BetweenFactor< Pose2 >(1, 2, odometry, odometryNoise))
rtabmap::LocalGridCache::empty
bool empty() const
Definition: LocalGrid.h:77
rtabmap::LocalGrid
Definition: LocalGrid.h:38
rtabmap::LocalGrid::emptyCells
cv::Mat emptyCells
Definition: LocalGrid.h:51
rtabmap::LocalGridCache::~LocalGridCache
virtual ~LocalGridCache()
Definition: LocalGrid.h:60
rtabmap::LocalGridCache::localGrids_
std::map< int, LocalGrid > localGrids_
Definition: LocalGrid.h:85
rtabmap::LocalGrid::~LocalGrid
virtual ~LocalGrid()
Definition: LocalGrid.h:46
empty
rtabmap::LocalGridCache::begin
std::map< int, LocalGrid >::const_iterator begin() const
Definition: LocalGrid.h:81
rtabmap::LocalGridCache::LocalGridCache
LocalGridCache()
Definition: LocalGrid.h:59
rtabmap::LocalGridCache::end
std::map< int, LocalGrid >::const_iterator end() const
Definition: LocalGrid.h:82
rtabmap::LocalGrid::viewPoint
cv::Point3f viewPoint
Definition: LocalGrid.h:53
rtabmap
Definition: CameraARCore.cpp:35
rtabmap::LocalGridCache::size
size_t size() const
Definition: LocalGrid.h:76
rtabmap::LocalGrid::cellSize
float cellSize
Definition: LocalGrid.h:52


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