fix: avoid host time sync on unsupported devices

This commit is contained in:
slz
2026-05-26 20:09:57 +08:00
parent c780bc1108
commit e0a766ed4b
3 changed files with 13 additions and 1 deletions
@@ -151,6 +151,8 @@ rmw_qos_profile_t getRMWQosProfileFromString(const std::string& str_qos);
bool isOpenNIDevice(int pid);
bool isHostTimeSyncSupported(int pid);
OB_DEPTH_PRECISION_LEVEL depthPrecisionLevelFromString(
const std::string& depth_precision_level_str);
+1 -1
View File
@@ -435,7 +435,7 @@ void OBCameraNodeDriver::initializeDevice(const std::shared_ptr<ob::Device> &dev
serial_number_ = device_info_->serialNumber();
CHECK_NOTNULL(device_info_.get());
device_unique_id_ = device_info_->uid();
if (enable_sync_host_time_ && !isOpenNIDevice(device_info_->pid())) {
if (enable_sync_host_time_ && isHostTimeSyncSupported(device_info_->pid())) {
TRY_EXECUTE_BLOCK(device_->timerSyncWithHost());
sync_host_time_timer_ = this->create_wall_timer(std::chrono::milliseconds(30000), [this]() {
if (device_) {
+10
View File
@@ -471,6 +471,16 @@ bool isOpenNIDevice(int pid) {
[pid](int pid_openni) { return pid == pid_openni; });
}
bool isHostTimeSyncSupported(int pid) {
static const std::vector<int> UNSUPPORTED_DEVICE_PIDS = {0x069d};
if (isOpenNIDevice(pid)) {
return false;
}
return std::none_of(UNSUPPORTED_DEVICE_PIDS.begin(), UNSUPPORTED_DEVICE_PIDS.end(),
[pid](int unsupported_pid) { return pid == unsupported_pid; });
}
OB_DEPTH_PRECISION_LEVEL depthPrecisionLevelFromString(
const std::string &depth_precision_level_str) {
if (depth_precision_level_str == "1mm") {