fix: correct range checks for repetitive scan mode, filter level, and vertical fov

This commit is contained in:
slz
2025-12-25 16:33:29 +08:00
parent d8dbabb16f
commit cd741b1001
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ def generate_launch_description():
DeclareLaunchArgument( DeclareLaunchArgument(
'repetitive_scan_mode', 'repetitive_scan_mode',
default_value='-1', default_value='-1',
description='Repetitive scan mode. -1 uses device default; 0 non-repeating; 1/2/4 for different repetition frequencies.' description='Repetitive scan mode. -1 uses device default; 0 non-repeating; 1/2/3 for different modes.'
), ),
DeclareLaunchArgument( DeclareLaunchArgument(
'filter_level', 'filter_level',
+3 -3
View File
@@ -233,7 +233,7 @@ void OBLidarNode::setupDevices() {
device_->isPropertySupported(OB_PROP_LIDAR_REPETITIVE_SCAN_MODE_INT, device_->isPropertySupported(OB_PROP_LIDAR_REPETITIVE_SCAN_MODE_INT,
OB_PERMISSION_READ_WRITE)) { OB_PERMISSION_READ_WRITE)) {
auto range = device_->getIntPropertyRange(OB_PROP_LIDAR_REPETITIVE_SCAN_MODE_INT); auto range = device_->getIntPropertyRange(OB_PROP_LIDAR_REPETITIVE_SCAN_MODE_INT);
if (repetitive_scan_mode_ <= range.min || repetitive_scan_mode_ >= range.max) { if (repetitive_scan_mode_ < range.min || repetitive_scan_mode_ > range.max) {
RCLCPP_ERROR(logger_, RCLCPP_ERROR(logger_,
"repetitive scan mode value is out of range[%d,%d], please check the value", "repetitive scan mode value is out of range[%d,%d], please check the value",
range.min, range.max); range.min, range.max);
@@ -247,7 +247,7 @@ void OBLidarNode::setupDevices() {
if (filter_level_ != -1 && if (filter_level_ != -1 &&
device_->isPropertySupported(OB_PROP_LIDAR_TAIL_FILTER_LEVEL_INT, OB_PERMISSION_READ_WRITE)) { device_->isPropertySupported(OB_PROP_LIDAR_TAIL_FILTER_LEVEL_INT, OB_PERMISSION_READ_WRITE)) {
auto range = device_->getIntPropertyRange(OB_PROP_LIDAR_TAIL_FILTER_LEVEL_INT); auto range = device_->getIntPropertyRange(OB_PROP_LIDAR_TAIL_FILTER_LEVEL_INT);
if (filter_level_ <= range.min || filter_level_ >= range.max) { if (filter_level_ < range.min || filter_level_ > range.max) {
RCLCPP_ERROR(logger_, "filter level value is out of range[%d,%d], please check the value", RCLCPP_ERROR(logger_, "filter level value is out of range[%d,%d], please check the value",
range.min, range.max); range.min, range.max);
} else { } else {
@@ -261,7 +261,7 @@ void OBLidarNode::setupDevices() {
if (vertical_fov_ != -1.0 && if (vertical_fov_ != -1.0 &&
device_->isPropertySupported(OB_PROP_LIDAR_MEMS_FOV_SIZE_FLOAT, OB_PERMISSION_READ_WRITE)) { device_->isPropertySupported(OB_PROP_LIDAR_MEMS_FOV_SIZE_FLOAT, OB_PERMISSION_READ_WRITE)) {
auto range = device_->getFloatPropertyRange(OB_PROP_LIDAR_MEMS_FOV_SIZE_FLOAT); auto range = device_->getFloatPropertyRange(OB_PROP_LIDAR_MEMS_FOV_SIZE_FLOAT);
if (vertical_fov_ <= range.min || vertical_fov_ >= range.max) { if (vertical_fov_ < range.min || vertical_fov_ > range.max) {
RCLCPP_ERROR(logger_, "vertical fov value is out of range[%f,%f], please check the value", RCLCPP_ERROR(logger_, "vertical fov value is out of range[%f,%f], please check the value",
range.min, range.max); range.min, range.max);
} else { } else {