Merge branch 'feat/ae_awb' into v2/develop

# Conflicts:
#	orbbec_camera/SDK/arm64/include/libobsensor/h/Property.h
#	orbbec_camera/SDK/arm64/lib/libOrbbecSDK.so.2.10.1
#	orbbec_camera/SDK/x64/lib/libOrbbecSDK.so.2.10.1
#	orbbec_camera/examples/README.MD
This commit is contained in:
ob-yalian
2026-08-25 14:09:12 +08:00
13 changed files with 621 additions and 2 deletions
+90
View File
@@ -303,6 +303,27 @@ void OBCameraNode::setupCameraCtrlServices() {
std::shared_ptr<SetBool::Response> response) {
setAutoWhiteBalanceCallback(request, response);
});
if (isPropertyReadable(device_, OB_PROP_COLOR_AE_AWB_STAT_INT)) {
get_ae_awb_status_srv_ = node_->create_service<GetInt32>(
"get_color_ae_awb_status", [this](const std::shared_ptr<GetInt32::Request> request,
std::shared_ptr<GetInt32::Response> response) {
getAeAwbStatusCallback(request, response);
});
}
if (isPropertyReadable(device_, OB_STRUCT_COLOR_AWB_GAIN)) {
get_awb_gain_srv_ = node_->create_service<GetAwbGain>(
"get_color_awb_gain", [this](const std::shared_ptr<GetAwbGain::Request> request,
std::shared_ptr<GetAwbGain::Response> response) {
getAwbGainCallback(request, response);
});
}
if (isPropertyWritable(device_, OB_STRUCT_COLOR_AWB_GAIN)) {
set_awb_gain_srv_ = node_->create_service<SetAwbGain>(
"set_color_awb_gain", [this](const std::shared_ptr<SetAwbGain::Request> request,
std::shared_ptr<SetAwbGain::Response> response) {
setAwbGainCallback(request, response);
});
}
get_device_srv_ = node_->create_service<GetDeviceInfo>(
"get_device_info", [this](const std::shared_ptr<GetDeviceInfo::Request> request,
std::shared_ptr<GetDeviceInfo::Response> response) {
@@ -1266,6 +1287,75 @@ void OBCameraNode::setAutoWhiteBalanceCallback(const std::shared_ptr<SetBool::Re
}
}
void OBCameraNode::getAeAwbStatusCallback(const std::shared_ptr<GetInt32::Request>& request,
std::shared_ptr<GetInt32::Response>& response) {
(void)request;
try {
response->data = device_->getIntProperty(OB_PROP_COLOR_AE_AWB_STAT_INT);
response->success = true;
} catch (const ob::Error& e) {
response->success = false;
response->message = orbbec_camera::formatObErrorWithStatus(e);
} catch (const std::exception& e) {
response->success = false;
response->message = e.what();
} catch (...) {
response->success = false;
response->message = "unknown error";
}
}
void OBCameraNode::getAwbGainCallback(const std::shared_ptr<GetAwbGain::Request>& request,
std::shared_ptr<GetAwbGain::Response>& response) {
(void)request;
try {
OBAwbGainParams gain{};
uint32_t size = sizeof(gain);
device_->getStructuredData(OB_STRUCT_COLOR_AWB_GAIN, reinterpret_cast<uint8_t*>(&gain), &size);
response->r_gain = gain.rGain;
response->b_gain = gain.bGain;
response->g_gain = gain.gGain;
response->success = true;
} catch (const ob::Error& e) {
response->success = false;
response->message = orbbec_camera::formatObErrorWithStatus(e);
} catch (const std::exception& e) {
response->success = false;
response->message = e.what();
} catch (...) {
response->success = false;
response->message = "unknown error";
}
}
void OBCameraNode::setAwbGainCallback(const std::shared_ptr<SetAwbGain::Request>& request,
std::shared_ptr<SetAwbGain::Response>& response) {
try {
if (device_->getBoolProperty(OB_PROP_COLOR_AUTO_WHITE_BALANCE_BOOL)) {
response->success = false;
response->message = "auto white balance is enabled";
return;
}
OBAwbGainParams gain{};
gain.rGain = request->r_gain;
gain.bGain = request->b_gain;
gain.gGain = request->g_gain;
device_->setStructuredData(OB_STRUCT_COLOR_AWB_GAIN, reinterpret_cast<const uint8_t*>(&gain),
sizeof(gain));
response->success = true;
} catch (const ob::Error& e) {
response->success = false;
response->message = orbbec_camera::formatObErrorWithStatus(e);
} catch (const std::exception& e) {
response->success = false;
response->message = e.what();
} catch (...) {
response->success = false;
response->message = "unknown error";
}
}
void OBCameraNode::setAutoExposureCallback(
const std::shared_ptr<std_srvs::srv::SetBool::Request>& request,
std::shared_ptr<std_srvs::srv::SetBool::Response>& response,