mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-04 12:07:46 +08:00
fix: accept full Action Command key range
This commit is contained in:
@@ -19,7 +19,6 @@
|
|||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <rclcpp/rclcpp.hpp>
|
#include <rclcpp/rclcpp.hpp>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <stdexcept>
|
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "orbbec_camera/utils.h"
|
#include "orbbec_camera/utils.h"
|
||||||
@@ -1758,20 +1757,6 @@ void OBCameraNode::setActionConfigCallback(const std::shared_ptr<SetActionConfig
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto validate_property = [this](OBPropertyID property_id, uint32_t value,
|
|
||||||
const char* property_name) {
|
|
||||||
const auto range = device_->getIntPropertyRange(property_id);
|
|
||||||
const int64_t signed_value = static_cast<int64_t>(value);
|
|
||||||
if (signed_value < range.min || signed_value > range.max) {
|
|
||||||
throw std::out_of_range(std::string(property_name) + " must be in [" +
|
|
||||||
std::to_string(range.min) + ", " + std::to_string(range.max) + "]");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
validate_property(OB_PROP_ACTION_DEVICE_KEY_INT, request->device_key, "device_key");
|
|
||||||
validate_property(OB_PROP_ACTION_SELECTOR_INT, request->selector, "selector");
|
|
||||||
validate_property(OB_PROP_ACTION_GROUP_KEY_INT, request->group_key, "group_key");
|
|
||||||
validate_property(OB_PROP_ACTION_GROUP_MASK_INT, request->group_mask, "group_mask");
|
|
||||||
|
|
||||||
device_->setIntProperty(OB_PROP_ACTION_DEVICE_KEY_INT,
|
device_->setIntProperty(OB_PROP_ACTION_DEVICE_KEY_INT,
|
||||||
static_cast<int32_t>(request->device_key));
|
static_cast<int32_t>(request->device_key));
|
||||||
device_->setIntProperty(OB_PROP_ACTION_SELECTOR_INT, static_cast<int32_t>(request->selector));
|
device_->setIntProperty(OB_PROP_ACTION_SELECTOR_INT, static_cast<int32_t>(request->selector));
|
||||||
|
|||||||
Reference in New Issue
Block a user