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
+3 -3
View File
@@ -233,7 +233,7 @@ void OBLidarNode::setupDevices() {
device_->isPropertySupported(OB_PROP_LIDAR_REPETITIVE_SCAN_MODE_INT,
OB_PERMISSION_READ_WRITE)) {
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_,
"repetitive scan mode value is out of range[%d,%d], please check the value",
range.min, range.max);
@@ -247,7 +247,7 @@ void OBLidarNode::setupDevices() {
if (filter_level_ != -1 &&
device_->isPropertySupported(OB_PROP_LIDAR_TAIL_FILTER_LEVEL_INT, OB_PERMISSION_READ_WRITE)) {
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",
range.min, range.max);
} else {
@@ -261,7 +261,7 @@ void OBLidarNode::setupDevices() {
if (vertical_fov_ != -1.0 &&
device_->isPropertySupported(OB_PROP_LIDAR_MEMS_FOV_SIZE_FLOAT, OB_PERMISSION_READ_WRITE)) {
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",
range.min, range.max);
} else {