@@ -163,8 +163,6 @@ void BlockageDiagComponent::filter(
163
163
static_cast <uint >((angle_range_deg_[1 ] - angle_range_deg_[0 ]) / horizontal_resolution_);
164
164
pcl::PointCloud<PointXYZIRADRT>::Ptr pcl_input (new pcl::PointCloud<PointXYZIRADRT>);
165
165
pcl::fromROSMsg (*input, *pcl_input);
166
- std::vector<float > horizontal_bin_reference (ideal_horizontal_bins);
167
- std::vector<pcl::PointCloud<PointXYZIRADRT>> each_ring_pointcloud (vertical_bins);
168
166
cv::Mat full_size_depth_map (
169
167
cv::Size (ideal_horizontal_bins, vertical_bins), CV_16UC1, cv::Scalar (0 ));
170
168
cv::Mat lidar_depth_map (cv::Size (ideal_horizontal_bins, vertical_bins), CV_16UC1, cv::Scalar (0 ));
@@ -184,25 +182,18 @@ void BlockageDiagComponent::filter(
184
182
sky_blockage_range_deg_[0 ] = angle_range_deg_[0 ];
185
183
sky_blockage_range_deg_[1 ] = angle_range_deg_[1 ];
186
184
} else {
187
- for (int i = 0 ; i < ideal_horizontal_bins; ++i) {
188
- horizontal_bin_reference.at (i) = angle_range_deg_[0 ] + i * horizontal_resolution_;
189
- }
190
185
for (const auto p : pcl_input->points ) {
191
- for (int horizontal_bin = 0 ;
192
- horizontal_bin < static_cast <int >(horizontal_bin_reference.size ()); horizontal_bin++) {
193
- if (
194
- (p.azimuth / 100 >
195
- (horizontal_bin_reference.at (horizontal_bin) - horizontal_resolution_ / 2 )) &&
196
- (p.azimuth / 100 <=
197
- (horizontal_bin_reference.at (horizontal_bin) + horizontal_resolution_ / 2 ))) {
198
- if (lidar_model_ == " Pandar40P" ) {
199
- full_size_depth_map.at <uint16_t >(p.ring , horizontal_bin) =
200
- UINT16_MAX - distance_coefficient * p.distance ;
201
- } else if (lidar_model_ == " PandarQT" ) {
202
- full_size_depth_map.at <uint16_t >(vertical_bins - p.ring - 1 , horizontal_bin) =
203
- UINT16_MAX - distance_coefficient * p.distance ;
204
- }
205
- }
186
+ int bin_idx =
187
+ static_cast <int >((p.azimuth / 100 . - angle_range_deg_[0 ]) / horizontal_resolution_);
188
+ if (bin_idx < 0 || bin_idx >= ideal_horizontal_bins) {
189
+ continue ;
190
+ }
191
+ if (lidar_model_ == " Pandar40P" ) {
192
+ full_size_depth_map.at <uint16_t >(p.ring , bin_idx) =
193
+ UINT16_MAX - distance_coefficient * p.distance ;
194
+ } else if (lidar_model_ == " PandarQT" ) {
195
+ full_size_depth_map.at <uint16_t >(vertical_bins - p.ring - 1 , bin_idx) =
196
+ UINT16_MAX - distance_coefficient * p.distance ;
206
197
}
207
198
}
208
199
}
0 commit comments