refactor: improve logging for host time synchronization in OBCameraNodeDriver

This commit is contained in:
ob-yalian
2026-04-01 10:41:22 +08:00
parent 2bcd813654
commit 6a449132fc
+2 -2
View File
@@ -981,7 +981,6 @@ void OBCameraNodeDriver::initializeDevice(const std::shared_ptr<ob::Device> &dev
if (enable_sync_host_time_ && !isOpenNIDevice(device_info_->pid()) && device_type_ == "camera") { if (enable_sync_host_time_ && !isOpenNIDevice(device_info_->pid()) && device_type_ == "camera") {
TRY_EXECUTE_BLOCK(device_->timerSyncWithHost()); TRY_EXECUTE_BLOCK(device_->timerSyncWithHost());
if (g_time_domain != "global") { if (g_time_domain != "global") {
RCLCPP_INFO_STREAM(logger_, "Enable periodic host time sync with device");
device_->enableGlobalTimestamp(false); device_->enableGlobalTimestamp(false);
sync_host_time_timer_ = this->create_wall_timer(time_sync_period_, [this]() { sync_host_time_timer_ = this->create_wall_timer(time_sync_period_, [this]() {
// Multiple safety checks before attempting time sync // Multiple safety checks before attempting time sync
@@ -1029,9 +1028,10 @@ void OBCameraNodeDriver::initializeDevice(const std::shared_ptr<ob::Device> &dev
return; return;
} }
RCLCPP_INFO_STREAM(logger_, "Sync device time with host");
TRY_EXECUTE_BLOCK(device_->timerSyncWithHost()); TRY_EXECUTE_BLOCK(device_->timerSyncWithHost());
}); });
RCLCPP_INFO_STREAM(logger_, "Enabled timer sync with host with period "
<< time_sync_period_.count() << " ms");
} }
} }