Commit 0959959 1 parent 87dbb2e commit 0959959 Copy full SHA for 0959959
File tree 6 files changed +26
-26
lines changed
nebula_decoders/include/nebula_decoders/nebula_decoders_hesai/decoders
nebula_hw_interfaces/src/nebula_hesai_hw_interfaces
nebula_ros/config/lidar/hesai
6 files changed +26
-26
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class AngleCorrector
52
52
// / @brief Returns whether the given block (azimuth) is the last in the current scan
53
53
// / @param block_azimuth The current azimuth value in the sensor's angle resolution
54
54
// / @return true if the current azimuth is the last in the current scan, false otherwise
55
- virtual bool blockCompletesScan (uint32_t block_azimuth) = 0;
55
+ virtual bool blockCompletesScan (uint32_t block_azimuth, uint32_t last_azimuth ) = 0;
56
56
};
57
57
58
58
} // namespace drivers
Original file line number Diff line number Diff line change @@ -78,20 +78,12 @@ class AngleCorrectorCalibrationBased : public AngleCorrector<HesaiCalibrationCon
78
78
}
79
79
}
80
80
81
- auto scan_cut_block_azimuth = static_cast <uint32_t >(rad2deg (scan_cut_azimuth_rad) * 10.0 );
82
- while (true ) {
83
- auto block_azimuth_rad = block_azimuth_rad_[scan_cut_block_azimuth];
84
- for (auto correction : azimuth_offset_rad_) {
85
- if (block_azimuth_rad + correction < scan_cut_azimuth_rad) {
86
- scan_cut_block_azimuth_++;
87
- break ;
88
- }
89
- }
90
-
91
- break ;
92
- }
81
+ auto min_azimuth_offset = std::min (azimuth_offset_rad_);
82
+
93
83
94
84
scan_cut_block_azimuth_ = scan_cut_block_azimuth;
85
+ std::cout << " Cut angle setting: " << rad2deg (scan_cut_azimuth_rad)
86
+ << " deg, calculated: " << scan_cut_block_azimuth_ / 100.0 << " deg" << std::endl;
95
87
}
96
88
97
89
CorrectedAngleData getCorrectedAngleData (uint32_t block_azimuth, uint32_t channel_id) override
@@ -108,9 +100,13 @@ class AngleCorrectorCalibrationBased : public AngleCorrector<HesaiCalibrationCon
108
100
elevation_cos_[channel_id]};
109
101
}
110
102
111
- bool blockCompletesScan (uint32_t current_azimuth) override
103
+ bool blockCompletesScan (uint32_t current_azimuth, uint32_t last_azimuth ) override
112
104
{
113
- return current_azimuth == scan_cut_block_azimuth_;
105
+ if (current_azimuth < last_azimuth) {
106
+ current_azimuth += MAX_AZIMUTH_LEN;
107
+ }
108
+
109
+ return current_azimuth >= scan_cut_block_azimuth_ && last_azimuth < scan_cut_block_azimuth_;
114
110
}
115
111
};
116
112
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ class AngleCorrectorCorrectionBased : public AngleCorrector<HesaiCorrection>
126
126
cos_[azimuth], sin_[elevation], cos_[elevation]};
127
127
}
128
128
129
- bool blockCompletesScan (uint32_t block_azimuth) override
129
+ bool blockCompletesScan (uint32_t block_azimuth, uint32_t last_azimuth ) override
130
130
{
131
131
auto begin = cut_azimuths_.cbegin ();
132
132
auto end = cut_azimuths_.cend ();
Original file line number Diff line number Diff line change @@ -237,7 +237,7 @@ class HesaiDecoder : public HesaiScanDecoder
237
237
return static_cast <uint32_t >(sensor_configuration_->scan_phase * 10 );
238
238
}
239
239
240
- return sensor_configuration_->cloud_max_angle ;
240
+ return sensor_configuration_->cloud_max_angle * 10 ;
241
241
}
242
242
243
243
public:
@@ -281,7 +281,7 @@ class HesaiDecoder : public HesaiScanDecoder
281
281
convertReturns (block_id, n_returns);
282
282
283
283
auto block_azimuth = packet_.body .blocks [block_id].get_azimuth ();
284
- bool scan_completed = angle_corrector_.blockCompletesScan (block_azimuth);
284
+ bool scan_completed = angle_corrector_.blockCompletesScan (block_azimuth, last_phase_ );
285
285
286
286
if (scan_completed) {
287
287
std::swap (decode_pc_, output_pc_);
Original file line number Diff line number Diff line change @@ -505,14 +505,16 @@ HesaiLidarRangeAll HesaiHwInterface::GetLidarRange()
505
505
Status HesaiHwInterface::checkAndSetLidarRange (
506
506
const HesaiCalibrationConfigurationBase & calibration)
507
507
{
508
- int cloud_min = sensor_configuration_->cloud_min_angle ;
509
- int cloud_max = sensor_configuration_->cloud_max_angle ;
508
+ int cloud_min = sensor_configuration_->cloud_min_angle * 10 ;
509
+ int cloud_max = sensor_configuration_->cloud_max_angle * 10 ;
510
+
511
+ std::cout << " Starting with HW FoV of " << cloud_min << " ~" << cloud_max << std::endl;
510
512
511
513
// Only oversize the FoV if it is not already the full 360deg
512
- if (cloud_max - cloud_min < 3600 ) {
514
+ if (cloud_min != 0 || cloud_max != 3600 ) {
513
515
auto padding = calibration.getFovPadding ();
514
- cloud_min += static_cast < int > (std::get<0 >(padding) * 10 );
515
- cloud_max += static_cast < int > (std::get<1 >(padding) * 10 );
516
+ cloud_min += floor (std::get<0 >(padding) * 10 );
517
+ cloud_max += ceil (std::get<1 >(padding) * 10 );
516
518
}
517
519
518
520
auto clamp = [](int x) {
@@ -521,6 +523,8 @@ Status HesaiHwInterface::checkAndSetLidarRange(
521
523
return x;
522
524
};
523
525
526
+ std::cout << " Setting HW FoV to " << cloud_min << " ~" << cloud_max << std::endl;
527
+
524
528
return SetLidarRange (clamp (cloud_min), clamp (cloud_max));
525
529
}
526
530
Original file line number Diff line number Diff line change 1
1
/** :
2
2
ros__parameters :
3
- host_ip : 255.255.255.255
3
+ host_ip : 192.168.1.10
4
4
sensor_ip : 192.168.1.201
5
5
data_port : 2368
6
6
gnss_port : 10110
11
11
diag_span : 1000
12
12
min_range : 0.3
13
13
max_range : 300.0
14
- cloud_min_angle : 0
15
- cloud_max_angle : 360
14
+ cloud_min_angle : 90
15
+ cloud_max_angle : 270
16
16
scan_phase : 0.0
17
17
sensor_model : Pandar128E4X
18
18
calibration_file : $(find-pkg-share nebula_decoders)/calibration/hesai/$(var sensor_model).csv
You can’t perform that action at this time.
0 commit comments