Skip to content

Commit 3489729

Browse files
committed
feat(hesai_decoder): filter points outside of configured FoV
1 parent f4add9a commit 3489729

File tree

1 file changed

+18
-2
lines changed
  • nebula_decoders/include/nebula_decoders/nebula_decoders_hesai/decoders

1 file changed

+18
-2
lines changed

nebula_decoders/include/nebula_decoders/nebula_decoders_hesai/decoders/hesai_decoder.hpp

+18-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#pragma once
1616

17+
#include "nebula_decoders/nebula_decoders_hesai/decoders/angle_corrector.hpp"
1718
#include "nebula_decoders/nebula_decoders_hesai/decoders/hesai_packet.hpp"
1819
#include "nebula_decoders/nebula_decoders_hesai/decoders/hesai_scan_decoder.hpp"
1920

@@ -159,6 +160,23 @@ class HesaiDecoder : public HesaiScanDecoder
159160
}
160161
}
161162

163+
CorrectedAngleData corrected_angle_data =
164+
angle_corrector_.getCorrectedAngleData(raw_azimuth, channel_id);
165+
166+
{
167+
auto min_angle = deg2rad(sensor_configuration_->cloud_min_angle);
168+
auto max_angle = deg2rad(sensor_configuration_->cloud_max_angle);
169+
const auto & azimuth = corrected_angle_data.azimuth_rad;
170+
171+
bool inside_fov =
172+
(min_angle <= azimuth && azimuth <= max_angle) ||
173+
((max_angle < min_angle) && (azimuth <= max_angle || min_angle <= azimuth));
174+
175+
if (!inside_fov) {
176+
continue;
177+
}
178+
}
179+
162180
NebulaPoint point;
163181
point.distance = distance;
164182
point.intensity = unit.reflectivity;
@@ -168,8 +186,6 @@ class HesaiDecoder : public HesaiScanDecoder
168186
point.return_type = static_cast<uint8_t>(return_type);
169187
point.channel = channel_id;
170188

171-
auto corrected_angle_data = angle_corrector_.getCorrectedAngleData(raw_azimuth, channel_id);
172-
173189
// The raw_azimuth and channel are only used as indices, sin/cos functions use the precise
174190
// corrected angles
175191
float xyDistance = distance * corrected_angle_data.cos_elevation;

0 commit comments

Comments
 (0)