@@ -25,6 +25,7 @@ using nonstd::optional;
25
25
26
26
using namespace std ::chrono_literals;
27
27
using namespace std ::string_literals;
28
+ using std::to_string;
28
29
29
30
namespace ouster_ros {
30
31
@@ -232,6 +233,9 @@ sensor::sensor_config OusterSensor::parse_config_from_ros_parameters() {
232
233
auto lidar_mode_arg = nh.param (" lidar_mode" , std::string{});
233
234
auto timestamp_mode_arg = nh.param (" timestamp_mode" , std::string{});
234
235
auto udp_profile_lidar_arg = nh.param (" udp_profile_lidar" , std::string{});
236
+ const int MIN_AZW = 0 , MAX_AZW = 360000 ;
237
+ auto azimuth_window_start = nh.param (" azimuth_window_start" , MIN_AZW);
238
+ auto azimuth_window_end = nh.param (" azimuth_window_end" , MAX_AZW);
235
239
236
240
if (lidar_port < 0 || lidar_port > 65535 ) {
237
241
auto error_msg =
@@ -325,6 +329,16 @@ sensor::sensor_config OusterSensor::parse_config_from_ros_parameters() {
325
329
}
326
330
}
327
331
332
+ if (azimuth_window_start < MIN_AZW || azimuth_window_start > MAX_AZW ||
333
+ azimuth_window_end < MIN_AZW || azimuth_window_end > MAX_AZW) {
334
+ auto error_msg = " azimuth window values must be between " +
335
+ to_string (MIN_AZW) + " and " + to_string (MAX_AZW);
336
+ NODELET_ERROR_STREAM (error_msg);
337
+ throw std::runtime_error (error_msg);
338
+ }
339
+
340
+ config.azimuth_window = {azimuth_window_start, azimuth_window_end};
341
+
328
342
return config;
329
343
}
330
344
@@ -450,9 +464,8 @@ void OusterSensor::allocate_buffers() {
450
464
bool OusterSensor::init_id_changed (const sensor::packet_format& pf,
451
465
const uint8_t * lidar_buf) {
452
466
uint32_t current_init_id = pf.init_id (lidar_buf);
453
- if (!last_init_id_initialized ) {
467
+ if (!last_init_id ) {
454
468
last_init_id = current_init_id + 1 ;
455
- last_init_id_initialized = true ;
456
469
}
457
470
if (reset_last_init_id && last_init_id != current_init_id) {
458
471
last_init_id = current_init_id;
0 commit comments