fix: lock LRM distance topic property reads

This commit is contained in:
slz
2026-07-09 09:42:19 +08:00
parent 9af4ecf39a
commit 6318725425
+4 -1
View File
@@ -654,7 +654,10 @@ void OBCameraNode::publishLrmObstacleDistance() {
}
try {
std_msgs::msg::Int32 msg;
msg.data = device_->getIntProperty(OB_PROP_LDP_MEASURE_DISTANCE_INT);
{
std::lock_guard<decltype(device_lock_)> lock(device_lock_);
msg.data = device_->getIntProperty(OB_PROP_LDP_MEASURE_DISTANCE_INT);
}
lrm_obstacle_distance_pub_->publish(msg);
} catch (const ob::Error &e) {
auto message = orbbec_camera::formatObErrorWithStatus(e);