void grabAndSend () { OpenNIGrabber* grabber = new OpenNIGrabber (); grabber->getDevice ()->setDepthOutputFormat (depth_mode_); Grabber* interface = grabber; boost::function<void (const typename PointCloud<PointT>::ConstPtr&)> f = boost::bind (&Producer::grabberCallBack, this, _1); interface->registerCallback (f); interface->start (); while (true) { if (is_done) { break; } char c; { // boost::mutex::scoped_lock io_lock (io_mutex); c = getch(); } if (c == 'q') { boost::mutex::scoped_lock io_lock (io_mutex); print_info ("\n'q' detected, exit condition set to true.\n"); is_done = true; } else if (!is_done && c == 's') { { boost::mutex::scoped_lock wflag_lock (wflag_mutex); write_once = true; } } else if (!is_done && c == 'n'){ boost::mutex::scoped_lock io_lock (noise_flag_mutex); if (!calculate_noise) { calculate_noise = true; num_pcd_sample = 100; depths_sample.clear(); } } boost::this_thread::sleep (boost::posix_time::seconds (1)); } interface->stop (); }
void grabAndSend () { OpenNIGrabber* grabber = new OpenNIGrabber (); grabber->getDevice ()->setDepthOutputFormat (depth_mode_); Grabber* interface = grabber; boost::function<void (const typename PointCloud<PointT>::ConstPtr&)> f = boost::bind (&Producer::grabberCallBack, this, _1); interface->registerCallback (f); interface->start (); while (true) { if (is_done) break; boost::this_thread::sleep (boost::posix_time::seconds (1)); } interface->stop (); }