From e020ba6d3f7e6718574e9de85ee4a6384675e982 Mon Sep 17 00:00:00 2001 From: Joe Dong Date: Thu, 25 Apr 2024 10:53:18 +0800 Subject: [PATCH] Fixed maybe can not read temperature warning --- orbbec_camera/src/ob_camera_node.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/orbbec_camera/src/ob_camera_node.cpp b/orbbec_camera/src/ob_camera_node.cpp index 0dd05a19..bf756c99 100644 --- a/orbbec_camera/src/ob_camera_node.cpp +++ b/orbbec_camera/src/ob_camera_node.cpp @@ -248,10 +248,10 @@ void OBCameraNode::setupProfiles() { for (size_t i = 0; i < profiles->count(); i++) { auto profile = profiles->getProfile(i)->as(); RCLCPP_DEBUG_STREAM( - logger_, "Sensor profile: " - << "stream_type: " << magic_enum::enum_name(profile->type()) - << "Format: " << profile->format() << ", Width: " << profile->width() - << ", Height: " << profile->height() << ", FPS: " << profile->fps()); + logger_, + "Sensor profile: " << "stream_type: " << magic_enum::enum_name(profile->type()) + << "Format: " << profile->format() << ", Width: " << profile->width() + << ", Height: " << profile->height() << ", FPS: " << profile->fps()); supported_profiles_[elem].emplace_back(profile); } std::shared_ptr selected_profile; @@ -636,6 +636,10 @@ void OBCameraNode::setupDiagnosticUpdater() { if (diagnostic_period_ < 0.0) { return; } + if (!device_->isPropertySupported(OB_STRUCT_DEVICE_TEMPERATURE, OB_PERMISSION_READ)) { + RCLCPP_WARN_STREAM(logger_, "Device doesn't support temperature reading."); + return; + } diagnostic_updater_ = std::make_unique(node_, diagnostic_period_); auto info = device_->getDeviceInfo(); CHECK_NOTNULL(info);