I'm trying to move my robot arm using the real-time coordinates of an object that I'm moving around. the object is made from two colored ping-pong balls connected by a 20 cm rod. I'm trying to use PCL library and Kinect v2 to get the coordinates(XYZ) of the balls.
to move the robotic arm, I tried using the joint data of Kinect SDK but I also need the orientation for the end effector of the robot arm. so instead I'm trying to get the location and orientation of this object from Kinect and move the arm. I tried using a code I found on the PCL website and then on Github : http://pointclouds.org/documentation/tutorials/tracking.php
this is the code I'm using:
https://github.com/PointCloudLibrary/pcl/blob/master/apps/src/openni_tracking.cpp it's written for use with openni, but I've changed it to 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();
}
when i try to debug, i get the following errors :
Error C2672 'pcl::Grabber::registerCallback': no matching overloaded function found
Error C2784 'boost::signals2::connection pcl::Grabber::registerCallback(const boost::function &)': could not deduce template argument for 'const boost::function &' from 'std::function> &)>'
You are using an old version of PCL. registerCallback
expects a boost::function
and not a std::function
.
Changing
std::function<void(const CloudConstPtr&)> f = [this](const CloudConstPtr& cloud) { cloud_cb(cloud); };
to
boost::function<void(const CloudConstPtr&)> f = [this](const CloudConstPtr& cloud) { cloud_cb(cloud); };
should fix it.