fix intra-process QoS crash in device status publisher

This commit is contained in:
ob-yalian
2025-11-18 11:43:40 +08:00
parent 2906aff06e
commit d4fddf37c9
4 changed files with 16 additions and 10 deletions
+7 -6
View File
@@ -258,16 +258,17 @@ void OBCameraNodeDriver::init() {
check_connect_timer_ =
this->create_wall_timer(std::chrono::milliseconds(1000), [this]() { checkConnectTimer(); });
CHECK_NOTNULL(check_connect_timer_);
query_thread_ = std::make_shared<std::thread>([this]() { queryDevice(); });
reset_device_thread_ = std::make_shared<std::thread>([this]() { resetDevice(); });
device_status_timer_ =
this->create_wall_timer(std::chrono::milliseconds(1000 / device_status_interval_hz),
[this]() { deviceStatusTimer(); });
// Initialize device status publisher
auto qos = rclcpp::QoS(1).transient_local();
if (node_options_.use_intra_process_comms()) {
qos = rclcpp::QoS(1);
}
device_status_pub_ = this->create_publisher<orbbec_camera_msgs::msg::DeviceStatus>(
"device_status", rclcpp::QoS(1).transient_local());
"device_status", qos);
query_thread_ = std::make_shared<std::thread>([this]() { queryDevice(); });
reset_device_thread_ = std::make_shared<std::thread>([this]() { resetDevice(); });
}
void OBCameraNodeDriver::onDeviceConnected(const std::shared_ptr<ob::DeviceList> &device_list) {