Add enable_3d_reconstruction_mode params for 3d reconstruction scenario

This commit is contained in:
Joe Dong
2024-07-09 13:55:34 +08:00
parent 51bf9ecb33
commit a5a81d1791
7 changed files with 110 additions and 26 deletions
+1 -15
View File
@@ -24,7 +24,6 @@
#include <sys/mman.h>
#include <unistd.h>
namespace orbbec_camera {
OBCameraNodeDriver::OBCameraNodeDriver(const rclcpp::NodeOptions &node_options)
: Node("orbbec_camera_node", "/", node_options),
@@ -48,9 +47,6 @@ OBCameraNodeDriver::~OBCameraNodeDriver() {
if (device_count_update_thread_ && device_count_update_thread_->joinable()) {
device_count_update_thread_->join();
}
if (sync_time_thread_ && sync_time_thread_->joinable()) {
sync_time_thread_->join();
}
if (query_thread_ && query_thread_->joinable()) {
query_thread_->join();
}
@@ -104,7 +100,6 @@ void OBCameraNodeDriver::init() {
this->create_wall_timer(std::chrono::milliseconds(1000), [this]() { checkConnectTimer(); });
CHECK_NOTNULL(check_connect_timer_);
query_thread_ = std::make_shared<std::thread>([this]() { queryDevice(); });
sync_time_thread_ = std::make_shared<std::thread>([this]() { syncTime(); });
reset_device_thread_ = std::make_shared<std::thread>([this]() { resetDevice(); });
}
@@ -183,15 +178,6 @@ void OBCameraNodeDriver::queryDevice() {
}
}
void OBCameraNodeDriver::syncTime() {
while (is_alive_ && rclcpp::ok()) {
if (device_ && device_info_ && !isOpenNIDevice(device_info_->pid())) {
ctx_->enableDeviceClockSync(0);
}
std::this_thread::sleep_for(std::chrono::milliseconds(5000));
}
}
void OBCameraNodeDriver::resetDevice() {
while (is_alive_ && rclcpp::ok()) {
std::unique_lock<decltype(reset_device_mutex_)> lock(reset_device_mutex_);
@@ -315,7 +301,7 @@ 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(0); // sync time stamp
ctx_->enableDeviceClockSync(30000); // every 30s sync time
}
RCLCPP_INFO_STREAM(logger_, "Device " << device_info_->name() << " connected");
RCLCPP_INFO_STREAM(logger_, "Serial number: " << device_info_->serialNumber());