mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-08 22:07:46 +08:00
Add validation for invalid property range (min > max)
This commit is contained in:
@@ -406,6 +406,14 @@ void OBCameraNode::setAutoExposureCallback(
|
||||
return;
|
||||
}
|
||||
auto range = device_->getIntPropertyRange(prop_id);
|
||||
if (range.min > range.max) {
|
||||
response->success = false;
|
||||
response->message = "Property is not supported!";
|
||||
RCLCPP_WARN_STREAM(logger_, "Property " << prop_id << " is not supported (min > max)");
|
||||
return;
|
||||
}
|
||||
std::cout << range.min << " " << range.max << std::endl;
|
||||
std::cout << request->data << std::endl;
|
||||
if (request->data < range.min || request->data > range.max) {
|
||||
response->success = false;
|
||||
RCLCPP_INFO_STREAM(logger_, "set auto exposure value out of range");
|
||||
|
||||
Reference in New Issue
Block a user