RTAB-Map 0.23.11
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
LocalGridMaker.h
1/*
2Copyright (c) 2010-2023, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, 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
16THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23ON 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
25SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*/
27
28#ifndef SRC_LOCAL_MAP_H_
29#define SRC_LOCAL_MAP_H_
30
31#include "rtabmap/core/rtabmap_core_export.h" // DLL export/import defines
32
33#include <pcl/pcl_base.h>
34#include <pcl/point_types.h>
35
36#include <rtabmap/core/Transform.h>
37#include <rtabmap/core/Parameters.h>
38#include <rtabmap/core/Signature.h>
39
40namespace rtabmap {
41
64class RTABMAP_CORE_EXPORT LocalGridMaker
65{
66public:
69 virtual ~LocalGridMaker();
70
72 virtual void parseParameters(const ParametersMap & parameters);
73
75 float getCellSize() const {return cellSize_;}
77 bool isGridFromDepth() const {return occupancySensor_;}
79 bool isMapFrameProjection() const {return projMapFrame_;}
80
97 template<typename PointT>
98 typename pcl::PointCloud<PointT>::Ptr segmentCloud(
99 const typename pcl::PointCloud<PointT>::Ptr & cloud,
100 const pcl::IndicesPtr & indices,
101 const Transform & pose,
102 const cv::Point3f & viewPoint,
103 pcl::IndicesPtr & groundIndices, // output cloud indices
104 pcl::IndicesPtr & obstaclesIndices, // output cloud indices
105 pcl::IndicesPtr * flatObstacles = 0) const; // output cloud indices
106
124 const Signature & node,
125 cv::Mat & groundCells,
126 cv::Mat & obstacleCells,
127 cv::Mat & emptyCells,
128 cv::Point3f & viewPoint);
129
144 const LaserScan & cloud,
145 const Transform & pose,
146 cv::Mat & groundCells,
147 cv::Mat & obstacleCells,
148 cv::Mat & emptyCells,
149 cv::Point3f & viewPointInOut) const;
150
151private:
163 template<typename PointT>
164 static pcl::IndicesPtr noiseFilteringWithMaxRange(
165 const typename pcl::PointCloud<PointT>::Ptr & cloud,
166 const pcl::IndicesPtr & indices,
167 float maxRange,
168 float radiusSearch,
169 int minNeighborsInRadius);
170
171protected:
172 ParametersMap parameters_;
173
174 unsigned int cloudDecimation_;
175 float rangeMax_;
176 float rangeMin_;
177 std::vector<float> roiRatios_;
178 float footprintLength_;
179 float footprintWidth_;
180 float footprintHeight_;
181 int scanDecimation_;
182 float cellSize_;
183 bool preVoxelFiltering_;
184 int occupancySensor_;
185 bool projMapFrame_;
186 float maxObstacleHeight_;
187 int normalKSearch_;
188 float groundNormalsUp_;
189 float maxGroundAngle_;
190 float clusterRadius_;
191 int minClusterSize_;
192 bool flatObstaclesDetected_;
193 float minGroundHeight_;
194 float maxGroundHeight_;
195 bool normalsSegmentation_;
196 bool grid3D_;
197 bool groundIsObstacle_;
198 float noiseFilteringRadius_;
199 int noiseFilteringMinNeighbors_;
200 bool scan2dUnknownSpaceFilled_;
201 bool rayTracing_;
202};
203
204} /* namespace rtabmap */
205
206#include <rtabmap/core/impl/LocalMapMaker.hpp>
207
208#endif /* SRC_LOCAL_MAP_H_ */
Represents 2D or 3D laser scan data with support for multiple point data formats.
Definition LaserScan.h:46
Builds per-node local occupancy grids from laser scans or depth clouds.
void createLocalMap(const LaserScan &cloud, const Transform &pose, cv::Mat &groundCells, cv::Mat &obstacleCells, cv::Mat &emptyCells, cv::Point3f &viewPointInOut) const
Creates a local grid from a 3D (or organized) LaserScan.
virtual void parseParameters(const ParametersMap &parameters)
Updates grid settings from Grid/ entries in parameters.
LocalGridMaker(const ParametersMap &parameters=ParametersMap())
Constructs with parseParameters() on parameters (or defaults).
void createLocalMap(const Signature &node, cv::Mat &groundCells, cv::Mat &obstacleCells, cv::Mat &emptyCells, cv::Point3f &viewPoint)
Creates a local grid from a Signature's laser scan or depth data.
bool isMapFrameProjection() const
Represents a node in RTAB-Map's pose graph.
Definition Signature.h:84
Represents a 3D rigid body transformation (rotation + translation).
Definition Transform.h:53
std::map< std::string, std::string > ParametersMap
Parameter keys mapped to their values, as used by every configurable class (see Parameters).
Definition Parameters.h:44