mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-09-12 11:10:19 +08:00
chore: Update time sync interface
This commit is contained in:
@@ -33,12 +33,14 @@ ir_exposure: 5000 # 5ms
|
||||
ir_gain: 40
|
||||
|
||||
#left ir params
|
||||
enable_left_ir: true
|
||||
left_ir_width: 640
|
||||
left_ir_height: 480
|
||||
left_ir_fps: 60
|
||||
left_ir_format: "Y8"
|
||||
|
||||
#right ir params
|
||||
enable_right_ir: true
|
||||
right_ir_width: 640
|
||||
right_ir_height: 480
|
||||
right_ir_fps: 60
|
||||
|
||||
@@ -83,6 +83,7 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
std::recursive_mutex device_lock_;
|
||||
int device_num_ = 1;
|
||||
rclcpp::TimerBase::SharedPtr check_connect_timer_ = nullptr;
|
||||
rclcpp::TimerBase::SharedPtr sync_host_time_timer_ = nullptr;
|
||||
std::shared_ptr<std::thread> reset_device_thread_ = nullptr;
|
||||
std::mutex reset_device_mutex_;
|
||||
std::condition_variable reset_device_cond_;
|
||||
|
||||
@@ -301,7 +301,11 @@ void OBCameraNodeDriver::initializeDevice(const std::shared_ptr<ob::Device> &dev
|
||||
CHECK_NOTNULL(device_info_.get());
|
||||
device_unique_id_ = device_info_->uid();
|
||||
if (!isOpenNIDevice(device_info_->pid())) {
|
||||
ctx_->enableDeviceClockSync(30000); // every 30s sync time
|
||||
sync_host_time_timer_ = this->create_wall_timer(std::chrono::milliseconds(30000), [this]() {
|
||||
if (device_) {
|
||||
device_->timerSyncWithHost();
|
||||
}
|
||||
});
|
||||
}
|
||||
RCLCPP_INFO_STREAM(logger_, "Device " << device_info_->name() << " connected");
|
||||
RCLCPP_INFO_STREAM(logger_, "Serial number: " << device_info_->serialNumber());
|
||||
|
||||
Reference in New Issue
Block a user