28 #ifndef CORELIB_INCLUDE_RTABMAP_CORE_IMPL_LOCALMAP_HPP_
29 #define CORELIB_INCLUDE_RTABMAP_CORE_IMPL_LOCALMAP_HPP_
37 template<
typename Po
intT>
39 const typename pcl::PointCloud<PointT>::Ptr & cloudIn,
40 const pcl::IndicesPtr & indicesIn,
42 const cv::Point3f & viewPoint,
43 pcl::IndicesPtr & groundIndices,
44 pcl::IndicesPtr & obstaclesIndices,
45 pcl::IndicesPtr * flatObstacles)
const
47 groundIndices.reset(
new std::vector<int>);
48 obstaclesIndices.reset(
new std::vector<int>);
51 flatObstacles->reset(
new std::vector<int>);
54 typename pcl::PointCloud<PointT>::Ptr cloud(
new pcl::PointCloud<PointT>);
55 pcl::IndicesPtr
indices(
new std::vector<int>);
71 if(indicesIn->empty() && cloud->is_dense)
117 UDEBUG(
"indices after max obstacles height filtering = %d", (
int)
indices->size());
130 util3d::segmentObstaclesFromGround<PointT>(
142 Eigen::Vector4f(viewPoint.x, viewPoint.y, viewPoint.z+(
projMapFrame_?pose.
z():0), 1),
157 pcl::IndicesPtr notObstacles = groundIndices;
166 UDEBUG(
"groundIndices=%d obstaclesIndices=%d", (
int)groundIndices->size(), (
int)obstaclesIndices->size());
171 UDEBUG(
"Radius filtering (%ld ground %ld obstacles, radius=%f k=%d)",
172 groundIndices->size(),
173 obstaclesIndices->size()+(flatObstacles?(*flatObstacles)->size():0),
176 if(groundIndices->size())
178 pcl::IndicesPtr farIndices;
182 pcl::IndicesPtr closeIndices;
184 groundIndices = closeIndices;
192 if(obstaclesIndices->size())
194 pcl::IndicesPtr farIndices;
198 pcl::IndicesPtr closeIndices;
200 obstaclesIndices = closeIndices;
208 if(flatObstacles && (*flatObstacles)->size())
210 pcl::IndicesPtr farIndices;
214 pcl::IndicesPtr closeIndices;
216 *flatObstacles = closeIndices;
224 UDEBUG(
"Radius filtering end (%ld ground %ld obstacles)",
225 groundIndices->size(),
226 obstaclesIndices->size()+(flatObstacles?(*flatObstacles)->size():0));
228 if(groundIndices->empty() && obstaclesIndices->empty())
230 UWARN(
"Cloud (with %d points) is empty after noise "
231 "filtering. Occupancy grid cannot be "