@@ -349,13 +349,12 @@ void ScanGroundFilterComponent::classifyPointCloudGridScan(
349
349
350
350
// check the first point in ray
351
351
auto * p = &in_radial_ordered_clouds[i][0 ];
352
- auto * prev_p = &in_radial_ordered_clouds[i][0 ]; // for checking the distance to prev point
353
352
354
353
bool initialized_first_gnd_grid = false ;
355
354
bool prev_list_init = false ;
356
355
pcl::PointXYZ p_orig_point, prev_p_orig_point;
357
356
for (auto & point : in_radial_ordered_clouds[i]) {
358
- prev_p = p;
357
+ auto * prev_p = p; // for checking the distance to prev point
359
358
prev_p_orig_point = p_orig_point;
360
359
p = &point;
361
360
get_point_from_global_offset (in_cloud, p_orig_point, in_cloud->point_step * p->orig_index );
@@ -469,7 +468,6 @@ void ScanGroundFilterComponent::classifyPointCloud(
469
468
float prev_gnd_slope = 0 .0f ;
470
469
float points_distance = 0 .0f ;
471
470
PointsCentroid ground_cluster, non_ground_cluster;
472
- float local_slope = 0 .0f ;
473
471
PointLabel prev_point_label = PointLabel::INIT;
474
472
pcl::PointXYZ prev_gnd_point (0 , 0 , 0 ), p_orig_point, prev_p_orig_point;
475
473
// loop through each point in the radial div
@@ -524,7 +522,7 @@ void ScanGroundFilterComponent::classifyPointCloud(
524
522
}
525
523
if (calculate_slope) {
526
524
// far from the previous point
527
- local_slope = std::atan2 (height_from_gnd, radius_distance_from_gnd);
525
+ auto local_slope = std::atan2 (height_from_gnd, radius_distance_from_gnd);
528
526
if (local_slope - prev_gnd_slope > local_slope_max_angle) {
529
527
// the point is outside of the local slope threshold
530
528
p->point_state = PointLabel::NON_GROUND;
0 commit comments