我正在尝试使用Orbbec Astra来运行PCL采集器程序。我修改了示例代码以与Openni2采集卡一起使用。但是我收到以下错误。请告诉我我要去哪里了。我在Ubuntu 16.04上使用PCL 1.8.0。 这是我的代码:
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/openni2_grabber.h>
#include <pcl/common/time.h>
class SimpleOpenNIProcessor
{
public:
void cloud_cb_ (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr &cloud)
{
static unsigned count = 0;
static double last = pcl::getTime ();
if (++count == 30)
{
double now = pcl::getTime ();
std::cout << "distance of center pixel :" << cloud->points [(cloud->width >> 1) * (cloud->height + 1)].z << " mm. Average framerate: " << double(count)/double(now - last) << " Hz" << std::endl;
count = 0;
last = now;
}
}
void run ()
{
// create a new grabber for OpenNI devices
pcl::Grabber* interface = new pcl::io::OpenNI2Grabber();
// make callback function from member function
boost::function<void (const pcl::PointCloud<pcl::PointXYZRGBA>::ConstPtr&)> f =
boost::bind (&SimpleOpenNIProcessor::cloud_cb_, this, _1);
// connect callback function for desired signal. In this case its a point cloud with color values
boost::signals2::connection c = interface->registerCallback (f);
// start receiving point clouds
interface->start ();
// wait until user quits program with Ctrl-C, but no busy-waiting -> sleep (1);
while (true)
boost::this_thread::sleep (boost::posix_time::seconds (1));
// stop the grabber
interface->stop ();
}
};
int main ()
{
SimpleOpenNIProcessor v;
v.run ();
return (0);
}
抛出'pcl :: IOException'实例后调用terminate what():void pcl :: io :: OpenNI2Grabber :: setupDevice(const string&,const pcl :: io :: OpenNI2Grabber :: Mode&,const pcl :: io :: OpenNI2Grabber :: Mode&)在/ pcl / io / src中/openni2_grabber.cpp @ 325:未连接任何设备。 中止(核心已弃用)