我正在构建一个基于 PCL 的应用程序,它使用 velodyne 的默认 PCL 抓取器代码,可以在此处看到。
当我在调试模式下构建我的应用程序时,它按预期工作,但在发布构建中,云正在跳过,我松动了一两个云。我缩小了一个事实,即互斥体存在一些我没有经验的问题。
// Retrieved Point Cloud Callback Function
boost::mutex mutex;
boost::function<void(const pcl::PointCloud<PointType>::ConstPtr&)> function =[&cloud, &mutex](const pcl::PointCloud<PointType>::ConstPtr& ptr)
{
boost::mutex::scoped_lock lock(mutex);
// Point Cloud Processing
cloud = ptr;
};
这是接收我的云的回调,下面的部分是主要的
while (!viewer->wasStopped())
{
viewer->spinOnce(); // Update Viewer
tStart = clock();
boost::mutex::scoped_try_lock lock(mutex);
我无法弄清楚为什么发布与调试存在差异。有什么建议么?我使用 Visual Studio 2017 和 PCL 1.8.1。