From c64fec21d7e9074dbd0c37b2f8791ed7991dd6fb Mon Sep 17 00:00:00 2001 From: kalman Date: Wed, 16 Jan 2019 15:20:13 +0800 Subject: [PATCH] fix(ros): add mutex_data_ in mono --- wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc b/wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc index 9eae936..3f7b7cb 100644 --- a/wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc +++ b/wrappers/ros/src/mynt_eye_ros_wrapper/src/wrapper_nodelet.cc @@ -668,9 +668,11 @@ class ROSWrapperNodelet : public nodelet::Nodelet { header.seq = seq; header.stamp = stamp; header.frame_id = frame_ids_[stream]; + pthread_mutex_lock(&mutex_data_); cv::Mat mono; cv::cvtColor(data.frame, mono, CV_RGB2GRAY); auto &&msg = cv_bridge::CvImage(header, enc::MONO8, mono).toImageMsg(); + pthread_mutex_unlock(&mutex_data_); auto &&info = getCameraInfo(stream); info->header.stamp = msg->header.stamp; mono_publishers_[stream].publish(msg, info);