繁体   English   中英

使用kinect v2的pcl对象跟踪代码中的错误

[英]error in pcl object tracking code using kinect v2

我正在尝试使用我要移动的对象的实时坐标来移动机械臂。 该物体是由两个彩色的乒乓球制成的,它们由20厘米的杆相连。 我正在尝试使用PCL库和Kinect v2来获取球的坐标(XYZ)。

为了移动机械臂,我尝试使用Kinect SDK的联合数据,但是我还需要确定机械臂末端执行器的方向。 因此,我尝试从Kinect获取该对象的位置和方向并移动手臂。 我尝试使用在PCL网站上然后在Github上找到的代码: http : //pointclouds.org/documentation/tutorials/tracking.php

这是我正在使用的代码:

https://github.com/PointCloudLibrary/pcl/blob/master/apps/src/openni_tracking.cpp它是为与openni一起使用而编写的,但我将其更改为openni2。

void
    run()
{
    pcl::Grabber* interface = new pcl::io::OpenNI2Grabber(device_id_);
    std::function<void(const CloudConstPtr&)> f =
        [this](const CloudConstPtr& cloud) { cloud_cb(cloud); };
    interface->registerCallback(f);

    viewer_.runOnVisualizationThread([this](pcl::visualization::PCLVisualizer& viz) { viz_cb(viz); }, "viz_cb");

    interface->start();

    while (!viewer_.wasStopped())
        std::this_thread::sleep_for(1s);
    interface->stop();
}

当我尝试调试时,出现以下错误:

错误C2672'pcl :: Grabber :: registerCallback':找不到匹配的重载函数

错误C2784'boost :: signals2 :: connection pcl :: Grabber :: registerCallback(const boost :: function&)':无法从'std :: function>&)推断'const boost :: function&'的模板参数>'

您正在使用旧版本的PCL。 registerCallback期望boost::function而不是std::function

改变中

std::function<void(const CloudConstPtr&)> f = [this](const CloudConstPtr& cloud) { cloud_cb(cloud); };

boost::function<void(const CloudConstPtr&)> f = [this](const CloudConstPtr& cloud) { cloud_cb(cloud); };

应该修复它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM