16 namespace grid_map_pcl_test {
31 std::vector<Eigen::Vector3d> nonNanCoordinates;
34 if (!std::isnan(value)) {
37 nonNanCoordinates.push_back(Eigen::Vector3d(position.x(), position.y(), value));
41 return nonNanCoordinates;
45 std::vector<double> nonNanElevations;
48 if (!std::isnan(value)) {
49 nonNanElevations.push_back(value);
53 return nonNanElevations;
57 std::normal_distribution<double> normalDist(mean, stdDev);
60 cloud->points.reserve(nPoints);
61 for (
unsigned int i = 0; i < nPoints; ++i) {
63 point.x = normalDist(*generator);
64 point.y = normalDist(*generator);
65 point.z = normalDist(*generator);
66 cloud->push_back(point);
73 std::mt19937* generator) {
74 const double upperBound = maxXY;
75 const double lowerBound = minXY;
76 std::uniform_real_distribution<double> uniformDist(lowerBound, upperBound);
77 const double mean = meanZ;
78 const double stdDev = stdDevZ;
79 std::normal_distribution<double> normalDist(mean, stdDev);
83 cloud->points.reserve(nPoints);
84 for (
unsigned int i = 0; i < nPoints; ++i) {
86 point.x = uniformDist(*generator);
87 point.y = uniformDist(*generator);
88 point.z = normalDist(*generator);
89 cloud->push_back(point);
95 Pointcloud::Ptr
createPerfectPlane(
unsigned int nPoints,
double minXY,
double maxXY,
double desiredHeight, std::mt19937* generator) {
96 const double upperBound = maxXY;
97 const double lowerBound = minXY;
98 std::uniform_real_distribution<double> uniformDist(lowerBound, upperBound);
101 cloud->points.reserve(nPoints);
102 for (
unsigned int i = 0; i < nPoints; ++i) {
104 point.x = uniformDist(*generator);
105 point.y = uniformDist(*generator);
106 point.z = desiredHeight;
107 cloud->push_back(point);
113 Pointcloud::Ptr
concatenate(Pointcloud::Ptr cloud1, Pointcloud::Ptr cloud2) {
116 concatenatedCloud->points.reserve(cloud1->points.size() + cloud2->points.size());
118 for (
const auto& point : cloud2->points) {
119 concatenatedCloud->push_back(point);
122 for (
const auto& point : cloud1->points) {
123 concatenatedCloud->push_back(point);
126 return concatenatedCloud;
138 const std::string& filename) {
143 Pointcloud::Ptr
createStepTerrain(
unsigned int nPoints,
double minXY,
double maxXY,
double zHigh,
double zLow,
double stdDevZ,
144 std::mt19937* generator,
double* center) {
145 *center = (maxXY + minXY) / 2.0;
146 std::uniform_real_distribution<double> uniformDist(minXY, maxXY);
147 std::normal_distribution<double> zLowDist(zLow, stdDevZ);
148 std::normal_distribution<double> zHighDist(zHigh, stdDevZ);
151 cloud->points.reserve(nPoints);
152 for (
unsigned int i = 0; i < nPoints; ++i) {
154 point.x = uniformDist(*generator);
155 point.y = uniformDist(*generator);
157 if (point.x > *center) {
158 point.z = zHighDist(*generator);
160 point.z = zLowDist(*generator);
163 cloud->push_back(point);
std::vector< Eigen::Vector3d > getNonNanElevationValuesWithCoordinates(const grid_map::GridMap &gridMap)
void loadParameters(const std::string &filename)
std::string getConfigFilePath()
Pointcloud::Ptr createNoisyPlanePointcloud(unsigned int nPoints, double minXY, double maxXY, double meanZ, double stdDevZ, std::mt19937 *generator)
ROSCONSOLE_DECL void notifyLoggerLevelsChanged()
bool getPosition(const Index &index, Position &position) const
void initializeGridMapGeometryFromInputCloud()
void runGridMapPclLoaderOnInputCloud(Pointcloud::ConstPtr inputCloud, grid_map::GridMapPclLoader *gridMapPclLoader)
void runGridMapPclLoaderOnInputCloudAndSavePointCloud(Pointcloud::ConstPtr inputCloud, grid_map::GridMapPclLoader *gridMapPclLoader, const std::string &filename)
std::vector< double > getNonNanElevationValues(const grid_map::GridMap &gridMap)
void addLayerFromInputCloud(const std::string &layer)
void setInputCloud(Pointcloud::ConstPtr inputCloud)
void setVerbosityLevel(ros::console::levels::Level level)
std::mt19937 rndGenerator
void preProcessInputCloud()
float & at(const std::string &layer, const Index &index)
ROSLIB_DECL std::string getPath(const std::string &package_name)
static const std::string layerName
void savePointCloudAsPcdFile(const std::string &filename) const
std::string getTestDataFolderPath()
Pointcloud::Ptr createStepTerrain(unsigned int nPoints, double minXY, double maxXY, double zHigh, double zLow, double stdDevZ, std::mt19937 *generator, double *center)
Pointcloud::Ptr concatenate(Pointcloud::Ptr cloud1, Pointcloud::Ptr cloud2)
Pointcloud::Ptr createNormallyDistributedBlobOfPoints(unsigned int nPoints, double mean, double stdDev, std::mt19937 *generator)
Pointcloud::Ptr createPerfectPlane(unsigned int nPoints, double minXY, double maxXY, double desiredHeight, std::mt19937 *generator)
ROSCONSOLE_DECL bool set_logger_level(const std::string &name, levels::Level level)
std::string getTestPcdFilePath()
pcl::PointCloud< Point > Pointcloud
#define ROSCONSOLE_DEFAULT_NAME