mirror of
https://github.com/orbbec/OrbbecSDK_ROS2.git
synced 2026-10-07 21:37:46 +08:00
Fix crash by improving lock handling
This commit is contained in:
@@ -42,5 +42,9 @@ class D2CViewer {
|
||||
sensor_msgs::msg::Image>;
|
||||
std::shared_ptr<message_filters::Synchronizer<MySyncPolicy>> sync_;
|
||||
rclcpp::Publisher<sensor_msgs::msg::Image>::SharedPtr d2c_viewer_pub_;
|
||||
|
||||
// Add thread safety
|
||||
std::mutex callback_mutex_;
|
||||
std::atomic<bool> is_active_{true};
|
||||
};
|
||||
} // namespace orbbec_camera
|
||||
|
||||
@@ -87,6 +87,7 @@ class OBCameraNodeDriver : public rclcpp::Node {
|
||||
std::shared_ptr<ob::DeviceInfo> device_info_ = nullptr;
|
||||
std::atomic_bool is_alive_{false};
|
||||
std::atomic_bool device_connected_{false};
|
||||
std::atomic_bool device_connecting_{false};
|
||||
std::string serial_number_;
|
||||
std::string device_unique_id_;
|
||||
std::string usb_port_;
|
||||
|
||||
Reference in New Issue
Block a user