From abc0c501a3609af21032a532ab70a8c5b6198331 Mon Sep 17 00:00:00 2001 From: Markus Vieth <39675748+mvieth@users.noreply.github.com> Date: Mon, 6 May 2024 17:56:35 +0200 Subject: [PATCH] In PCL 1.14.1 and newer, generate smaller point cloud msgs (#450) See also https://github.com/PointCloudLibrary/pcl/pull/5913 --- pcl_conversions/include/pcl_conversions/pcl_conversions.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pcl_conversions/include/pcl_conversions/pcl_conversions.h b/pcl_conversions/include/pcl_conversions/pcl_conversions.h index 7743ad87..3326a9c0 100644 --- a/pcl_conversions/include/pcl_conversions/pcl_conversions.h +++ b/pcl_conversions/include/pcl_conversions/pcl_conversions.h @@ -560,7 +560,12 @@ namespace pcl { void toROSMsg(const pcl::PointCloud &pcl_cloud, sensor_msgs::msg::PointCloud2 &cloud) { pcl::PCLPointCloud2 pcl_pc2; +#if PCL_VERSION_COMPARE(>=, 1, 14, 1) + // if PCL version is recent enough, request that all padding be removed to make the msg as small as possible + pcl::toPCLPointCloud2(pcl_cloud, pcl_pc2, false); +#else pcl::toPCLPointCloud2(pcl_cloud, pcl_pc2); +#endif pcl_conversions::moveFromPCL(pcl_pc2, cloud); }