refactor: improve logging messages for clarity and consistency in camera node

This commit is contained in:
slz
2026-04-10 17:20:34 +08:00
parent 0035c0b18c
commit 8ec0632b4d
3 changed files with 19 additions and 22 deletions
+8 -8
View File
@@ -643,7 +643,7 @@ void OBCameraNode::setGainCallback(const std::shared_ptr<SetInt32 ::Request>& re
auto range = device_->getIntPropertyRange(prop_id);
if (request->data < range.min || request->data > range.max) {
response->success = false;
RCLCPP_INFO_STREAM(logger_, "Set gain value out of range");
RCLCPP_WARN_STREAM(logger_, "Gain value is out of range");
response->message = "value out of range";
return;
}
@@ -715,9 +715,9 @@ void OBCameraNode::setAeRoiCallback(const std::shared_ptr<SetArrays ::Request>&
device_->getStructuredData(OB_STRUCT_DEPTH_AE_ROI, reinterpret_cast<uint8_t*>(&config),
&data_size);
RCLCPP_INFO_STREAM(
logger_, "set depth AE ROI : "
logger_, "Set depth AE ROI to "
<< "[Left: " << config.x0_left << ", Right: " << config.x1_right
<< ", Top: " << config.y0_top << ", Bottom: " << config.y1_bottom << " ]");
<< ", Top: " << config.y0_top << ", Bottom: " << config.y1_bottom << "]");
break;
case OB_STREAM_COLOR:
case OB_STREAM_COLOR_LEFT:
@@ -751,7 +751,7 @@ void OBCameraNode::setAeRoiCallback(const std::shared_ptr<SetArrays ::Request>&
device_->getStructuredData(OB_STRUCT_COLOR_AE_ROI, reinterpret_cast<uint8_t*>(&config),
&data_size);
RCLCPP_INFO_STREAM(
logger_, "Set color AE ROI : "
logger_, "Set color AE ROI to "
<< "[Left: " << config.x0_left << ", Right: " << config.x1_right
<< ", Top: " << config.y0_top << ", Bottom: " << config.y1_bottom << "]");
break;
@@ -798,13 +798,13 @@ void OBCameraNode::setWhiteBalanceCallback(const std::shared_ptr<SetInt32 ::Requ
auto range = device_->getIntPropertyRange(OB_PROP_COLOR_WHITE_BALANCE_INT);
if (request->data < range.min || request->data > range.max) {
response->success = false;
RCLCPP_INFO_STREAM(logger_, "set white balance value out of range");
RCLCPP_WARN_STREAM(logger_, "White balance value is out of range");
response->message = "value out of range";
return;
}
bool auto_white_balance = device_->getBoolProperty(OB_PROP_COLOR_AUTO_WHITE_BALANCE_BOOL);
if (auto_white_balance) {
RCLCPP_WARN(logger_, "auto white balance is enabled, set white balance will be ignored");
RCLCPP_WARN(logger_, "Auto white balance is enabled, set white balance will be ignored");
response->success = false;
response->message = "auto white balance is enabled";
return;
@@ -885,7 +885,7 @@ void OBCameraNode::setAutoExposureCallback(
auto range = device_->getIntPropertyRange(prop_id);
if (request->data < range.min || request->data > range.max) {
response->success = false;
RCLCPP_INFO_STREAM(logger_, "set auto exposure value out of range");
RCLCPP_WARN_STREAM(logger_, "Auto exposure value is out of range");
response->message = "value out of range";
return;
}
@@ -1272,7 +1272,7 @@ void OBCameraNode::setPtpConfigCallback(
if (!device_->isPropertySupported(OB_DEVICE_PTP_CLOCK_SYNC_ENABLE_BOOL,
OB_PERMISSION_READ_WRITE)) {
response->success = false;
RCLCPP_ERROR(logger_, "OB_DEVICE_PTP_CLOCK_SYNC_ENABLE_BOOL not supported or not writable");
RCLCPP_ERROR(logger_, "PTP clock sync property is not supported or not writable");
return;
}
device_->setBoolProperty(OB_DEVICE_PTP_CLOCK_SYNC_ENABLE_BOOL, request->data);