Skip to content

Commit

Permalink
fix(hesai): workaround for PCL bug to fix pointcloud size fields when…
Browse files Browse the repository at this point in the history
… filters are enabled

Signed-off-by: Max SCHMELLER <[email protected]>
  • Loading branch information
mojomex committed Oct 21, 2024
1 parent 5284e97 commit d035408
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class HesaiDecoder : public HesaiScanDecoder
auto scan_timestamp_ns =
in_current_scan ? decode_scan_timestamp_ns_ : output_scan_timestamp_ns_;

NebulaPoint & point = pc->emplace_back();
NebulaPoint point;
point.distance = distance;
point.intensity = unit.reflectivity;
point.time_stamp = getPointTimeRelative(
Expand All @@ -214,12 +214,17 @@ class HesaiDecoder : public HesaiScanDecoder
// The driver wrapper converts to degrees, expects radians
point.azimuth = corrected_angle_data.azimuth_rad;
point.elevation = corrected_angle_data.elevation_rad;
for (const auto & filter : sensor_configuration_->point_filters) {
if (filter->excluded(point)) {
pc->points.pop_back();
break;
}

const auto & filters = sensor_configuration_->point_filters;
bool excluded = std::any_of(filters.begin(), filters.end(), [&](const auto & filter) {
return filter->excluded(point);
});

if (excluded) {
continue;
}

pc->emplace_back(point);
}
}
}
Expand Down

0 comments on commit d035408

Please sign in to comment.