Skip to content

Commit dad3187

Browse files
Merge branch 'feature/grid_map_pcl_maxmin_elevation' into 'master'
[grid_map_pcl] Added a parameter to choose whether elevation takes min or max values as reference GitOrigin-RevId: e10b0e41c9709a36cd256bb53d2dee520c43aa25
1 parent 6487412 commit dad3187

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

grid_map_pcl/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This is a C++ package integrated with ROS for computing 2.5D elevation maps from
88
The elevation is computed by raytracing lines coming from the grid map cells and computing their intersection with the mesh.
99

1010
#### Converting a raw pointcloud to a grid map
11-
The elevation is computed by slicing the point cloud in the x-y plane into columns. Column location and size correspond to the location and size of grid map cells in the point cloud coordinate frame. Subsequently, the clustering of points inside each column is performed and the elevation of the lowest cluster (min z coordinate) is assumed to be the terrain elevation. The elevation of the cluster is computed as a mean of all positions from the points that belong to a cluster. All calculations are performed in the pointcloud frame.
11+
The elevation is computed by slicing the point cloud in the x-y plane into columns. Column location and size correspond to the location and size of grid map cells in the point cloud coordinate frame. Subsequently, the clustering of points inside each column is performed and the elevation of the lowest or highest cluster (min/max z coordinate) is assumed to be the terrain elevation. The elevation of the cluster is computed as a mean of all positions from the points that belong to a cluster. All calculations are performed in the pointcloud frame.
1212

1313

1414
**Authors: Edo Jelavic, Dominic Jud<br />
@@ -65,6 +65,7 @@ Cluster extraction is based on pcl algorithms. See: http://pointclouds.org/docum
6565
* **pcl_grid_map_extraction/cluster_extraction/cluster_tolerance** Distance between points below which they will still be considered part of one cluster.
6666
* **pcl_grid_map_extraction/cluster_extraction/min_num_points** Min number of points that a cluster needs to have (otherwise it will be discarded).
6767
* **pcl_grid_map_extraction/cluster_extraction/max_num_points** Max number of points that a cluster can have (otherwise it will be discarded).
68+
* **pcl_grid_map_extraction/cluster_extraction/use_max_height_as_cell_elevation** Use the maximum cluster to extract the cell height. If false (default), the lowest cluster is taken.
6869

6970
##### Outlier removal parameters
7071
See http://pointclouds.org/documentation/tutorials/statistical_outlier.php for more explanation on outlier removal.

grid_map_pcl/config/parameters.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pcl_grid_map_extraction:
1313
cluster_tolerance: 0.05
1414
min_num_points: 4
1515
max_num_points: 1000000
16+
use_max_height_as_cell_elevation: false
1617
outlier_removal:
1718
is_remove_outliers: true
1819
mean_K: 10

grid_map_pcl/include/grid_map_pcl/PclLoaderParameters.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class PclLoaderParameters {
3232
double clusterTolerance_ = 0.3;
3333
unsigned int minNumPoints_ = 2;
3434
unsigned int maxNumPoints_ = 1000000;
35+
bool useMaxHeightAsCellElevation_;
3536
};
3637
struct OutlierRemovalParameters {
3738
bool isRemoveOutliers_ = false;

grid_map_pcl/src/GridMapPclLoader.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,10 @@ double GridMapPclLoader::calculateElevationFromPointsInsideGridMapCell(
174174
std::transform(clusterClouds.begin(), clusterClouds.end(), clusterHeights.begin(),
175175
[this](Pointcloud::ConstPtr cloud) -> double {return grid_map_pcl::calculateMeanOfPointPositions(cloud).z();});
176176

177-
double minClusterHeight = *(std::min_element(clusterHeights.begin(), clusterHeights.end()));
177+
const double clusterHeight = params_->get().clusterExtraction_.useMaxHeightAsCellElevation_ ? *(std::max_element(clusterHeights.begin(), clusterHeights.end()))
178+
: *(std::min_element(clusterHeights.begin(), clusterHeights.end()));
178179

179-
return minClusterHeight;
180+
return clusterHeight;
180181
}
181182

182183
GridMapPclLoader::Pointcloud::Ptr GridMapPclLoader::getPointcloudInsideGridMapCellBorder(

grid_map_pcl/src/PclLoaderParameters.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ void PclLoaderParameters::handleYamlNode(const YAML::Node &yamlNode) {
3636
parameters_.cloudTransformation_.rpyIntrinsic_.z() =
3737
yamlNode[prefix]["cloud_transform"]["rotation"]["y"].as<double>();
3838

39+
parameters_.clusterExtraction_.useMaxHeightAsCellElevation_ =
40+
yamlNode[prefix]["cluster_extraction"]["use_max_height_as_cell_elevation"].as<
41+
bool>();
3942
parameters_.clusterExtraction_.clusterTolerance_ =
4043
yamlNode[prefix]["cluster_extraction"]["cluster_tolerance"].as<
4144
double>();

0 commit comments

Comments
 (0)