mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-06 04:57:45 +08:00
refactor: remove commented-out rebootDeviceCallback implementation
This commit is contained in:
@@ -754,97 +754,6 @@ void OBCameraNodeDriver::rebootDeviceCallback(
|
||||
malloc_trim(0);
|
||||
return;
|
||||
}
|
||||
// void OBCameraNodeDriver::rebootDeviceCallback(
|
||||
// const std::shared_ptr<std_srvs::srv::Empty::Request> request,
|
||||
// std::shared_ptr<std_srvs::srv::Empty::Response> response) {
|
||||
// (void)request;
|
||||
// (void)response;
|
||||
|
||||
// malloc_trim(0);
|
||||
// RCLCPP_INFO(logger_, "Reboot device service called");
|
||||
|
||||
// struct timespec timeout;
|
||||
// clock_gettime(CLOCK_REALTIME, &timeout);
|
||||
// timeout.tv_sec += 15;
|
||||
|
||||
// int lock_result = pthread_mutex_timedlock(orb_device_lock_, &timeout);
|
||||
// if (lock_result != 0) {
|
||||
// RCLCPP_WARN(logger_, "Failed to acquire process lock for reboot: %s", strerror(lock_result));
|
||||
// return;
|
||||
// }
|
||||
|
||||
// if (ob_camera_node_) {
|
||||
// std::shared_ptr<int> process_lock_guard(
|
||||
// nullptr, [this](int *) { pthread_mutex_unlock(orb_device_lock_); });
|
||||
|
||||
// try {
|
||||
// std::unique_lock<decltype(reset_device_mutex_)> reset_lock(reset_device_mutex_);
|
||||
// reset_device_flag_ = true;
|
||||
// {
|
||||
// std::lock_guard<decltype(device_lock_)> device_lock(device_lock_);
|
||||
|
||||
// if (!device_connected_ || !ob_camera_node_) {
|
||||
// RCLCPP_INFO(logger_, "Device not connected");
|
||||
// reset_device_flag_ = false;
|
||||
// } else {
|
||||
// std::string current_device_uid = device_unique_id_;
|
||||
// RCLCPP_INFO_STREAM(logger_, "Rebooting device with UID: " << current_device_uid);
|
||||
// ob_camera_node_->rebootDevice();
|
||||
// }
|
||||
// }
|
||||
// if (reset_device_flag_) {
|
||||
// RCLCPP_INFO(logger_, "Device reboot initiated, waiting for reconnection");
|
||||
// }
|
||||
|
||||
// } catch (std::exception &e) {
|
||||
// RCLCPP_ERROR_STREAM(logger_, "Failed to reboot device: " << e.what());
|
||||
// } catch (...) {
|
||||
// RCLCPP_ERROR_STREAM(logger_, "Failed to reboot device: unknown error");
|
||||
// }
|
||||
// process_lock_guard.reset();
|
||||
// if (reset_device_flag_) {
|
||||
// reset_device_cond_.notify_all();
|
||||
// }
|
||||
// malloc_trim(0);
|
||||
// return;
|
||||
// } else if (ob_lidar_node_) {
|
||||
// std::shared_ptr<int> process_lock_guard(
|
||||
// nullptr, [this](int *) { pthread_mutex_unlock(orb_device_lock_); });
|
||||
|
||||
// try {
|
||||
// std::unique_lock<decltype(reset_device_mutex_)> reset_lock(reset_device_mutex_);
|
||||
// reset_device_flag_ = true;
|
||||
// {
|
||||
// std::lock_guard<decltype(device_lock_)> device_lock(device_lock_);
|
||||
|
||||
// if (!device_connected_ || !ob_lidar_node_) {
|
||||
// RCLCPP_INFO(logger_, "Device not connected");
|
||||
// reset_device_flag_ = false;
|
||||
// } else {
|
||||
// std::string current_device_uid = device_unique_id_;
|
||||
// RCLCPP_INFO_STREAM(logger_, "Rebooting lidar device with UID: " << current_device_uid);
|
||||
// ob_lidar_node_->rebootDevice();
|
||||
// }
|
||||
// }
|
||||
// if (reset_device_flag_) {
|
||||
// RCLCPP_INFO(logger_, "Lidar device reboot initiated, waiting for reconnection");
|
||||
// }
|
||||
|
||||
// } catch (std::exception &e) {
|
||||
// RCLCPP_ERROR_STREAM(logger_, "Failed to reboot lidar device: " << e.what());
|
||||
// } catch (...) {
|
||||
// RCLCPP_ERROR_STREAM(logger_, "Failed to reboot lidar device: unknown error");
|
||||
// }
|
||||
// process_lock_guard.reset();
|
||||
// if (reset_device_flag_) {
|
||||
// reset_device_cond_.notify_all();
|
||||
// }
|
||||
// malloc_trim(0);
|
||||
// } else {
|
||||
// // No device node exists, just unlock
|
||||
// pthread_mutex_unlock(orb_device_lock_);
|
||||
// }
|
||||
// }
|
||||
|
||||
std::shared_ptr<ob::Device> OBCameraNodeDriver::selectDevice(
|
||||
const std::shared_ptr<ob::DeviceList> &list) {
|
||||
|
||||
Reference in New Issue
Block a user