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");
109 #ifndef GRID_MAP_PCL_OPENMP_FOUND 110 ROS_WARN_STREAM(
"OpemMP not found, defaulting to single threaded implementation");
113 #pragma omp parallel for schedule(dynamic, 10) 115 for (
unsigned int linearIndex = 0; linearIndex < linearGridMapSize; ++linearIndex) {
125 Pointcloud::Ptr pointsInsideCellBorder(
new Pointcloud());
128 if (isTooFewPointsInCell) {
138 if (clusterHeights.empty()) {
139 (*gridMapData)(index(0), index(1)) = std::nan(
"1");
142 ? *(std::max_element(clusterHeights.begin(), clusterHeights.end()))
143 : *(std::min_element(clusterHeights.begin(), clusterHeights.end()));
151 const bool isNoClustersFound = clusterClouds.empty();
152 if (isNoClustersFound) {
158 heights.reserve(clusterClouds.size());
160 std::transform(clusterClouds.begin(), clusterClouds.end(), std::back_inserter(heights),
195 for (
unsigned int i = 0; i < dimX; ++i) {
198 for (
unsigned int j = 0; j < dimY; ++j) {
210 for (
unsigned int i = 0; i <
workingCloud_->points.size(); ++i) {
212 const double x = point.x;
213 const double y = point.y;
unsigned int minCloudPointsPerCell_
GridMapParameters gridMap_
void loadParameters(const std::string &filename)
void setGeometry(const Length &length, const double resolution, const Position &position=Position::Zero())
#define ROS_WARN_STREAM_THROTTLE(period, args)
unsigned int maxCloudPointsPerCell_
Pointcloud::Ptr applyRigidBodyTransformation(Pointcloud::ConstPtr inputCloud) const
bool loadParameters(const std::string &filename)
void processGridMapCell(const unsigned int linearGridMapIndex, grid_map::Matrix *gridMapData)
void initializeGridMapGeometryFromInputCloud()
void setWorkingCloud(Pointcloud::ConstPtr workingCloud)
const Matrix & get(const std::string &layer) const
const Parameters & get() const
const Size & getSize() const
Pointcloud::Ptr rawInputCloud_
void setRawInputCloud(Pointcloud::ConstPtr rawInputCloud)
std::vector< std::vector< Pointcloud::Ptr > > pointcloudWithinGridMapCell_
Eigen::Vector3d calculateMeanOfPointPositions(Pointcloud::ConstPtr inputCloud)
void loadCloudFromPcdFile(const std::string &filename)
double getResolution() const
void loadParameters(const std::string &filename)
std::vector< Pointcloud::Ptr > extractClusterCloudsFromPointcloud(Pointcloud::ConstPtr inputCloud) const
void dispatchWorkingCloudToGridMapCells()
grid_map::GridMap workingGridMap_
Pointcloud::Ptr workingCloud_
const grid_map::GridMap & getGridMap() const
::pcl::PointCloud< Point > Pointcloud
void addLayerFromInputCloud(const std::string &layer)
OutlierRemovalParameters outlierRemoval_
Pointcloud::Ptr downsampleInputCloud(Pointcloud::ConstPtr inputCloud) const
void allocateSpaceForCloudsInsideCells()
void setInputCloud(Pointcloud::ConstPtr inputCloud)
grid_map_pcl::PointcloudProcessor pointcloudProcessor_
Pointcloud::Ptr loadPointcloudFromPcd(const std::string &filename)
void preProcessInputCloud()
void preprocessGridMapCells()
#define ROS_WARN_STREAM(args)
static void savePointCloudAsPcdFile(const std::string &filename, const Pointcloud &cloud)
ClusterExtractionParameters clusterExtraction_
void add(const std::string &layer, const double value=NAN)
Pointcloud::Ptr getPointcloudInsideGridMapCellBorder(const grid_map::Index &index) const
std::vector< std::vector< std::vector< float > > > clusterHeightsWithingGridMapCell_
#define ROS_INFO_STREAM(args)
void setParameters(const grid_map_pcl::PclLoaderParameters::Parameters parameters)
void calculateElevationFromPointsInsideGridMapCell(Pointcloud::ConstPtr cloud, std::vector< float > &heights) const
TFSIMD_FORCE_INLINE tfScalar length(const Quaternion &q)
void savePointCloudAsPcdFile(const std::string &filename) const
bool getIndex(const Position &position, Index &index) const
Index getIndexFromLinearIndex(size_t linearIndex, const Size &bufferSize, bool rowMajor=false)
const Length & getLength() const
DownsamplingParameters downsampling_
grid_map_pcl::PclLoaderParameters params_
Pointcloud::Ptr removeOutliersFromInputCloud(Pointcloud::ConstPtr inputCloud) const