From 89ce7c60718ace9489d153e8b23f450fde121110 Mon Sep 17 00:00:00 2001 From: SunBlack Date: Wed, 27 Mar 2019 12:05:20 +0100 Subject: [PATCH] Replace boost::this_thread::sleep by std::this_thread::sleep_for (#2921) Replace boost::this_thread::sleep by std::this_thread::sleep_for --- .../include/pcl/apps/in_hand_scanner/boost.h | 1 - .../apps/impl/dominant_plane_segmentation.hpp | 6 ----- apps/include/pcl/apps/manual_registration.h | 7 +----- .../pcl/apps/organized_segmentation_demo.h | 2 -- apps/include/pcl/apps/pcd_video_player.h | 1 - apps/src/dinast_grabber_example.cpp | 6 ++++- apps/src/ni_agast.cpp | 6 ++++- apps/src/ni_brisk.cpp | 6 ++++- apps/src/ni_linemod.cpp | 5 ++++- apps/src/ni_susan.cpp | 6 ++++- apps/src/ni_trajkovic.cpp | 6 ++++- apps/src/openni_3d_concave_hull.cpp | 7 ++++-- apps/src/openni_3d_convex_hull.cpp | 9 +++++--- apps/src/openni_boundary_estimation.cpp | 10 ++++++--- apps/src/openni_change_viewer.cpp | 6 ++++- apps/src/openni_fast_mesh.cpp | 14 +++++------- apps/src/openni_feature_persistence.cpp | 7 ++++-- apps/src/openni_grab_frame.cpp | 7 ++---- apps/src/openni_grab_images.cpp | 1 - apps/src/openni_ii_normal_estimation.cpp | 7 ++++-- apps/src/openni_mobile_server.cpp | 6 ++--- apps/src/openni_octree_compression.cpp | 8 ++++--- apps/src/openni_organized_compression.cpp | 10 +++++---- apps/src/openni_passthrough.cpp | 8 +++++-- apps/src/openni_shift_to_depth_conversion.cpp | 5 +++-- apps/src/openni_tracking.cpp | 8 +++++-- apps/src/openni_uniform_sampling.cpp | 8 +++++-- apps/src/pcd_organized_edge_detection.cpp | 5 ++++- apps/src/pcd_select_object_plane.cpp | 5 ++++- apps/src/ppf_object_recognition.cpp | 5 ++++- .../ground_based_rgbd_people_detection.rst | 20 ++++++++--------- doc/tutorials/content/moment_of_inertia.rst | 14 ++++++------ .../normal_distributions_transform.rst | 22 +++++++++---------- .../content/random_sample_consensus.rst | 6 ++--- .../region_growing_rgb_segmentation.rst | 16 +++++++------- .../ensenso_cloud_images_viewer.cpp | 7 ++++-- .../main_ground_based_people_detection.cpp | 11 ++++++---- .../moment_of_inertia/moment_of_inertia.cpp | 9 +++++--- .../narf_descriptor_visualization.cpp | 1 - .../narf_feature_extraction.cpp | 1 - .../narf_keypoint_extraction.cpp | 1 - .../normal_distributions_transform.cpp | 7 ++++-- .../sources/openni_grabber/openni_grabber.cpp | 6 ++++- .../pcl_visualizer/pcl_visualizer_demo.cpp | 7 +++--- .../random_sample_consensus.cpp | 7 ++++-- .../range_image_border_extraction.cpp | 1 - .../range_image_visualization.cpp | 2 -- .../region_growing_rgb_segmentation.cpp | 6 ++++- .../sources/tracking/tracking_sample.cpp | 7 ++++-- doc/tutorials/content/tracking.rst | 12 +++++----- .../segmentation/example_cpc_segmentation.cpp | 5 ++++- .../example_lccp_segmentation.cpp | 5 ++++- examples/segmentation/example_supervoxels.cpp | 6 ++++- examples/stereo/example_stereo_baseline.cpp | 5 ++++- gpu/kinfu_large_scale/tools/kinfuLS_app.cpp | 4 +++- .../tools/record_maps_rgb.cpp | 12 ++++++---- .../tools/standalone_texture_mapping.cpp | 1 - gpu/people/tools/people_tracking.cpp | 5 ++++- io/include/pcl/io/boost.h | 1 - io/include/pcl/io/davidsdk_grabber.h | 1 - .../depth_sense/depth_sense_device_manager.h | 1 - io/include/pcl/io/ensenso_grabber.h | 1 - .../io/real_sense/real_sense_device_manager.h | 1 - io/include/pcl/io/real_sense_grabber.h | 1 - io/include/pcl/io/robot_eye_grabber.h | 1 - io/src/hdl_grabber.cpp | 2 +- io/src/openni2_grabber.cpp | 2 -- io/src/openni_grabber.cpp | 5 ++++- io/tools/openni_pcd_recorder.cpp | 8 ++++--- .../src/visualization/outofcore_cloud.cpp | 4 ---- .../main_ground_based_people_detection.cpp | 8 +++++-- simulation/tools/sim_test_simple.cpp | 5 +++-- simulation/tools/sim_viewer.cpp | 2 -- test/io/test_grabbers.cpp | 14 +++++++----- tools/boost.h | 4 ---- tools/obj_rec_ransac_accepted_hypotheses.cpp | 4 +++- tools/obj_rec_ransac_hash_table.cpp | 4 +++- tools/obj_rec_ransac_model_opps.cpp | 4 +++- tools/obj_rec_ransac_orr_octree.cpp | 4 +++- .../obj_rec_ransac_orr_octree_zprojection.cpp | 4 +++- tools/obj_rec_ransac_result.cpp | 4 +++- tools/obj_rec_ransac_scene_opps.cpp | 4 +++- tools/octree_viewer.cpp | 6 ++++- tools/pcl_video.cpp | 4 +++- .../include/pcl/visualization/boost.h | 1 - .../impl/registration_visualizer.hpp | 6 +++-- visualization/src/histogram_visualizer.cpp | 6 ++++- visualization/tools/davidsdk_viewer.cpp | 4 +++- visualization/tools/ensenso_viewer.cpp | 4 +++- visualization/tools/hdl_viewer_simple.cpp | 4 +++- visualization/tools/image_grabber_viewer.cpp | 6 ++++- visualization/tools/image_viewer.cpp | 4 ---- visualization/tools/openni_image.cpp | 8 ++++--- visualization/tools/pcd_grabber_viewer.cpp | 6 ++++- visualization/tools/pcd_viewer.cpp | 6 ++++- visualization/tools/timed_trigger_test.cpp | 11 ++++++---- visualization/tools/vlp_viewer.cpp | 5 ++++- 97 files changed, 346 insertions(+), 218 deletions(-) diff --git a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/boost.h b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/boost.h index bf45fae25e9..1480e5ae014 100644 --- a/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/boost.h +++ b/apps/in_hand_scanner/include/pcl/apps/in_hand_scanner/boost.h @@ -52,5 +52,4 @@ #include //#include #include -#include #include diff --git a/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp b/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp index bced6ff6ba2..9c2f5f43576 100644 --- a/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp +++ b/apps/include/pcl/apps/impl/dominant_plane_segmentation.hpp @@ -33,12 +33,6 @@ * */ -#ifndef Q_MOC_RUN -#pragma once -#include -#include -#endif - #include #include #include diff --git a/apps/include/pcl/apps/manual_registration.h b/apps/include/pcl/apps/manual_registration.h index 26ecd9465d7..b6548d73bbc 100644 --- a/apps/include/pcl/apps/manual_registration.h +++ b/apps/include/pcl/apps/manual_registration.h @@ -36,16 +36,11 @@ #include -// QT4 +// QT #include #include #include -// Boost -#ifndef Q_MOC_RUN -#include -#endif - // PCL #include #include diff --git a/apps/include/pcl/apps/organized_segmentation_demo.h b/apps/include/pcl/apps/organized_segmentation_demo.h index 14d7dfd9f02..ad8ea2ede4b 100644 --- a/apps/include/pcl/apps/organized_segmentation_demo.h +++ b/apps/include/pcl/apps/organized_segmentation_demo.h @@ -38,8 +38,6 @@ #include -// Boost -#include // PCL #include #include diff --git a/apps/include/pcl/apps/pcd_video_player.h b/apps/include/pcl/apps/pcd_video_player.h index 769211681d4..b5744b7a5b6 100644 --- a/apps/include/pcl/apps/pcd_video_player.h +++ b/apps/include/pcl/apps/pcd_video_player.h @@ -45,7 +45,6 @@ #include // Boost -#include #include // PCL diff --git a/apps/src/dinast_grabber_example.cpp b/apps/src/dinast_grabber_example.cpp index a4fc93fcf2f..7ada4ef9619 100644 --- a/apps/src/dinast_grabber_example.cpp +++ b/apps/src/dinast_grabber_example.cpp @@ -35,11 +35,15 @@ * */ +#include + #include #include #include #include +using namespace std::chrono_literals; + template class DinastProcessor { @@ -79,7 +83,7 @@ class DinastProcessor while (!viewer.wasStopped()) { - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); } interface.stop (); diff --git a/apps/src/ni_agast.cpp b/apps/src/ni_agast.cpp index 57f17169229..a3706594b4b 100644 --- a/apps/src/ni_agast.cpp +++ b/apps/src/ni_agast.cpp @@ -38,6 +38,9 @@ */ #define SHOW_FPS 1 + +#include + #include #include #include @@ -53,6 +56,7 @@ using namespace pcl; using namespace std; +using namespace std::chrono_literals; typedef PointUV KeyPointT; @@ -311,7 +315,7 @@ class AGASTDemo cloud_viewer_.spinOnce (); image_viewer_.spinOnce (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } grabber_.stop (); diff --git a/apps/src/ni_brisk.cpp b/apps/src/ni_brisk.cpp index da73f42a942..28c446efc58 100644 --- a/apps/src/ni_brisk.cpp +++ b/apps/src/ni_brisk.cpp @@ -38,6 +38,9 @@ */ #define SHOW_FPS 1 + +#include + #include #include #include @@ -53,6 +56,7 @@ using namespace pcl; using namespace std; +using namespace std::chrono_literals; typedef PointXYZRGBA PointT; typedef PointWithScale KeyPointT; @@ -268,7 +272,7 @@ class BRISKDemo cloud_viewer_.spinOnce (); image_viewer_.spinOnce (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } grabber_.stop (); diff --git a/apps/src/ni_linemod.cpp b/apps/src/ni_linemod.cpp index 8131b70706f..af47407137a 100644 --- a/apps/src/ni_linemod.cpp +++ b/apps/src/ni_linemod.cpp @@ -37,6 +37,8 @@ * */ +#include + #include #include #include @@ -64,6 +66,7 @@ using namespace pcl; using namespace std; +using namespace std::chrono_literals; typedef PointXYZRGBA PointT; @@ -527,7 +530,7 @@ class NILinemod cloud_viewer_.spinOnce (); image_viewer_.spinOnce (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } grabber_.stop (); diff --git a/apps/src/ni_susan.cpp b/apps/src/ni_susan.cpp index 5d3084ca5eb..47febf3ae5a 100644 --- a/apps/src/ni_susan.cpp +++ b/apps/src/ni_susan.cpp @@ -38,6 +38,9 @@ */ #define SHOW_FPS 1 + +#include + #include #include #include @@ -52,6 +55,7 @@ using namespace pcl; using namespace std; +using namespace std::chrono_literals; typedef PointXYZRGBA PointT; typedef PointXYZRGBL KeyPointT; @@ -172,7 +176,7 @@ class SUSANDemo cloud_viewer_.spinOnce (); image_viewer_.spinOnce (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } grabber_.stop (); diff --git a/apps/src/ni_trajkovic.cpp b/apps/src/ni_trajkovic.cpp index 873aa2e0f82..f8e520bdf79 100644 --- a/apps/src/ni_trajkovic.cpp +++ b/apps/src/ni_trajkovic.cpp @@ -38,6 +38,9 @@ */ #define SHOW_FPS 1 + +#include + #include #include #include @@ -48,6 +51,7 @@ #include #include +using namespace std::chrono_literals; using namespace pcl; typedef PointXYZRGBA PointT; typedef PointXYZI KeyPointT; @@ -192,7 +196,7 @@ class TrajkovicDemo cloud_viewer_.spinOnce (); image_viewer_.spinOnce (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } grabber_.stop (); diff --git a/apps/src/openni_3d_concave_hull.cpp b/apps/src/openni_3d_concave_hull.cpp index 8cd27cdf939..9b978541007 100644 --- a/apps/src/openni_3d_concave_hull.cpp +++ b/apps/src/openni_3d_concave_hull.cpp @@ -33,6 +33,8 @@ * */ +#include + #include #include #include @@ -47,6 +49,7 @@ using namespace pcl; using namespace pcl::visualization; using namespace std; +using namespace std::chrono_literals; #define FPS_CALC(_WHAT_) \ do \ @@ -106,7 +109,7 @@ class OpenNI3DConcaveHull { if (!cloud_ || !new_cloud_) { - boost::this_thread::sleep (boost::posix_time::milliseconds (1)); + std::this_thread::sleep_for(1ms); return; } @@ -145,7 +148,7 @@ class OpenNI3DConcaveHull while (!viewer.wasStopped ()) { - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(1ms); } interface->stop (); diff --git a/apps/src/openni_3d_convex_hull.cpp b/apps/src/openni_3d_convex_hull.cpp index 268289adf03..862f1656d82 100644 --- a/apps/src/openni_3d_convex_hull.cpp +++ b/apps/src/openni_3d_convex_hull.cpp @@ -33,6 +33,8 @@ * */ +#include + #include #include #include @@ -44,9 +46,10 @@ #include #include +using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace pcl::visualization; -using namespace std; #define FPS_CALC(_WHAT_) \ do \ @@ -104,7 +107,7 @@ class OpenNI3DConvexHull { if (!cloud_ || !new_cloud_) { - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(1ms); return; } @@ -143,7 +146,7 @@ class OpenNI3DConvexHull while (!viewer.wasStopped ()) { - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(1ms); } interface->stop (); diff --git a/apps/src/openni_boundary_estimation.cpp b/apps/src/openni_boundary_estimation.cpp index 9222a80cbbf..5b0846e889c 100644 --- a/apps/src/openni_boundary_estimation.cpp +++ b/apps/src/openni_boundary_estimation.cpp @@ -32,9 +32,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * + * */ +#include + #include #include #include @@ -47,6 +49,8 @@ #include #include +using namespace std::chrono_literals; + typedef pcl::visualization::PointCloudColorHandler ColorHandler; typedef ColorHandler::Ptr ColorHandlerPtr; typedef ColorHandler::ConstPtr ColorHandlerConstPtr; @@ -123,7 +127,7 @@ class OpenNIIntegralImageNormalEstimation boost::mutex::scoped_lock lock (mtx_); if (!cloud_) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); return; } @@ -163,7 +167,7 @@ class OpenNIIntegralImageNormalEstimation while (!viewer.wasStopped ()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } interface->stop (); diff --git a/apps/src/openni_change_viewer.cpp b/apps/src/openni_change_viewer.cpp index 1d3c45a1bcd..0a6af874a24 100644 --- a/apps/src/openni_change_viewer.cpp +++ b/apps/src/openni_change_viewer.cpp @@ -34,6 +34,8 @@ * Author: Nico Blodow (blodow@cs.tum.edu), Julius Kammerl (julius@kammerl.de) */ +#include + #include #include #include @@ -44,6 +46,8 @@ #include +using namespace std::chrono_literals; + enum { REDDIFF_MODE, @@ -128,7 +132,7 @@ class OpenNIChangeViewer while (!viewer.wasStopped()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } interface->stop (); diff --git a/apps/src/openni_fast_mesh.cpp b/apps/src/openni_fast_mesh.cpp index 41bc71292c9..910436236d3 100644 --- a/apps/src/openni_fast_mesh.cpp +++ b/apps/src/openni_fast_mesh.cpp @@ -33,6 +33,8 @@ * */ +#include + #include #include #include @@ -46,6 +48,7 @@ using namespace pcl; using namespace pcl::visualization; using namespace std; +using namespace std::chrono_literals; #define FPS_CALC(_WHAT_) \ do \ @@ -118,23 +121,17 @@ class OpenNIFastMesh boost::shared_ptr > temp_verts; while (!view->wasStopped ()) - //while (!viewer.wasStopped ()) { - //boost::this_thread::sleep (boost::posix_time::milliseconds (1)); if (!cloud_ || !mtx_.try_lock ()) { - boost::this_thread::sleep (boost::posix_time::milliseconds (1)); + std::this_thread::sleep_for(1ms); continue; } - //temp_cloud.reset (new Cloud (*cloud_)); - //temp_cloud.swap (cloud_); - //temp_verts.swap (vertices_);//reset (new std::vector (*vertices_)); temp_cloud = cloud_; - temp_verts = vertices_;//reset (new std::vector (*vertices_)); + temp_verts = vertices_; mtx_.unlock (); - //view->removePolygonMesh ("surface"); if (!view->updatePolygonMesh (temp_cloud, *temp_verts, "surface")) { view->addPolygonMesh (temp_cloud, *temp_verts, "surface"); @@ -150,7 +147,6 @@ class OpenNIFastMesh pcl::OrganizedFastMesh ofm; std::string device_id_; - //boost::shared_mutex mtx_; boost::mutex mtx_; // Data CloudConstPtr cloud_; diff --git a/apps/src/openni_feature_persistence.cpp b/apps/src/openni_feature_persistence.cpp index 5a556382764..183413313be 100644 --- a/apps/src/openni_feature_persistence.cpp +++ b/apps/src/openni_feature_persistence.cpp @@ -35,6 +35,8 @@ * */ +#include + #include #include #include @@ -50,6 +52,7 @@ #include #include +using namespace std::chrono_literals; #define FPS_CALC(_WHAT_) \ do \ @@ -158,7 +161,7 @@ class OpenNIFeaturePersistence boost::mutex::scoped_lock lock (mtx_); if (!cloud_) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); return; } @@ -196,7 +199,7 @@ class OpenNIFeaturePersistence while (!viewer.wasStopped ()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } interface->stop (); diff --git a/apps/src/openni_grab_frame.cpp b/apps/src/openni_grab_frame.cpp index 0cb04902d40..adaa1de8526 100644 --- a/apps/src/openni_grab_frame.cpp +++ b/apps/src/openni_grab_frame.cpp @@ -45,7 +45,7 @@ #include #include - +using namespace std::chrono_literals; #define SHOW_FPS 1 #if SHOW_FPS @@ -194,7 +194,7 @@ class OpenNIGrabFrame // wait until user quits program with Ctrl-C, but no busy-waiting -> sleep (1); while (!visualizer_->wasStopped()) { - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); visualizer_->spinOnce (); @@ -212,9 +212,6 @@ class OpenNIGrabFrame } } - //while (!quit_) - //boost::this_thread::sleep (boost::posix_time::seconds (1)); - // stop the grabber grabber_.stop (); } diff --git a/apps/src/openni_grab_images.cpp b/apps/src/openni_grab_images.cpp index cac557bd92f..55f5a559a0b 100644 --- a/apps/src/openni_grab_images.cpp +++ b/apps/src/openni_grab_images.cpp @@ -278,7 +278,6 @@ class OpenNIGrabFrame trigger_ = false; image_viewer_.spinOnce (); depth_image_viewer_.spinOnce (); - //boost::this_thread::sleep (boost::posix_time::microseconds (100)); } image_mutex_.lock (); diff --git a/apps/src/openni_ii_normal_estimation.cpp b/apps/src/openni_ii_normal_estimation.cpp index 40c6f655b0f..852b79bd28b 100644 --- a/apps/src/openni_ii_normal_estimation.cpp +++ b/apps/src/openni_ii_normal_estimation.cpp @@ -33,6 +33,8 @@ * */ +#include + #include #include #include @@ -43,6 +45,8 @@ #include #include +using namespace std::chrono_literals; + #define FPS_CALC(_WHAT_) \ do \ { \ @@ -104,7 +108,6 @@ class OpenNIIntegralImageNormalEstimation mtx_.lock (); if (!cloud_ || !normals_) { - //boost::this_thread::sleep(boost::posix_time::seconds(1)); mtx_.unlock (); return; } @@ -168,7 +171,7 @@ class OpenNIIntegralImageNormalEstimation while (!viewer.wasStopped ()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } interface->stop (); diff --git a/apps/src/openni_mobile_server.cpp b/apps/src/openni_mobile_server.cpp index a9daf17372b..a6adaf11bb5 100644 --- a/apps/src/openni_mobile_server.cpp +++ b/apps/src/openni_mobile_server.cpp @@ -33,6 +33,7 @@ * */ +#include #include #include @@ -44,10 +45,9 @@ #include #include -#include using boost::asio::ip::tcp; - +using namespace std::chrono_literals; struct PointCloudBuffers { @@ -161,7 +161,7 @@ class PCLMobileServer // wait for first cloud while (!getLatestPointCloud ()) - boost::this_thread::sleep (boost::posix_time::milliseconds (10)); + std::this_thread::sleep_for(10ms); viewer_.showCloud (getLatestPointCloud ()); diff --git a/apps/src/openni_octree_compression.cpp b/apps/src/openni_octree_compression.cpp index 594d068c9bb..1596135fa48 100644 --- a/apps/src/openni_octree_compression.cpp +++ b/apps/src/openni_octree_compression.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -60,6 +61,7 @@ using namespace pcl; using namespace pcl::io; using namespace std; +using namespace std::chrono_literals; char usage[] = "\n" " PCL octree point cloud compression\n" @@ -165,7 +167,7 @@ class SimpleOpenNIViewer while (!outputFile_.fail()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } interface->stop (); @@ -219,7 +221,7 @@ struct EventHelper while (!outputFile_.fail ()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } interface->stop (); @@ -463,7 +465,7 @@ main (int argc, char **argv) std::cout << "Disconnected!" << std::endl; - boost::this_thread::sleep(boost::posix_time::seconds(3)); + std::this_thread::sleep_for(3s); } catch (std::exception& e) diff --git a/apps/src/openni_organized_compression.cpp b/apps/src/openni_organized_compression.cpp index db7e3105db7..27f979c9d16 100644 --- a/apps/src/openni_organized_compression.cpp +++ b/apps/src/openni_organized_compression.cpp @@ -34,6 +34,7 @@ * Author: Julius Kammerl (julius@kammerl.de) */ +#include #include #include @@ -60,6 +61,7 @@ using namespace pcl; using namespace pcl::io; using namespace std; +using namespace std::chrono_literals; char usage[] = "\n" " PCL organized point cloud stream compression\n" @@ -165,7 +167,7 @@ class SimpleOpenNIViewer while (!outputFile_.fail()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } interface->stop (); @@ -255,7 +257,7 @@ struct EventHelper while (!outputFile_.fail ()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } interface->stop (); @@ -275,7 +277,7 @@ struct EventHelper grabber.start (); while (!outputFile_.fail()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } grabber.stop (); @@ -450,7 +452,7 @@ main (int argc, char **argv) std::cout << "Disconnected!" << std::endl; - boost::this_thread::sleep(boost::posix_time::seconds(3)); + std::this_thread::sleep_for(3s); } catch (std::exception& e) diff --git a/apps/src/openni_passthrough.cpp b/apps/src/openni_passthrough.cpp index 034bdb19782..cb2bf8cc211 100644 --- a/apps/src/openni_passthrough.cpp +++ b/apps/src/openni_passthrough.cpp @@ -35,8 +35,10 @@ * */ +#include + #include -// QT4 +// QT #include #include #include @@ -46,6 +48,8 @@ #include +using namespace std::chrono_literals; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// OpenNIPassthrough::OpenNIPassthrough (pcl::OpenNIGrabber& grabber) : vis_ () @@ -105,7 +109,7 @@ OpenNIPassthrough::timeoutSlot () { if (!cloud_pass_) { - boost::this_thread::sleep (boost::posix_time::milliseconds (1)); + std::this_thread::sleep_for(1ms); return; } diff --git a/apps/src/openni_shift_to_depth_conversion.cpp b/apps/src/openni_shift_to_depth_conversion.cpp index e0e11b2189f..c55c04bac05 100644 --- a/apps/src/openni_shift_to_depth_conversion.cpp +++ b/apps/src/openni_shift_to_depth_conversion.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include @@ -58,7 +59,7 @@ using namespace pcl; using namespace pcl::io; using namespace std; - +using namespace std::chrono_literals; class SimpleOpenNIViewer { @@ -141,7 +142,7 @@ class SimpleOpenNIViewer grabber_->start (); while (true) { - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); } grabber_->stop (); diff --git a/apps/src/openni_tracking.cpp b/apps/src/openni_tracking.cpp index 9f07442bb2a..e27928f851f 100644 --- a/apps/src/openni_tracking.cpp +++ b/apps/src/openni_tracking.cpp @@ -34,6 +34,9 @@ * POSSIBILITY OF SUCH DAMAGE. * */ + +#include + #include #include #include @@ -104,6 +107,7 @@ } using namespace pcl::tracking; +using namespace std::chrono_literals; template class OpenNISegmentTracking @@ -265,7 +269,7 @@ class OpenNISegmentTracking if (!cloud_pass_) { - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); return; } @@ -656,7 +660,7 @@ class OpenNISegmentTracking interface->start (); while (!viewer_.wasStopped ()) - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); interface->stop (); } diff --git a/apps/src/openni_uniform_sampling.cpp b/apps/src/openni_uniform_sampling.cpp index 06ac08f7e62..960f0d95260 100644 --- a/apps/src/openni_uniform_sampling.cpp +++ b/apps/src/openni_uniform_sampling.cpp @@ -33,6 +33,8 @@ * */ +#include + #include #include #include @@ -42,6 +44,8 @@ #include #include +using namespace std::chrono_literals; + #define FPS_CALC(_WHAT_) \ do \ { \ @@ -96,7 +100,7 @@ class OpenNIUniformSampling boost::mutex::scoped_lock lock (mtx_); if (!keypoints_ && !cloud_) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); return; } @@ -126,7 +130,7 @@ class OpenNIUniformSampling while (!viewer.wasStopped ()) { - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); } interface->stop (); diff --git a/apps/src/pcd_organized_edge_detection.cpp b/apps/src/pcd_organized_edge_detection.cpp index 6cf979504c4..f481adece00 100644 --- a/apps/src/pcd_organized_edge_detection.cpp +++ b/apps/src/pcd_organized_edge_detection.cpp @@ -37,6 +37,8 @@ * */ +#include + #include #include #include @@ -51,6 +53,7 @@ using namespace pcl; using namespace pcl::io; using namespace pcl::console; +using namespace std::chrono_literals; float default_th_dd = 0.02f; int default_max_search = 50; @@ -213,7 +216,7 @@ compute (const pcl::PCLPointCloud2::ConstPtr &input, pcl::PCLPointCloud2 &output while (!viewer.wasStopped ()) { viewer.spinOnce (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } // Combine point clouds and edge labels diff --git a/apps/src/pcd_select_object_plane.cpp b/apps/src/pcd_select_object_plane.cpp index 2aac2028951..0337877e949 100644 --- a/apps/src/pcd_select_object_plane.cpp +++ b/apps/src/pcd_select_object_plane.cpp @@ -37,6 +37,8 @@ * */ +#include + #include #include #include @@ -70,6 +72,7 @@ using namespace pcl; using namespace pcl::console; using namespace std; +using namespace std::chrono_literals; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// template @@ -517,7 +520,7 @@ class ObjectSelection if (image_viewer_->wasStopped ()) break; } - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } } diff --git a/apps/src/ppf_object_recognition.cpp b/apps/src/ppf_object_recognition.cpp index 34fc632c77f..cb1f6f27f0c 100644 --- a/apps/src/ppf_object_recognition.cpp +++ b/apps/src/ppf_object_recognition.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -13,6 +15,7 @@ using namespace pcl; using namespace std; +using namespace std::chrono_literals; const Eigen::Vector4f subsampling_leaf_size (0.02f, 0.02f, 0.02f, 0.0f); const float normal_estimation_search_radius = 0.05f; @@ -166,7 +169,7 @@ main (int argc, char** argv) while (!viewer.wasStopped ()) { viewer.spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } return 0; diff --git a/doc/tutorials/content/ground_based_rgbd_people_detection.rst b/doc/tutorials/content/ground_based_rgbd_people_detection.rst index 30961a1c8a6..02824e11423 100644 --- a/doc/tutorials/content/ground_based_rgbd_people_detection.rst +++ b/doc/tutorials/content/ground_based_rgbd_people_detection.rst @@ -20,7 +20,7 @@ Here it is the code: .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 48-243 + :lines: 48-247 The explanation @@ -35,13 +35,13 @@ maximum (``max_h``) height of people can be set. If no parameter is set, the def .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 67-78 + :lines: 71-82 Here, the callback used for grabbing pointclouds with OpenNI is defined. .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 80-87 + :lines: 84-91 The people detection algorithm used makes the assumption that people stand/walk on a planar ground plane. Thus, it requires to know the equation of the ground plane in order to perform people detection. @@ -52,7 +52,7 @@ the structure used to pass arguments to this callback. .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 89-110 + :lines: 93-114 Main: ***** @@ -61,7 +61,7 @@ The main program starts by initializing the main parameters and reading the comm .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 112-130 + :lines: 116-134 Ground initialization: ********************** @@ -74,7 +74,7 @@ After this, ``Q`` must be pressed in order to close the visualizer and let the p .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 132-165 + :lines: 136-169 .. image:: images/ground_based_rgbd_people_detection/Screen_floor.jpg :align: center @@ -89,7 +89,7 @@ written to the command window. .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 167-175 + :lines: 171-179 In the following lines, we can see the initialization of the SVM classifier by loading the pre-trained parameters from file. @@ -101,7 +101,7 @@ setSensorPortraitOrientation should be used to enable the vertical mode in :pcl: .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 181-191 + :lines: 185-195 Main loop: ********** @@ -113,7 +113,7 @@ This procedure allows to adapt to small changes which can occur to the ground pl .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 197-210 + :lines: 201-214 The last part of the code is devoted to visualization. In particular, a green 3D bounding box is drawn for every person with HOG confidence above the ``min_confidence`` threshold. The width of the bounding box is fixed, while @@ -123,7 +123,7 @@ Please note that this framerate includes the time necessary for grabbing the poi .. literalinclude:: sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp :language: cpp - :lines: 212-238 + :lines: 216-242 Compiling and running the program --------------------------------- diff --git a/doc/tutorials/content/moment_of_inertia.rst b/doc/tutorials/content/moment_of_inertia.rst index 9d83754572a..a50834e286a 100644 --- a/doc/tutorials/content/moment_of_inertia.rst +++ b/doc/tutorials/content/moment_of_inertia.rst @@ -47,32 +47,32 @@ Now let's study out what is the purpose of this code. First few lines will be om .. literalinclude:: sources/moment_of_inertia/moment_of_inertia.cpp :language: cpp - :lines: 13-15 + :lines: 16-18 These lines are simply loading the cloud from the .pcd file. .. literalinclude:: sources/moment_of_inertia/moment_of_inertia.cpp :language: cpp - :lines: 17-19 + :lines: 20-22 Here is the line where the instantiation of the ``pcl::MomentOfInertiaEstimation`` class takes place. Immediately after that we set the input cloud and start the computational process, that easy. .. literalinclude:: sources/moment_of_inertia/moment_of_inertia.cpp :language: cpp - :lines: 21-31 + :lines: 24-34 This is were we declare all necessary variables needed to store descriptors and bounding boxes. .. literalinclude:: sources/moment_of_inertia/moment_of_inertia.cpp :language: cpp - :lines: 33-39 + :lines: 36-42 These lines show how to access computed descriptors and other features. .. literalinclude:: sources/moment_of_inertia/moment_of_inertia.cpp :language: cpp - :lines: 41-47 + :lines: 44-50 These lines simply create the instance of ``PCLVisualizer`` class for result visualization. Here we also add the cloud and the AABB for visualization. We @@ -81,14 +81,14 @@ because the default is to use a solid cube. .. literalinclude:: sources/moment_of_inertia/moment_of_inertia.cpp :language: cpp - :lines: 49-52 + :lines: 52-55 Visualization of the OBB is little more complex. So here we create a quaternion from the rotational matrix, set OBBs position and pass it to the visualizer. .. literalinclude:: sources/moment_of_inertia/moment_of_inertia.cpp :language: cpp - :lines: 54-60 + :lines: 57-63 These lines are responsible for eigen vectors visualization. The few lines that are left simply launch the visualization process. diff --git a/doc/tutorials/content/normal_distributions_transform.rst b/doc/tutorials/content/normal_distributions_transform.rst index a5da1aac400..cf85d9ec5d6 100644 --- a/doc/tutorials/content/normal_distributions_transform.rst +++ b/doc/tutorials/content/normal_distributions_transform.rst @@ -25,31 +25,31 @@ Now, let's breakdown this code piece by piece. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 5-6 + :lines: 7-8 These are the required header files to use Normal Distributions Transform algorithm and a filter used to down sample the data. The filter can be exchanged for other filters but I have found the approximate voxel filter to produce the best results. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 14-30 + :lines: 17-33 The above code loads the two pcd file into pcl::PointCloud boost shared pointers. The input cloud will be transformed into the reference frame of the target cloud. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 32-39 + :lines: 35-42 This section filters the input cloud to improve registration time. Any filter that downsamples the data uniformly can work for this section. The target cloud does not need be filtered because voxel grid data structure used by the NDT algorithm does not use individual points, but instead uses the statistical data of the points contained in each of its data structures voxel cells. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 41-42 + :lines: 44-45 Here we create the NDT algorithm with the default values. The internal data structures are not initialized until later. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 44-50 + :lines: 47-53 Next we need to modify some of the scale dependent parameters. Because the NDT algorithm uses a voxelized data structure and More-Thuente line search, some parameters need to be scaled to fit the data set. The above parameters seem to work well on the scale we are working with, size of a room, but they would need to be significantly decreased to handle smaller objects, such as scans of a coffee mug. @@ -58,37 +58,37 @@ The Transformation Epsilon parameter defines minimum, allowable, incremental ch .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 52-53 + :lines: 55-56 This parameter controls the maximum number of iterations the optimizer can run. For the most part, the optimizer will terminate on the Transformation Epsilon before hitting this limit but this helps prevent it from running for too long in the wrong direction. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 55-58 + :lines: 58-61 Here, we pass the point clouds to the NDT registration program. The input cloud is the cloud that will be transformed and the target cloud is the reference frame to which the input cloud will be aligned. When the target cloud is added, the NDT algorithm's internal data structure is initialized using the target cloud data. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 60-63 + :lines: 63-66 In this section of code, we create an initial guess about the transformation needed to align the point clouds. Though the algorithm can be run without such an initial transformation, you tend to get better results with one, particularly if there is a large discrepancy between reference frames. In robotic applications, such as the ones used to generate this data set, the initial transformation is usually generated using odometry data. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 65-70 + :lines: 68-73 Finally, we are ready to align the point clouds. The resulting transformed input cloud is stored in the output cloud. We then display the results of the alignment as well as the Euclidean fitness score, calculated as the sum of squared distances from the output cloud to the closest point in the target cloud. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 72-76 + :lines: 75-79 Immediately after the alignment process, the output cloud will contain a transformed version of the filtered input cloud because we passed the algorithm a filtered point cloud, as opposed to the original input cloud. To obtain the aligned version of the original cloud, we extract the final transformation from the NDT algorithm and transform our original input cloud. We can now save this cloud to file ``room_scan2_transformed.pcd`` for future use. .. literalinclude:: sources/normal_distributions_transform/normal_distributions_transform.cpp :language: cpp - :lines: 78-106 + :lines: 81-109 This next part is unnecessary but I like to visually see the results of my labors. With PCL's visualizer classes, this can be easily accomplished. We first generate a visualizer with a black background. Then we colorize our target and output cloud, red and green respectively, and load them into the visualizer. Finally we start the visualizer and wait for the window to be closed. diff --git a/doc/tutorials/content/random_sample_consensus.rst b/doc/tutorials/content/random_sample_consensus.rst index 0406cf00b1b..d86328dccec 100644 --- a/doc/tutorials/content/random_sample_consensus.rst +++ b/doc/tutorials/content/random_sample_consensus.rst @@ -56,19 +56,19 @@ The following source code initializes two PointClouds and fills one of them with .. literalinclude:: sources/random_sample_consensus/random_sample_consensus.cpp :language: cpp - :lines: 30-63 + :lines: 33-66 Next we create a vector of ints that can store the locations of our inlier points from our PointCloud and now we can build our RandomSampleConsensus object using either a plane or a sphere model from our input cloud. .. literalinclude:: sources/random_sample_consensus/random_sample_consensus.cpp :language: cpp - :lines: 65-85 + :lines: 68-88 This last bit of code copies all of the points that fit our model to another cloud and then display either that or our original cloud in the viewer. .. literalinclude:: sources/random_sample_consensus/random_sample_consensus.cpp :language: cpp - :lines: 87-96 + :lines: 90-99 There is some extra code that relates to the display of the PointClouds in the 3D Viewer, but I'm not going to explain that here. diff --git a/doc/tutorials/content/region_growing_rgb_segmentation.rst b/doc/tutorials/content/region_growing_rgb_segmentation.rst index 5b2d675727f..a32ccf6d951 100644 --- a/doc/tutorials/content/region_growing_rgb_segmentation.rst +++ b/doc/tutorials/content/region_growing_rgb_segmentation.rst @@ -33,13 +33,13 @@ Let's take a look at first lines that are of interest: .. literalinclude:: sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp :language: cpp - :lines: 16-21 + :lines: 20-25 They are simply loading the cloud from the .pcd file. Note that points must have the color. .. literalinclude:: sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp :language: cpp - :lines: 30-30 + :lines: 34-34 This line is responsible for ``pcl::RegionGrowingRGB`` instantiation. This class has two parameters: @@ -49,40 +49,40 @@ This line is responsible for ``pcl::RegionGrowingRGB`` instantiation. This class .. literalinclude:: sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp :language: cpp - :lines: 31-33 + :lines: 35-37 These lines provide the instance with the input cloud, indices and search method. .. literalinclude:: sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp :language: cpp - :lines: 34-34 + :lines: 38-38 Here the distance threshold is set. It is used to determine whether the point is neighbouring or not. If the point is located at a distance less than the given threshold, then it is considered to be neighbouring. It is used for clusters neighbours search. .. literalinclude:: sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp :language: cpp - :lines: 35-35 + :lines: 39-39 This line sets the color threshold. Just as angle threshold is used for testing points normals in ``pcl::RegionGrowing`` to determine if the point belongs to cluster, this value is used for testing points colors. .. literalinclude:: sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp :language: cpp - :lines: 36-36 + :lines: 40-40 Here the color threshold for clusters is set. This value is similar to the previous, but is used when the merging process takes place. .. literalinclude:: sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp :language: cpp - :lines: 37-37 + :lines: 41-41 This value is similar to that which was used in the :ref:`region_growing_segmentation` tutorial. In addition to that, it is used for merging process mentioned in the beginning. If cluster has less points than was set through ``setMinClusterSize`` method, then it will be merged with the nearest neighbour. .. literalinclude:: sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp :language: cpp - :lines: 39-40 + :lines: 43-44 Here is the place where the algorithm is launched. It will return the array of clusters when the segmentation process will be over. diff --git a/doc/tutorials/content/sources/ensenso_cameras/ensenso_cloud_images_viewer.cpp b/doc/tutorials/content/sources/ensenso_cameras/ensenso_cloud_images_viewer.cpp index 6b33e90a02f..c02f1164c16 100644 --- a/doc/tutorials/content/sources/ensenso_cameras/ensenso_cloud_images_viewer.cpp +++ b/doc/tutorials/content/sources/ensenso_cameras/ensenso_cloud_images_viewer.cpp @@ -5,9 +5,10 @@ * @date November 2014 */ +#include #include +#include #include -#include #include #include @@ -17,6 +18,8 @@ #include #include +using namespace std::chrono_literals; + /** @brief Convenience typedef */ typedef pcl::PointXYZ PointT; @@ -135,7 +138,7 @@ main (void) while (!viewer_ptr->wasStopped ()) { PCL_INFO("FPS: %f\n", ensenso_ptr->getFramesPerSecond ()); - boost::this_thread::sleep (boost::posix_time::milliseconds (500)); + std::this_thread::sleep_for(500ms); } ensenso_ptr->stop (); diff --git a/doc/tutorials/content/sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp b/doc/tutorials/content/sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp index fa98acc4a6f..a2166a06f15 100644 --- a/doc/tutorials/content/sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp +++ b/doc/tutorials/content/sources/ground_based_rgbd_people_detection/src/main_ground_based_people_detection.cpp @@ -44,7 +44,9 @@ * Tracking people within groups with RGB-D data, * In Proceedings of the International Conference on Intelligent Robots and Systems (IROS) 2012, Vilamoura (Portugal), 2012. */ - + +#include + #include #include #include @@ -53,6 +55,8 @@ #include #include +using namespace std::chrono_literals; + typedef pcl::PointXYZRGBA PointT; typedef pcl::PointCloud PointCloudT; @@ -140,7 +144,7 @@ int main (int argc, char** argv) // Wait for the first frame: while(!new_cloud_available_flag) - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(1ms); new_cloud_available_flag = false; cloud_mutex.lock (); // for not overwriting the point cloud @@ -162,7 +166,7 @@ int main (int argc, char** argv) viewer.spin(); std::cout << "done." << std::endl; - cloud_mutex.unlock (); + cloud_mutex.unlock (); // Ground plane estimation: Eigen::VectorXf ground_coeffs; @@ -241,4 +245,3 @@ int main (int argc, char** argv) return 0; } - diff --git a/doc/tutorials/content/sources/moment_of_inertia/moment_of_inertia.cpp b/doc/tutorials/content/sources/moment_of_inertia/moment_of_inertia.cpp index 4f80466168b..af3e4db64d6 100644 --- a/doc/tutorials/content/sources/moment_of_inertia/moment_of_inertia.cpp +++ b/doc/tutorials/content/sources/moment_of_inertia/moment_of_inertia.cpp @@ -1,9 +1,12 @@ -#include #include +#include + +#include #include #include #include -#include + +using namespace std::chrono_literals; int main (int argc, char** argv) { @@ -62,7 +65,7 @@ int main (int argc, char** argv) while(!viewer->wasStopped()) { viewer->spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } return (0); diff --git a/doc/tutorials/content/sources/narf_descriptor_visualization/narf_descriptor_visualization.cpp b/doc/tutorials/content/sources/narf_descriptor_visualization/narf_descriptor_visualization.cpp index 5f7e7eaedb5..b9bcbbf8e58 100644 --- a/doc/tutorials/content/sources/narf_descriptor_visualization/narf_descriptor_visualization.cpp +++ b/doc/tutorials/content/sources/narf_descriptor_visualization/narf_descriptor_visualization.cpp @@ -2,7 +2,6 @@ #include -#include #include #include #include diff --git a/doc/tutorials/content/sources/narf_feature_extraction/narf_feature_extraction.cpp b/doc/tutorials/content/sources/narf_feature_extraction/narf_feature_extraction.cpp index 009c263d0eb..cbeb166edee 100644 --- a/doc/tutorials/content/sources/narf_feature_extraction/narf_feature_extraction.cpp +++ b/doc/tutorials/content/sources/narf_feature_extraction/narf_feature_extraction.cpp @@ -2,7 +2,6 @@ #include -#include #include #include #include diff --git a/doc/tutorials/content/sources/narf_keypoint_extraction/narf_keypoint_extraction.cpp b/doc/tutorials/content/sources/narf_keypoint_extraction/narf_keypoint_extraction.cpp index 5f4475831b3..3853cabf596 100644 --- a/doc/tutorials/content/sources/narf_keypoint_extraction/narf_keypoint_extraction.cpp +++ b/doc/tutorials/content/sources/narf_keypoint_extraction/narf_keypoint_extraction.cpp @@ -2,7 +2,6 @@ #include -#include #include #include #include diff --git a/doc/tutorials/content/sources/normal_distributions_transform/normal_distributions_transform.cpp b/doc/tutorials/content/sources/normal_distributions_transform/normal_distributions_transform.cpp index e1baac179fa..24938193ab8 100644 --- a/doc/tutorials/content/sources/normal_distributions_transform/normal_distributions_transform.cpp +++ b/doc/tutorials/content/sources/normal_distributions_transform/normal_distributions_transform.cpp @@ -1,4 +1,6 @@ #include +#include + #include #include @@ -6,7 +8,8 @@ #include #include -#include + +using namespace std::chrono_literals; int main (int argc, char** argv) @@ -102,7 +105,7 @@ main (int argc, char** argv) while (!viewer_final->wasStopped ()) { viewer_final->spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } return (0); diff --git a/doc/tutorials/content/sources/openni_grabber/openni_grabber.cpp b/doc/tutorials/content/sources/openni_grabber/openni_grabber.cpp index cb2bfca279a..b87555dfb21 100644 --- a/doc/tutorials/content/sources/openni_grabber/openni_grabber.cpp +++ b/doc/tutorials/content/sources/openni_grabber/openni_grabber.cpp @@ -1,8 +1,12 @@ +#include + #include #include #include #include +using namespace std::chrono_literals; + class SimpleOpenNIProcessor { public: @@ -36,7 +40,7 @@ class SimpleOpenNIProcessor // 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)); + std::this_thread::sleep_for(1s); // stop the grabber interface->stop (); diff --git a/doc/tutorials/content/sources/pcl_visualizer/pcl_visualizer_demo.cpp b/doc/tutorials/content/sources/pcl_visualizer/pcl_visualizer_demo.cpp index 7d6f8cbe39f..e8801aec2b6 100644 --- a/doc/tutorials/content/sources/pcl_visualizer/pcl_visualizer_demo.cpp +++ b/doc/tutorials/content/sources/pcl_visualizer/pcl_visualizer_demo.cpp @@ -1,15 +1,16 @@ /* \author Geoffrey Biggs */ - #include +#include -#include #include #include #include #include #include +using namespace std::chrono_literals; + // -------------- // -----Help----- // -------------- @@ -375,6 +376,6 @@ main (int argc, char** argv) while (!viewer->wasStopped ()) { viewer->spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } diff --git a/doc/tutorials/content/sources/random_sample_consensus/random_sample_consensus.cpp b/doc/tutorials/content/sources/random_sample_consensus/random_sample_consensus.cpp index 35cbb7b461c..4810ea5b5a4 100644 --- a/doc/tutorials/content/sources/random_sample_consensus/random_sample_consensus.cpp +++ b/doc/tutorials/content/sources/random_sample_consensus/random_sample_consensus.cpp @@ -1,4 +1,6 @@ #include +#include + #include #include #include @@ -7,7 +9,8 @@ #include #include #include -#include + +using namespace std::chrono_literals; pcl::visualization::PCLVisualizer::Ptr simpleVis (pcl::PointCloud::ConstPtr cloud) @@ -97,7 +100,7 @@ main(int argc, char** argv) while (!viewer->wasStopped ()) { viewer->spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } return 0; } diff --git a/doc/tutorials/content/sources/range_image_border_extraction/range_image_border_extraction.cpp b/doc/tutorials/content/sources/range_image_border_extraction/range_image_border_extraction.cpp index a72c1e35c74..10118be9c22 100644 --- a/doc/tutorials/content/sources/range_image_border_extraction/range_image_border_extraction.cpp +++ b/doc/tutorials/content/sources/range_image_border_extraction/range_image_border_extraction.cpp @@ -2,7 +2,6 @@ #include -#include #include #include #include diff --git a/doc/tutorials/content/sources/range_image_visualization/range_image_visualization.cpp b/doc/tutorials/content/sources/range_image_visualization/range_image_visualization.cpp index 04671f99c92..3699ec8b389 100644 --- a/doc/tutorials/content/sources/range_image_visualization/range_image_visualization.cpp +++ b/doc/tutorials/content/sources/range_image_visualization/range_image_visualization.cpp @@ -1,7 +1,5 @@ #include -#include - #include #include #include diff --git a/doc/tutorials/content/sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp b/doc/tutorials/content/sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp index 489073e132f..ba2db4119c8 100644 --- a/doc/tutorials/content/sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp +++ b/doc/tutorials/content/sources/region_growing_rgb_segmentation/region_growing_rgb_segmentation.cpp @@ -1,5 +1,7 @@ #include +#include #include + #include #include #include @@ -8,6 +10,8 @@ #include #include +using namespace std::chrono_literals; + int main (int argc, char** argv) { @@ -44,7 +48,7 @@ main (int argc, char** argv) viewer.showCloud (colored_cloud); while (!viewer.wasStopped ()) { - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } return (0); diff --git a/doc/tutorials/content/sources/tracking/tracking_sample.cpp b/doc/tutorials/content/sources/tracking/tracking_sample.cpp index d7c19ee2b59..b05518f77a0 100644 --- a/doc/tutorials/content/sources/tracking/tracking_sample.cpp +++ b/doc/tutorials/content/sources/tracking/tracking_sample.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -32,6 +34,7 @@ #include using namespace pcl::tracking; +using namespace std::chrono_literals; typedef pcl::PointXYZRGBA RefPointType; typedef ParticleXYZRPY ParticleT; @@ -135,7 +138,7 @@ viz_cb (pcl::visualization::PCLVisualizer& viz) if (!cloud_pass_) { - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); return; } @@ -280,6 +283,6 @@ main (int argc, char** argv) //Start viewer and object tracking interface->start(); while (!viewer_->wasStopped ()) - boost::this_thread::sleep(boost::posix_time::seconds(1)); + std::this_thread::sleep_for(1s); interface->stop(); } diff --git a/doc/tutorials/content/tracking.rst b/doc/tutorials/content/tracking.rst index 62b53743284..3c4df9ea8c7 100644 --- a/doc/tutorials/content/tracking.rst +++ b/doc/tutorials/content/tracking.rst @@ -60,40 +60,40 @@ Now, let's break down the code piece by piece. .. literalinclude:: sources/tracking/tracking_sample.cpp :language: cpp - :lines: 224-239 + :lines: 227-242 First, in main function, these lines set the parameters for tracking. .. literalinclude:: sources/tracking/tracking_sample.cpp :language: cpp - :lines: 243-254 + :lines: 246-257 Here, we set likelihood function which tracker use when calculate weights. You can add more likelihood function as you like. By default, there are normals likelihood and color likelihood functions. When you want to add other likelihood function, all you have to do is initialize new Coherence Class and add the Coherence instance to coherence variable with addPointCoherence function. .. literalinclude:: sources/tracking/tracking_sample.cpp :language: cpp - :lines: 256-269 + :lines: 259-272 In this part, we set the point cloud loaded from pcd file as reference model to tracker and also set model's transform values. .. literalinclude:: sources/tracking/tracking_sample.cpp :language: cpp - :lines: 170-177 + :lines: 173-180 Until the counter variable become equal to 10, we ignore the input point cloud, because the point cloud at first few frames often have noise. After counter variable reach to 10 frame, at each loop, we set downsampled input point cloud to tracker and the tracker will compute particles movement. .. literalinclude:: sources/tracking/tracking_sample.cpp :language: cpp - :lines: 79-79 + :lines: 82-82 In drawParticles function, you can get particles's positions by calling getParticles(). .. literalinclude:: sources/tracking/tracking_sample.cpp :language: cpp - :lines: 113-114 + :lines: 116-117 diff --git a/examples/segmentation/example_cpc_segmentation.cpp b/examples/segmentation/example_cpc_segmentation.cpp index 4040e921b10..950458077ff 100644 --- a/examples/segmentation/example_cpc_segmentation.cpp +++ b/examples/segmentation/example_cpc_segmentation.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,8 @@ #include #include +using namespace std::chrono_literals; + /// ***** Type Definitions ***** /// typedef pcl::PointXYZRGBA PointT; // The point type used for input @@ -594,7 +597,7 @@ CPCSegmentation Parameters: \n\ viewer->addText ("Press d to show help", 5, 10, 12, textcolor, textcolor, textcolor, "help_text"); } - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } /// END if (show_visualization) diff --git a/examples/segmentation/example_lccp_segmentation.cpp b/examples/segmentation/example_lccp_segmentation.cpp index 63f051575f5..ff2d7dac911 100644 --- a/examples/segmentation/example_lccp_segmentation.cpp +++ b/examples/segmentation/example_lccp_segmentation.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include @@ -63,6 +64,8 @@ #include #include +using namespace std::chrono_literals; + /// ***** Type Definitions ***** /// typedef pcl::PointXYZRGBA PointT; // The point type used for input @@ -492,7 +495,7 @@ LCCPSegmentation Parameters: \n\ viewer->addText ("Press d to show help", 5, 10, 12, 1.0, 1.0, 1.0, "help_text"); } - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } /// END if (show_visualization) diff --git a/examples/segmentation/example_supervoxels.cpp b/examples/segmentation/example_supervoxels.cpp index f22d9b2960e..56673e7b28f 100644 --- a/examples/segmentation/example_supervoxels.cpp +++ b/examples/segmentation/example_supervoxels.cpp @@ -1,3 +1,5 @@ +#include + #include #include #include @@ -13,6 +15,8 @@ #include #include +using namespace std::chrono_literals; + // Types typedef pcl::PointXYZRGBA PointT; typedef pcl::PointCloud PointCloudT; @@ -474,7 +478,7 @@ main (int argc, char ** argv) viewer->spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } return (0); diff --git a/examples/stereo/example_stereo_baseline.cpp b/examples/stereo/example_stereo_baseline.cpp index fba6419eb66..bf21c6f8f55 100644 --- a/examples/stereo/example_stereo_baseline.cpp +++ b/examples/stereo/example_stereo_baseline.cpp @@ -1,3 +1,4 @@ +#include #include #include @@ -16,6 +17,8 @@ * \ingroup stereo */ +using namespace std::chrono_literals; + int main(int argc, char **argv) { @@ -96,6 +99,6 @@ main(int argc, char **argv) { viewer->spinOnce (100); iv.spinOnce (100); // press 'q' to exit - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } diff --git a/gpu/kinfu_large_scale/tools/kinfuLS_app.cpp b/gpu/kinfu_large_scale/tools/kinfuLS_app.cpp index f423d021b7b..6d021551974 100644 --- a/gpu/kinfu_large_scale/tools/kinfuLS_app.cpp +++ b/gpu/kinfu_large_scale/tools/kinfuLS_app.cpp @@ -48,6 +48,7 @@ Work in progress: patch by Marco (AUG,19th 2012) #define _CRT_SECURE_NO_DEPRECATE #include +#include #include @@ -85,6 +86,7 @@ typedef pcl::ScopeTime ScopeTimeT; #include using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace Eigen; @@ -1016,7 +1018,7 @@ struct KinFuLSApp //~ cout << "In main loop" << endl; } exit_ = true; - boost::this_thread::sleep (boost::posix_time::millisec (100)); + std::this_thread::sleep_for(100ms); if (!triggered_capture) capture_.stop (); // Stop stream diff --git a/gpu/kinfu_large_scale/tools/record_maps_rgb.cpp b/gpu/kinfu_large_scale/tools/record_maps_rgb.cpp index 65231c4fe34..db1a1535383 100644 --- a/gpu/kinfu_large_scale/tools/record_maps_rgb.cpp +++ b/gpu/kinfu_large_scale/tools/record_maps_rgb.cpp @@ -32,20 +32,24 @@ * Author: Raphael Favier, Technical University Eindhoven, (r.mysurname < aT > tue.nl) */ +#include +#include +#include + #include #include #include #include #include -#include #include #include //fps calculations #include #include -#include #include +using namespace std::chrono_literals; + #define FPS_CALC(_WHAT_) \ do \ { \ @@ -264,7 +268,7 @@ grabAndSend () { if (is_done) break; - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); } interface->stop (); } @@ -320,7 +324,7 @@ main (int argc, char** argv) std::cout << "Starting the producer and consumer threads..." << std::endl; std::cout << "Press Ctrl-C to end" << std::endl; boost::thread producer (grabAndSend); - boost::this_thread::sleep (boost::posix_time::seconds (2)); + std::this_thread::sleep_for(2s); boost::thread consumer (receiveAndProcess); boost::thread consumer2 (receiveAndProcess); boost::thread consumer3 (receiveAndProcess); diff --git a/gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp b/gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp index bfb18d31d87..cd58e9f79e1 100644 --- a/gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp +++ b/gpu/kinfu_large_scale/tools/standalone_texture_mapping.cpp @@ -38,7 +38,6 @@ #include -#include #include #include diff --git a/gpu/people/tools/people_tracking.cpp b/gpu/people/tools/people_tracking.cpp index 2892f40bdce..5b7d032bb93 100644 --- a/gpu/people/tools/people_tracking.cpp +++ b/gpu/people/tools/people_tracking.cpp @@ -5,6 +5,7 @@ **/ ////// ALL INCLUDES ///////////// +#include #include #include #include @@ -23,6 +24,8 @@ #include #include +using namespace std::chrono_literals; + class PeopleTrackingApp { public: @@ -63,7 +66,7 @@ class PeopleTrackingApp while (!viewer.wasStopped()) { - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); } interface->stop (); } diff --git a/io/include/pcl/io/boost.h b/io/include/pcl/io/boost.h index 40b1ee8de8c..afd8a25277c 100644 --- a/io/include/pcl/io/boost.h +++ b/io/include/pcl/io/boost.h @@ -48,7 +48,6 @@ #include #include #include -#include #include #include #include diff --git a/io/include/pcl/io/davidsdk_grabber.h b/io/include/pcl/io/davidsdk_grabber.h index b6244cbeb02..92787d928ec 100644 --- a/io/include/pcl/io/davidsdk_grabber.h +++ b/io/include/pcl/io/davidsdk_grabber.h @@ -42,7 +42,6 @@ #include #include -#include #include #include diff --git a/io/include/pcl/io/depth_sense/depth_sense_device_manager.h b/io/include/pcl/io/depth_sense/depth_sense_device_manager.h index d2b432f0238..019bdd0b276 100644 --- a/io/include/pcl/io/depth_sense/depth_sense_device_manager.h +++ b/io/include/pcl/io/depth_sense/depth_sense_device_manager.h @@ -40,7 +40,6 @@ #include #include #include -#include #include diff --git a/io/include/pcl/io/ensenso_grabber.h b/io/include/pcl/io/ensenso_grabber.h index 6bedab9101d..e7d463584b7 100644 --- a/io/include/pcl/io/ensenso_grabber.h +++ b/io/include/pcl/io/ensenso_grabber.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include diff --git a/io/include/pcl/io/real_sense/real_sense_device_manager.h b/io/include/pcl/io/real_sense/real_sense_device_manager.h index 6d089c92a15..335a2224b61 100644 --- a/io/include/pcl/io/real_sense/real_sense_device_manager.h +++ b/io/include/pcl/io/real_sense/real_sense_device_manager.h @@ -37,7 +37,6 @@ #pragma once -#include #include #include #include diff --git a/io/include/pcl/io/real_sense_grabber.h b/io/include/pcl/io/real_sense_grabber.h index 635212453d1..979a0e05480 100644 --- a/io/include/pcl/io/real_sense_grabber.h +++ b/io/include/pcl/io/real_sense_grabber.h @@ -37,7 +37,6 @@ #pragma once -#include #include #include diff --git a/io/include/pcl/io/robot_eye_grabber.h b/io/include/pcl/io/robot_eye_grabber.h index d3cc149ace4..1f3671cf5ee 100644 --- a/io/include/pcl/io/robot_eye_grabber.h +++ b/io/include/pcl/io/robot_eye_grabber.h @@ -44,7 +44,6 @@ #include #include #include -#include namespace pcl { diff --git a/io/src/hdl_grabber.cpp b/io/src/hdl_grabber.cpp index 855f09f58ae..cdbded070cd 100644 --- a/io/src/hdl_grabber.cpp +++ b/io/src/hdl_grabber.cpp @@ -713,7 +713,7 @@ pcl::HDLGrabber::readPacketsFromPcap () uint64_t usec_delay = ((header->ts.tv_sec - lasttime.tv_sec) * 1000000) + (header->ts.tv_usec - lasttime.tv_usec); - boost::this_thread::sleep (boost::posix_time::microseconds (usec_delay)); + std::this_thread::sleep_for(std::chrono::microseconds(usec_delay)); lasttime.tv_sec = header->ts.tv_sec; lasttime.tv_usec = header->ts.tv_usec; diff --git a/io/src/openni2_grabber.cpp b/io/src/openni2_grabber.cpp index 94f03e221ce..045792a7074 100644 --- a/io/src/openni2_grabber.cpp +++ b/io/src/openni2_grabber.cpp @@ -249,8 +249,6 @@ pcl::io::OpenNI2Grabber::start () PCL_THROW_EXCEPTION (pcl::IOException, "Could not start streams. Reason: " << ex.what ()); } - // workaround, since the first frame is corrupted - //boost::this_thread::sleep (boost::posix_time::seconds (1)); unblock_signals (); } diff --git a/io/src/openni_grabber.cpp b/io/src/openni_grabber.cpp index df9405f0276..b7ab48d8711 100644 --- a/io/src/openni_grabber.cpp +++ b/io/src/openni_grabber.cpp @@ -47,6 +47,9 @@ #include #include #include +#include + +using namespace std::chrono_literals; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// pcl::OpenNIGrabber::OpenNIGrabber (const std::string& device_id, const Mode& depth_mode, const Mode& image_mode) @@ -241,7 +244,7 @@ pcl::OpenNIGrabber::start () PCL_THROW_EXCEPTION (pcl::IOException, "Could not start streams. Reason: " << ex.what ()); } // workaround, since the first frame is corrupted - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); unblock_signals (); } diff --git a/io/tools/openni_pcd_recorder.cpp b/io/tools/openni_pcd_recorder.cpp index 03d2b807827..3f3124712ea 100644 --- a/io/tools/openni_pcd_recorder.cpp +++ b/io/tools/openni_pcd_recorder.cpp @@ -40,12 +40,14 @@ #include #include #include +#include #include #include #include #include //fps calculations using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace pcl::console; @@ -239,7 +241,7 @@ class Producer { if (is_done) break; - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); } interface->stop (); } @@ -459,7 +461,7 @@ main (int argc, char** argv) PCDBuffer buf; buf.setCapacity (buff_size); Producer producer (buf, depth_mode); - boost::this_thread::sleep (boost::posix_time::seconds (2)); + std::this_thread::sleep_for(2s); Consumer consumer (buf); signal (SIGINT, ctrlC); @@ -472,7 +474,7 @@ main (int argc, char** argv) PCDBuffer buf; buf.setCapacity (buff_size); Producer producer (buf, depth_mode); - boost::this_thread::sleep (boost::posix_time::seconds (2)); + std::this_thread::sleep_for(2s); Consumer consumer (buf); signal (SIGINT, ctrlC); diff --git a/outofcore/src/visualization/outofcore_cloud.cpp b/outofcore/src/visualization/outofcore_cloud.cpp index cc7624ee6a2..9ee0fde118e 100644 --- a/outofcore/src/visualization/outofcore_cloud.cpp +++ b/outofcore/src/visualization/outofcore_cloud.cpp @@ -33,10 +33,6 @@ #include #include -// Boost -//#include -//#include -#include // Forward Declarations diff --git a/people/apps/main_ground_based_people_detection.cpp b/people/apps/main_ground_based_people_detection.cpp index 1fab1b223e5..c61b17382e4 100644 --- a/people/apps/main_ground_based_people_detection.cpp +++ b/people/apps/main_ground_based_people_detection.cpp @@ -44,7 +44,9 @@ * Tracking people within groups with RGB-D data, * In Proceedings of the International Conference on Intelligent Robots and Systems (IROS) 2012, Vilamoura (Portugal), 2012. */ - + +#include + #include #include #include @@ -53,6 +55,8 @@ #include #include +using namespace std::chrono_literals; + typedef pcl::PointXYZRGBA PointT; typedef pcl::PointCloud PointCloudT; @@ -145,7 +149,7 @@ int main (int argc, char** argv) // Wait for the first frame: while(!new_cloud_available_flag) - boost::this_thread::sleep(boost::posix_time::milliseconds(1)); + std::this_thread::sleep_for(1ms); new_cloud_available_flag = false; cloud_mutex.lock (); // for not overwriting the point cloud diff --git a/simulation/tools/sim_test_simple.cpp b/simulation/tools/sim_test_simple.cpp index 71e99091ab5..ba429117dec 100644 --- a/simulation/tools/sim_test_simple.cpp +++ b/simulation/tools/sim_test_simple.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN @@ -69,7 +70,6 @@ // Pop-up viewer #include -#include using namespace Eigen; using namespace pcl; @@ -78,6 +78,7 @@ using namespace pcl::io; using namespace pcl::simulation; using namespace std; +using namespace std::chrono_literals; uint16_t t_gamma[2048]; @@ -412,7 +413,7 @@ void display () while (!viewer->wasStopped ()) { viewer->spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } // doesn't work: diff --git a/simulation/tools/sim_viewer.cpp b/simulation/tools/sim_viewer.cpp index 8185afc581b..6effe7c8898 100644 --- a/simulation/tools/sim_viewer.cpp +++ b/simulation/tools/sim_viewer.cpp @@ -85,8 +85,6 @@ // Pop-up viewer #include -#include - #include #include diff --git a/test/io/test_grabbers.cpp b/test/io/test_grabbers.cpp index 7e7b7f16cb6..fba88871bcb 100644 --- a/test/io/test_grabbers.cpp +++ b/test/io/test_grabbers.cpp @@ -6,9 +6,11 @@ #include #include +#include #include using namespace std; +using namespace std::chrono_literals; typedef pcl::PointXYZRGBA PointT; typedef pcl::PointCloud CloudT; @@ -48,7 +50,7 @@ TEST (PCL, PCDGrabber) grabber.registerCallback (fxn); grabber.start (); // 1 second should be /plenty/ of time - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); grabber.stop (); //// Make sure they match @@ -125,7 +127,7 @@ TEST (PCL, ImageGrabberTIFF) size_t niter = 0; while (!signal_received) { - boost::this_thread::sleep (boost::posix_time::microseconds (10000)); + std::this_thread::sleep_for(10ms); if (++niter > 100) { #ifdef PCL_BUILT_WITH_VTK @@ -207,7 +209,7 @@ TEST (PCL, ImageGrabberPCLZF) size_t niter = 0; while (!signal_received) { - boost::this_thread::sleep (boost::posix_time::microseconds (10000)); + std::this_thread::sleep_for(10ms); if (++niter > 100) { ASSERT_TRUE (false); @@ -287,7 +289,7 @@ TEST (PCL, ImageGrabberOMP) size_t niter = 0; while (!signal_received) { - boost::this_thread::sleep (boost::posix_time::microseconds (10000)); + std::this_thread::sleep_for(10ms); if (++niter > 100) { ASSERT_TRUE (false); @@ -396,7 +398,7 @@ TEST (PCL, ImageGrabberSetIntrinsicsTIFF) size_t niter = 0; while (!signal_received) { - boost::this_thread::sleep (boost::posix_time::microseconds (10000)); + std::this_thread::sleep_for(10ms); if (++niter > 100) { #ifdef PCL_BUILT_WITH_VTK @@ -470,7 +472,7 @@ TEST (PCL, ImageGrabberSetIntrinsicsPCLZF) size_t niter = 0; while (!signal_received) { - boost::this_thread::sleep (boost::posix_time::microseconds (10000)); + std::this_thread::sleep_for(10ms); if (++niter > 100) { ASSERT_TRUE (false); diff --git a/tools/boost.h b/tools/boost.h index 9fc8462f6ce..0a55c64b8d3 100644 --- a/tools/boost.h +++ b/tools/boost.h @@ -48,12 +48,8 @@ // Marking all Boost headers as system headers to remove warnings #include #include -#include #include #include #include #include -#include -//#include -//#include #endif diff --git a/tools/obj_rec_ransac_accepted_hypotheses.cpp b/tools/obj_rec_ransac_accepted_hypotheses.cpp index f3526638aa3..fb7514eea7f 100644 --- a/tools/obj_rec_ransac_accepted_hypotheses.cpp +++ b/tools/obj_rec_ransac_accepted_hypotheses.cpp @@ -61,9 +61,11 @@ #include #include #include +#include #include using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace io; using namespace console; @@ -457,7 +459,7 @@ run (float pair_width, float voxel_size, float max_coplanarity_angle, int num_hy { //main loop of the visualizer viz.spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } vtk_model->Delete (); diff --git a/tools/obj_rec_ransac_hash_table.cpp b/tools/obj_rec_ransac_hash_table.cpp index 47f2290e9e9..561bc18951e 100644 --- a/tools/obj_rec_ransac_hash_table.cpp +++ b/tools/obj_rec_ransac_hash_table.cpp @@ -56,9 +56,11 @@ #include #include #include +#include #include using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace io; using namespace console; @@ -223,7 +225,7 @@ visualize (const ModelLibrary::HashTable& hash_table) while (!vis.wasStopped ()) { vis.spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } diff --git a/tools/obj_rec_ransac_model_opps.cpp b/tools/obj_rec_ransac_model_opps.cpp index 39fc93fc54b..2ae4f69c755 100644 --- a/tools/obj_rec_ransac_model_opps.cpp +++ b/tools/obj_rec_ransac_model_opps.cpp @@ -55,9 +55,11 @@ #include #include #include +#include #include using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace io; using namespace console; @@ -160,7 +162,7 @@ void run (float pair_width, float voxel_size, float max_coplanarity_angle) { //main loop of the visualizer viz.spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } diff --git a/tools/obj_rec_ransac_orr_octree.cpp b/tools/obj_rec_ransac_orr_octree.cpp index a2facb2b11c..ca01b2df4a7 100644 --- a/tools/obj_rec_ransac_orr_octree.cpp +++ b/tools/obj_rec_ransac_orr_octree.cpp @@ -66,11 +66,13 @@ #include #include #include +#include using namespace pcl; using namespace pcl::visualization; using namespace pcl::recognition; using namespace pcl::io; +using namespace std::chrono_literals; void run (const char *file_name, float voxel_size); bool vtk_to_pointcloud (const char* file_name, PointCloud& pcl_points, PointCloud* pcl_normals); @@ -240,7 +242,7 @@ void run (const char* file_name, float voxel_size) { //main loop of the visualizer viz.spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } diff --git a/tools/obj_rec_ransac_orr_octree_zprojection.cpp b/tools/obj_rec_ransac_orr_octree_zprojection.cpp index 8cfcd278e01..9549a87bbee 100644 --- a/tools/obj_rec_ransac_orr_octree_zprojection.cpp +++ b/tools/obj_rec_ransac_orr_octree_zprojection.cpp @@ -66,11 +66,13 @@ #include #include #include +#include using namespace pcl; using namespace pcl::visualization; using namespace pcl::recognition; using namespace pcl::io; +using namespace std::chrono_literals; void run (const char *file_name, float voxel_size); bool vtk_to_pointcloud (const char* file_name, PointCloud& points); @@ -145,7 +147,7 @@ void run (const char* file_name, float voxel_size) { //main loop of the visualizer viz.spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } diff --git a/tools/obj_rec_ransac_result.cpp b/tools/obj_rec_ransac_result.cpp index 9314417068d..ed74416b1a5 100644 --- a/tools/obj_rec_ransac_result.cpp +++ b/tools/obj_rec_ransac_result.cpp @@ -62,8 +62,10 @@ #include #include #include +#include using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace io; using namespace console; @@ -221,7 +223,7 @@ run (float pair_width, float voxel_size, float max_coplanarity_angle) { //main loop of the visualizer viz.spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } diff --git a/tools/obj_rec_ransac_scene_opps.cpp b/tools/obj_rec_ransac_scene_opps.cpp index 9031bad0484..87c67721799 100644 --- a/tools/obj_rec_ransac_scene_opps.cpp +++ b/tools/obj_rec_ransac_scene_opps.cpp @@ -56,9 +56,11 @@ #include #include #include +#include #include using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace io; using namespace console; @@ -240,7 +242,7 @@ void run (float pair_width, float voxel_size, float max_coplanarity_angle) { //main loop of the visualizer viz.spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); + std::this_thread::sleep_for(100ms); } } diff --git a/tools/octree_viewer.cpp b/tools/octree_viewer.cpp index 26a785edf33..f40f66e3b92 100644 --- a/tools/octree_viewer.cpp +++ b/tools/octree_viewer.cpp @@ -35,6 +35,8 @@ * \author Raphael Favier * */ +#include + #include #include #include @@ -52,6 +54,8 @@ #include #include +using namespace std::chrono_literals; + class OctreeViewer { public: @@ -191,7 +195,7 @@ class OctreeViewer { //main loop of the visualizer viz.spinOnce(100); - boost::this_thread::sleep(boost::posix_time::microseconds(100000)); + std::this_thread::sleep_for(100ms); } } diff --git a/tools/pcl_video.cpp b/tools/pcl_video.cpp index eb381f40971..aaf4e1c3e83 100644 --- a/tools/pcl_video.cpp +++ b/tools/pcl_video.cpp @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -53,6 +54,7 @@ #include #include "boost.h" +using namespace std::chrono_literals; namespace bpt = boost::posix_time; @@ -387,7 +389,7 @@ class Player played_time = bpt::microsec_clock::local_time() - pb_start; bpt::time_duration sleep_time(blk_offset - played_time); std::cerr << "Will sleep " << sleep_time << " until displaying block\n"; - boost::this_thread::sleep(sleep_time); + std::this_thread::sleep_for(sleep_time); viewer_.showCloud(cloud); //viewer_.removePointCloud("1"); //viewer_.addPointCloud(cloud, "1"); diff --git a/visualization/include/pcl/visualization/boost.h b/visualization/include/pcl/visualization/boost.h index 7f0de550e94..6a0a1478727 100644 --- a/visualization/include/pcl/visualization/boost.h +++ b/visualization/include/pcl/visualization/boost.h @@ -57,7 +57,6 @@ #include #include #include -#include #include #ifndef Q_MOC_RUN #include diff --git a/visualization/include/pcl/visualization/impl/registration_visualizer.hpp b/visualization/include/pcl/visualization/impl/registration_visualizer.hpp index 5e6abb0e575..669cbd12938 100644 --- a/visualization/include/pcl/visualization/impl/registration_visualizer.hpp +++ b/visualization/include/pcl/visualization/impl/registration_visualizer.hpp @@ -36,6 +36,8 @@ * */ +#include + ////////////////////////////////////////////////////////////////////////////////////////////// template void pcl::RegistrationVisualizer::startDisplay () @@ -172,8 +174,8 @@ pcl::RegistrationVisualizer::runDisplay () // Render visualizer updated buffers viewer_->spinOnce (100); - boost::this_thread::sleep (boost::posix_time::microseconds (100000)); - + using namespace std::chrono_literals; + std::this_thread::sleep_for(100ms); } } diff --git a/visualization/src/histogram_visualizer.cpp b/visualization/src/histogram_visualizer.cpp index 60faeba64a4..1b842b0664c 100644 --- a/visualization/src/histogram_visualizer.cpp +++ b/visualization/src/histogram_visualizer.cpp @@ -36,6 +36,8 @@ * */ +#include + #include #include #include @@ -52,6 +54,8 @@ #include #include +using namespace std::chrono_literals; + ////////////////////////////////////////////////////////////////////////////////////////////// pcl::visualization::PCLHistogramVisualizer::PCLHistogramVisualizer () : wins_ (), @@ -90,7 +94,7 @@ pcl::visualization::PCLHistogramVisualizer::spin () spinOnce (); if (stopped_) break; - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); } while (true); } diff --git a/visualization/tools/davidsdk_viewer.cpp b/visualization/tools/davidsdk_viewer.cpp index ee25e7bbce4..fd678b108b8 100644 --- a/visualization/tools/davidsdk_viewer.cpp +++ b/visualization/tools/davidsdk_viewer.cpp @@ -40,6 +40,8 @@ #include #include +using namespace std::chrono_literals; + /** @brief Convenience typedef */ typedef pcl::visualization::CloudViewer CloudViewer; @@ -98,7 +100,7 @@ main (int argc, while (!viewer_ptr->wasStopped ()) { - boost::this_thread::sleep (boost::posix_time::seconds (20)); + std::this_thread::sleep_for(20s); std::cout << "FPS: " << davidsdk_ptr->getFramesPerSecond () << std::endl; } diff --git a/visualization/tools/ensenso_viewer.cpp b/visualization/tools/ensenso_viewer.cpp index 720f4f0e663..20fbcaf1e68 100644 --- a/visualization/tools/ensenso_viewer.cpp +++ b/visualization/tools/ensenso_viewer.cpp @@ -40,6 +40,8 @@ #include #include +using namespace std::chrono_literals; + /** @brief Convenience typedef */ typedef pcl::visualization::CloudViewer CloudViewer; @@ -78,7 +80,7 @@ main (void) while (!viewer_ptr->wasStopped ()) { - boost::this_thread::sleep (boost::posix_time::milliseconds (1000)); + std::this_thread::sleep_for(1s); std::cout << "FPS: " << ensenso_ptr->getFramesPerSecond () << std::endl; } diff --git a/visualization/tools/hdl_viewer_simple.cpp b/visualization/tools/hdl_viewer_simple.cpp index fe0881f942f..d523e1b0357 100644 --- a/visualization/tools/hdl_viewer_simple.cpp +++ b/visualization/tools/hdl_viewer_simple.cpp @@ -47,10 +47,12 @@ #include #include #include +#include #include #include using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace pcl::console; using namespace pcl::visualization; @@ -177,7 +179,7 @@ class SimpleHDLViewer if (!grabber_.isRunning ()) cloud_viewer_->spin (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } grabber_.stop (); diff --git a/visualization/tools/image_grabber_viewer.cpp b/visualization/tools/image_grabber_viewer.cpp index c744c77aa00..466a26523dd 100644 --- a/visualization/tools/image_grabber_viewer.cpp +++ b/visualization/tools/image_grabber_viewer.cpp @@ -36,6 +36,9 @@ * * */ + +#include + #include #include #include @@ -44,6 +47,7 @@ #include #include +using namespace std::chrono_literals; using pcl::console::print_error; using pcl::console::print_info; using pcl::console::print_value; @@ -250,7 +254,7 @@ main (int argc, char** argv) if (!cloud_) { - boost::this_thread::sleep(boost::posix_time::microseconds(10000)); + std::this_thread::sleep_for(10ms); continue; } else if (mutex_.try_lock ()) diff --git a/visualization/tools/image_viewer.cpp b/visualization/tools/image_viewer.cpp index 03f35dd916f..a01a510a82f 100644 --- a/visualization/tools/image_viewer.cpp +++ b/visualization/tools/image_viewer.cpp @@ -36,10 +36,6 @@ * */ -#ifndef Q_MOC_RUN -#include -#include -#endif #include #include #include //fps calculations diff --git a/visualization/tools/openni_image.cpp b/visualization/tools/openni_image.cpp index a81618611d0..5e9763178b2 100644 --- a/visualization/tools/openni_image.cpp +++ b/visualization/tools/openni_image.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,7 @@ #include using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace pcl::console; @@ -322,7 +324,7 @@ class Writer if (save_data || toggle_one_frame_capture) writeToDisk (buf_.popFront ()); else - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } if (save_data && buf_.getSize () > 0) @@ -417,7 +419,7 @@ class Driver while (!is_done) { - boost::this_thread::sleep (boost::posix_time::seconds (1)); + std::this_thread::sleep_for(1s); } grabber_.stop (); image_connection.disconnect (); @@ -476,7 +478,7 @@ class Viewer !depth_image_viewer_->wasStopped () && !is_done) { - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); if (!visualize) { diff --git a/visualization/tools/pcd_grabber_viewer.cpp b/visualization/tools/pcd_grabber_viewer.cpp index 7d44e8fadef..971e152298c 100644 --- a/visualization/tools/pcd_grabber_viewer.cpp +++ b/visualization/tools/pcd_grabber_viewer.cpp @@ -36,6 +36,9 @@ * * */ + +#include + #include #include #include @@ -43,6 +46,7 @@ #include #include +using namespace std::chrono_literals; using pcl::console::print_error; using pcl::console::print_info; using pcl::console::print_value; @@ -244,7 +248,7 @@ main (int argc, char** argv) if (!cloud_) { - boost::this_thread::sleep(boost::posix_time::microseconds(10000)); + std::this_thread::sleep_for(10ms); continue; } else if (mutex_.try_lock ()) diff --git a/visualization/tools/pcd_viewer.cpp b/visualization/tools/pcd_viewer.cpp index b6b91cb392e..d740030181f 100644 --- a/visualization/tools/pcd_viewer.cpp +++ b/visualization/tools/pcd_viewer.cpp @@ -37,6 +37,9 @@ * $Id$ * */ + +#include + // PCL #include #include @@ -55,6 +58,7 @@ #include #include +using namespace std::chrono_literals; using namespace pcl::console; typedef pcl::visualization::PointCloudColorHandler ColorHandler; @@ -731,7 +735,7 @@ main (int argc, char** argv) } p->spinOnce (); } - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } while (!stopped); } diff --git a/visualization/tools/timed_trigger_test.cpp b/visualization/tools/timed_trigger_test.cpp index 117c7231652..c703ca07bce 100644 --- a/visualization/tools/timed_trigger_test.cpp +++ b/visualization/tools/timed_trigger_test.cpp @@ -1,9 +1,11 @@ #include +#include #include #include #include using namespace std; +using namespace std::chrono_literals; using namespace pcl; double global_time; @@ -14,7 +16,8 @@ void callback () double elapsed = pcl::getTime () - last_time; last_time = pcl::getTime (); cout << "global fn: " << pcl::getTime () - global_time << " :: " << elapsed << endl; - boost::this_thread::sleep(boost::posix_time::microseconds(1000)); + + std::this_thread::sleep_for(1ms); } class Dummy @@ -35,10 +38,10 @@ int main () Dummy dummy; global_time = pcl::getTime (); trigger.start (); - boost::this_thread::sleep(boost::posix_time::seconds(2)); + std::this_thread::sleep_for(2s); trigger.registerCallback ( boost::bind(&Dummy::myTimer, dummy)); - boost::this_thread::sleep(boost::posix_time::seconds(3)); + std::this_thread::sleep_for(3s); trigger.setInterval (0.2); - boost::this_thread::sleep(boost::posix_time::seconds(2)); + std::this_thread::sleep_for(2s); return 0; } diff --git a/visualization/tools/vlp_viewer.cpp b/visualization/tools/vlp_viewer.cpp index 51dce565f30..3a824c89e5b 100644 --- a/visualization/tools/vlp_viewer.cpp +++ b/visualization/tools/vlp_viewer.cpp @@ -36,6 +36,8 @@ * Author: Keven Ring */ +#include + #include #include #include //fps calculations @@ -55,6 +57,7 @@ #include using namespace std; +using namespace std::chrono_literals; using namespace pcl; using namespace pcl::console; using namespace pcl::visualization; @@ -185,7 +188,7 @@ class SimpleVLPViewer if (!grabber_.isRunning ()) cloud_viewer_->spin (); - boost::this_thread::sleep (boost::posix_time::microseconds (100)); + std::this_thread::sleep_for(100us); } grabber_.stop ();