11 #ifdef GRID_MAP_PCL_OPENMP_FOUND 15 #include <pcl/common/io.h> 30 Pointcloud::Ptr inputCloud(
new pcl::PointCloud<pcl::PointXYZ>);
43 pcl::copyPointCloud(*rawInputCloud, *temp);
50 pcl::copyPointCloud(*workingCloud, *temp);
76 if (resolution < 1e-4) {
77 throw std::runtime_error(
"Desired grid map resolution is zero");
82 pcl::PointXYZ minBound;
83 pcl::PointXYZ maxBound;
96 ROS_INFO_STREAM(
"Initialized map geometry");
107 #ifndef GRID_MAP_PCL_OPENMP_FOUND 108 ROS_WARN_STREAM(
"OpemMP not found, defaulting to single threaded implementation");
111 #pragma omp parallel for schedule(dynamic, 10) 114 for (
unsigned int linearIndex = 0; linearIndex < linearGridMapSize; ++linearIndex) {
124 Pointcloud::Ptr pointsInsideCellBorder(
new Pointcloud());
127 if (isTooFewPointsInCell) {
133 if (clusterHeights.empty()) {
134 (*gridMapData)(index(0), index(1)) = std::nan(
"1");
137 ? *(std::max_element(clusterHeights.begin(), clusterHeights.end()))
138 : *(std::min_element(clusterHeights.begin(), clusterHeights.end()));
146 const bool isNoClustersFound = clusterClouds.empty();
147 if (isNoClustersFound) {
153 heights.reserve(clusterClouds.size());
155 std::transform(clusterClouds.begin(), clusterClouds.end(), std::back_inserter(heights),
186 for (
unsigned int i = 0; i < dimX; ++i) {
189 for (
unsigned int j = 0; j < dimY; ++j) {
201 for (
unsigned int i = 0; i <
workingCloud_->points.size(); ++i) {
203 const double x = point.x;
204 const double y = point.y;
const Length & getLength() const
unsigned int minCloudPointsPerCell_
GridMapParameters gridMap_
std::vector< Pointcloud::Ptr > extractClusterCloudsFromPointcloud(Pointcloud::ConstPtr inputCloud) const
void loadParameters(const std::string &filename)
void setGeometry(const Length &length, const double resolution, const Position &position=Position::Zero())
bool loadParameters(const std::string &filename)
void processGridMapCell(const unsigned int linearGridMapIndex, grid_map::Matrix *gridMapData)
void initializeGridMapGeometryFromInputCloud()
Pointcloud::Ptr applyRigidBodyTransformation(Pointcloud::ConstPtr inputCloud) const
Pointcloud::Ptr getPointcloudInsideGridMapCellBorder(const grid_map::Index &index) const
void calculateElevationFromPointsInsideGridMapCell(Pointcloud::ConstPtr cloud, std::vector< float > &heights) const
void setWorkingCloud(Pointcloud::ConstPtr workingCloud)
Pointcloud::Ptr rawInputCloud_
void setRawInputCloud(Pointcloud::ConstPtr rawInputCloud)
std::vector< std::vector< Pointcloud::Ptr > > pointcloudWithinGridMapCell_
Eigen::Vector3d calculateMeanOfPointPositions(Pointcloud::ConstPtr inputCloud)
Pointcloud::Ptr downsampleInputCloud(Pointcloud::ConstPtr inputCloud) const
TFSIMD_FORCE_INLINE const tfScalar & y() const
void loadCloudFromPcdFile(const std::string &filename)
void loadParameters(const std::string &filename)
void dispatchWorkingCloudToGridMapCells()
grid_map::GridMap workingGridMap_
Pointcloud::Ptr workingCloud_
double getResolution() const
::pcl::PointCloud< Point > Pointcloud
void addLayerFromInputCloud(const std::string &layer)
OutlierRemovalParameters outlierRemoval_
const Matrix & get(const std::string &layer) const
void allocateSpaceForCloudsInsideCells()
void setInputCloud(Pointcloud::ConstPtr inputCloud)
grid_map_pcl::PointcloudProcessor pointcloudProcessor_
TFSIMD_FORCE_INLINE const tfScalar & x() const
Pointcloud::Ptr loadPointcloudFromPcd(const std::string &filename)
void preProcessInputCloud()
Index getIndexFromLinearIndex(const size_t linearIndex, const Size &bufferSize, const bool rowMajor=false)
void preprocessGridMapCells()
#define ROS_WARN_STREAM(args)
static void savePointCloudAsPcdFile(const std::string &filename, const Pointcloud &cloud)
#define ROS_WARN_STREAM_THROTTLE(rate, args)
const Parameters & get() const
void savePointCloudAsPcdFile(const std::string &filename) const
ClusterExtractionParameters clusterExtraction_
void add(const std::string &layer, const double value=NAN)
std::vector< std::vector< std::vector< float > > > clusterHeightsWithingGridMapCell_
#define ROS_INFO_STREAM(args)
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
Pointcloud::Ptr removeOutliersFromInputCloud(Pointcloud::ConstPtr inputCloud) const
bool getIndex(const Position &position, Index &index) const
const grid_map::GridMap & getGridMap() const
const Size & getSize() const
DownsamplingParameters downsampling_
grid_map_pcl::PclLoaderParameters params_